
% reichle, 27 Jan 2020

datapath = '/gpfsm/dnb31/rreichle/tmp_FP_FPP/data/';

yearmonth  = '201910';

exp1 = 'f522_fp';
exp2 = 'f525land_fpp';

thislon = 130;
thislat = -20;

this_collection = 'tavg1_2d_lnd_Nx';

this_varname = 'TSOIL1';

% ---------------------------------------------------------------------------------------------

fn1 = [datapath, '/', exp1, '.', this_collection, '.diurnal.', yearmonth, '.nc4'];
fn2 = [datapath, '/', exp2, '.', this_collection, '.diurnal.', yearmonth, '.nc4'];

% assume same coords, units

lat1 = ncread(fn1,'lat');
lon1 = ncread(fn1,'lon');

myunits = ncreadatt(fn1, this_varname,'units');

data1 = ncread(fn1, this_varname);
data2 = ncread(fn2, this_varname);

% select location

indlon = find( abs(lon1-thislon)==min(abs(lon1-thislon)));
indlat = find( abs(lat1-thislat)==min(abs(lat1-thislat)));

figure

h1 = plot( squeeze(data1(indlon,indlat,:)),'k-+');
hold on
h2 = plot( squeeze(data2(indlon,indlat,:)),'r-o');

set(h1,'LineWidth',1.5, 'MarkerSize', 8)
set(h2,'LineWidth',1.5, 'MarkerSize', 8)

hl = legend(weed_out_underscores({exp1, exp2},'\_'));

title([this_varname, ' [', myunits, '], ', yearmonth, ', lat=', num2str(thislat), ', lon=', num2str(thislon)])

myxtick      = [1:6:24];
myxticklabel = {'0:30z', '6:30z', '12:30z', '18:30z'};

set(gca,'XTick',     myxtick);
set(gca,'XTickLabel',myxticklabel);

hx = xlabel('UTC');

grid on

set(gca, 'FontSize', 12)
set(hl,  'FontSize', 12)
set(hx,  'FontSize', 12)

print('-dpng','-r300','tmpplotmeandiurnalcycle.png')

% ============== EOF =============================================
