function [bryfile, ctl]=nepd_ex_bry(sub_I, sub_J, grd, grdn, nameit, res, trange, npzd, np) % function [bryfile, ctl]=nepd_ex_bry(sub_I, sub_J, grd, grdn, nameit, res, trange, npzd, np) % Extract a subgrid of GRD at resolution RES for the % subdomain SUB_I, SUB_J. % RES=1 keep existing resolution % RES=2 double the resolution % INITTIME choosen date for initial condition in MATLAB datenum format % NP number of passive tracers to introduce in initial cond. % NPZD =1 to introduce NPZD variables, else =0 %% % Requires RNT, RGRD, RNC, Opendap and netcdf % % GLOBEC Ocean Modeling Support % - E. Di Lorenzo (globec_extract@o3d.org) % bryfile=[nameit,'-bry.nc']; solution='http://dods.o3d.org:8080/thredds/dodsC/nepd/nepd_forc_full_monthly_avg.nc'; ctl=rnt_timectl({solution},'ocean_time','r'); % Compute dates and find index of selected initial condition for i=1:length(ctl.time) mydate(i)=datenum(ctl.year(i)+1950, ctl.month(i),ctl.day(i)); end ctl.mydate=mydate; istr=find(ctl.mydate < trange(1)); istr=istr(end); iend=find(ctl.mydate > trange(2)); iend=iend(1); timeind_range=istr:iend; % INPUTS optbry.npzd=npzd; optbry.bry_time = length(timeind_range); optbry.bry_time_cycle=0; optbry.ptracer = np; optbry.bry_timeVal = ctl.time(timeind_range)/60/60/24; % extract openboundary conndition disp (['Creating Sub BRY file ',bryfile]); rnc_CreateBryFile(grdn,bryfile, optbry); opt.npzd=0; rnc_SubBryEx(ctl,grd,grdn,timeind_range,bryfile,sub_I,sub_J, opt); % /drive/edl/matlib-master/rnc/rnc_Sub_Ini_Bry.m % /drive/edl/matlib-master/rnc/rnc_SubBryEx.m % /drive/edl/matlib-master/rnc/rnc_CreateBryFile.m