clear;close all;clc;

addpath('/Users/xudo627/donghui/CODE/Setup-E3SM-Mac/matlab-scripts-for-mosart/');
addpath('/Users/xudo627/donghui/mylib/m/');
addpath('/Users/xudo627/donghui/CODE/dengwirda-inpoly-355c57c/');

load('/Users/xudo627/projects/wetland_inundation/giems025_lake025.mat');

[lon_gsim,lat_gsim,Sh,yr,mo,da,mu_gsim,sd,cv] = get_GSIM_discharge('BR_0002835',1);

in = inpoly2([lons025(:) lats025(:)],[Sh.X' Sh.Y']);

figure;
plot_globalspatial(lons025,lats025,giems025); hold on;
plot(Sh.X,Sh.Y,'r-','LineWidth',2);


figure;
plot_globalspatial(lons025,lats025,lake025); hold on;
plot(Sh.X,Sh.Y,'r-','LineWidth',2);

lake025(isnan(lake025)) = 0;
figure;
plot_globalspatial(lons025,lats025,giems025 - lake025); hold on;
plot(Sh.X,Sh.Y,'r-','LineWidth',2); caxis([0 1]);