; Purpose: to make ocean state files for mooring locations ni1_arr=[76,82,92] ; array # of desired longitudes -1 for interpolation ni2_arr=[77,83,93] ; array # of desired longitudes +1 nj0=112 ; equator for T and U, EQ-1 for V nj1=113 ; EQ+1 for V nl1=0 ; surface layer nl2=42 ; bottom layer needed nl=nl2-nl1+1 ; number of layers lon_nam=strarr(1) ; plot panel label for longitude ; loop to select longitude for lon_val=0,2 do begin y1=2000 & y2=2006 ; years ny=y2-y1+1 ; year range nq=4 ; # of quarter years nd=9 ; # of 10 day means in a quarter nt=nd*nq*ny ; # of 10 day means in total time range ; define arrays w/ dimensions: (layers,10-dy means,quarters,years) T=fltarr(nl,nd,nq,ny) ; temperature V=fltarr(nl,nd,nq,ny) ; meridional velocity U=fltarr(nl,nd,nq,ny) ; zonal velocity P1=fltarr(nd,nq,ny) ; time P1(*,*,*)=0. ni1 = ni1_arr(lon_val) ni2 = ni2_arr(lon_val) lon_nam(*)=ni2 ; loop to select year for ix0=0,ny-1 do begin year0=y1+ix0 print,year0 year=strtrim(year0,2) ; loop to select quarter-year file for ix1=0,nq-1 do begin if ix1 eq 0 then quart='01_09' & if ix1 eq 0 then dys='00001_02160' if ix1 eq 1 then quart='10_18' & if ix1 eq 1 then dys='02160_04320' if ix1 eq 2 then quart='19_27' & if ix1 eq 2 then dys='04320_06480' if ix1 eq 3 then quart='28_37' & if ix1 eq 3 then dys='06480_08880' file1='/host/crab/data01/ecco1/data4/dr066b7/dr066b7_'+year+'/n10day_'+quart+'/Tave_08_08.'+dys+'_240.cdf' fi1=ncdf_open(file1) ncdf_varget,fi1,0,lat ncdf_varget,fi1,1,lat_v ncdf_varget,fi1,2,lon ncdf_varget,fi1,3,lon_u ncdf_varget,fi1,4,depth ncdf_varget,fi1,5,time ncdf_varget,fi1,6,Tave T(*,*,ix1,ix0)=reform(rebin(reform(Tave(ni1:ni2,nj0,0:nl2,0:8),2,nl,nd),1,nl,nd),nl,nd) P1(*,ix1,ix0)=time(0:8) ncdf_close,fi1 file2='/host/crab/data01/ecco1/data4/dr066b7/dr066b7_'+year+'/n10day_'+quart+'/Vave_08_08.'+dys+'_240.cdf' fi2=ncdf_open(file2) ncdf_varget,fi2,0,lat ncdf_varget,fi2,1,lat_v ncdf_varget,fi2,2,lon ncdf_varget,fi2,3,lon_u ncdf_varget,fi2,4,depth ncdf_varget,fi2,5,time ncdf_varget,fi2,6,Vave V(*,*,ix1,ix0)=reform(rebin(rebin(reform(Vave(ni1:ni2,nj0:nj1,0:nl2,0:8),2,2,nl,nd),1,2,nl,nd),1,1,nl,nd),nl,nd) ncdf_close,fi2 file3='/host/crab/data01/ecco1/data4/dr066b7/dr066b7_'+year+'/n10day_'+quart+'/Uave_08_08.'+dys+'_240.cdf' fi3=ncdf_open(file3) ncdf_varget,fi3,0,lat ncdf_varget,fi3,1,lat_v ncdf_varget,fi3,2,lon ncdf_varget,fi3,3,lon_u ncdf_varget,fi3,4,depth ncdf_varget,fi3,5,time ncdf_varget,fi3,6,Uave U(*,*,ix1,ix0)=reform(Uave(ni2,nj0,0:nl2,0:8),nl,nd) ncdf_close,fi3 endfor ; for quarters endfor ; for years ; reform to single time dimension TT0=reform(T,nl,nt) VV0=reform(V,nl,nt) UU0=reform(U,nl,nt) dpth=depth(0:nl2) tim10=reform(P1,nt) ;********** ; add 2007 ;********** np=14 ntt=nt+np TT=fltarr(nl,ntt) VV=fltarr(nl,ntt) UU=fltarr(nl,ntt) tim1=fltarr(ntt) TT(*,0:nt-1)=TT0 VV(*,0:nt-1)=VV0 UU(*,0:nt-1)=UU0 tim1(0:nt-1)=tim10 Tb=fltarr(nl,np) ; temperature Vb=fltarr(nl,np) ; meridional velocity Ub=fltarr(nl,np) ; zonal velocity P1b=fltarr(np) ; time year0=2007 print,year0 year=strtrim(year0,2) ; loop to select quarter-year file for ix1=0,1 do begin if ix1 eq 0 then quart='01_09' & if ix1 eq 0 then dys='00001_02160' & if ix1 eq 0 then nd=9 & if ix1 eq 0 then nds=0 if ix1 eq 1 then quart='10_14' & if ix1 eq 1 then dys='02160_03360' & if ix1 eq 1 then nd=5 & if ix1 eq 1 then nds=9 file1='/host/crab/data01/ecco1/data4/dr066b7/dr066b7_'+year+'/n10day_'+quart+'/Tave_08_08.'+dys+'_240.cdf' fi1=ncdf_open(file1) ncdf_varget,fi1,0,lat ncdf_varget,fi1,1,lat_v ncdf_varget,fi1,2,lon ncdf_varget,fi1,3,lon_u ncdf_varget,fi1,4,depth ncdf_varget,fi1,5,time ncdf_varget,fi1,6,Tave Tb(*,nds:nds+nd-1)=reform(rebin(reform(Tave(ni1:ni2,nj0,0:nl2,0:nd-1),2,nl,nd),1,nl,nd),nl,nd) P1b(nds:nds+nd-1)=time(0:nd-1) ncdf_close,fi1 file2='/host/crab/data01/ecco1/data4/dr066b7/dr066b7_'+year+'/n10day_'+quart+'/Vave_08_08.'+dys+'_240.cdf' fi2=ncdf_open(file2) ncdf_varget,fi2,0,lat ncdf_varget,fi2,1,lat_v ncdf_varget,fi2,2,lon ncdf_varget,fi2,3,lon_u ncdf_varget,fi2,4,depth ncdf_varget,fi2,5,time ncdf_varget,fi2,6,Vave Vb(*,nds:nds+nd-1)=reform(rebin(rebin(reform(Vave(ni1:ni2,nj0:nj1,0:nl2,0:nd-1),2,2,nl,nd),1,2,nl,nd),1,1,nl,nd),nl,nd) ncdf_close,fi2 file3='/host/crab/data01/ecco1/data4/dr066b7/dr066b7_'+year+'/n10day_'+quart+'/Uave_08_08.'+dys+'_240.cdf' fi3=ncdf_open(file3) ncdf_varget,fi3,0,lat ncdf_varget,fi3,1,lat_v ncdf_varget,fi3,2,lon ncdf_varget,fi3,3,lon_u ncdf_varget,fi3,4,depth ncdf_varget,fi3,5,time ncdf_varget,fi3,6,Uave Ub(*,nds:nds+nd-1)=reform(Uave(ni2,nj0,0:nl2,0:nd-1),nl,nd) ncdf_close,fi3 endfor ; for quarters TT(*,nt:ntt-1)=Tb VV(*,nt:ntt-1)=Vb UU(*,nt:ntt-1)=Ub tim1(nt:ntt-1)=P1b ; reset nt nt=ntt TT=reform(TT,nl,nt) VV=reform(VV,nl,nt) UU=reform(UU,nl,nt) tim1=reform(tim1,nt) ;****** ;****** ;****** ; select file label if lon_val eq 0 then lon2='lon77' if lon_val eq 1 then lon2='lon83' if lon_val eq 2 then lon2='lon93' ; write files ;Tid = NCDF_CREATE('/.automount/crab/root/mnt/data02/halkides/files4Murty/Tave.10dy'+lon2+'E.EQ.5to4415m.yrs00to06.nc',/clobber) Tid = NCDF_CREATE('Tave.10dy'+lon2+'E.EQ.5to4415m.yrs00toMay07.nc',/clobber) dim1 = NCDF_DIMDEF(Tid,'Zdim', nl) ; define main variable dimensions dim2 = NCDF_DIMDEF(Tid,'timedim', /unlimited) var1 = NCDF_VARDEF(Tid,'depth',[dim1],/double) ; create arrays for dimension and main variables var2 = NCDF_VARDEF(Tid,'time',[dim2],/double) var3 = NCDF_VARDEF(Tid,'temperature',[dim1,dim2],/double) NCDF_CONTROL, Tid, /ENDEF ; Put the file into data mode NCDF_VARPUT, Tid,var1, dpth ; fill pre-defined variable arrays with data blocks NCDF_VARPUT, Tid,var2, tim1 NCDF_VARPUT, Tid,var3, TT NCDF_CLOSE, Tid ;Uid = NCDF_CREATE('/.automount/crab/root/mnt/data02/halkides/files4Murty/Uave.10dy'+lon2+'E.EQ.5to4415m.yrs00to06.nc',/clobber) Uid = NCDF_CREATE('Uave.10dy'+lon2+'E.EQ.5to4415m.yrs00toMay07.nc',/clobber) dim4 = NCDF_DIMDEF(Uid,'Zdim', nl) dim5 = NCDF_DIMDEF(Uid,'timedim', /unlimited) var4 = NCDF_VARDEF(Uid,'depth',[dim1],/double) var5 = NCDF_VARDEF(Uid,'time',[dim2],/double) var6 = NCDF_VARDEF(Uid,'U_velocity',[dim1,dim2],/double) NCDF_CONTROL, Uid, /ENDEF NCDF_VARPUT, Uid,var4, dpth NCDF_VARPUT, Uid,var5, tim1 NCDF_VARPUT, Uid,var6, UU NCDF_CLOSE, Uid ;Vid = NCDF_CREATE('/.automount/crab/root/mnt/data02/halkides/files4Murty/Vave.10dy'+lon2+'E.EQ.5to4415m.yrs00to06.nc',/clobber) Vid = NCDF_CREATE('Vave.10dy'+lon2+'E.EQ.5to4415m.yrs00toMay07.nc',/clobber) dim7 = NCDF_DIMDEF(Vid,'Zdim', nl) dim8 = NCDF_DIMDEF(Vid,'timedim', /unlimited) var7 = NCDF_VARDEF(Vid,'depth',[dim1],/double) var8 = NCDF_VARDEF(Vid,'time',[dim2],/double) var9 = NCDF_VARDEF(Vid,'V_velocity',[dim1,dim2],/double) NCDF_CONTROL, Vid, /ENDEF NCDF_VARPUT, Vid,var7, dpth NCDF_VARPUT, Vid,var8, tim1 NCDF_VARPUT, Vid,var9, VV NCDF_CLOSE, Vid ; plot to check data file='datacheck'+lon2+'_toMay07.ps' set_plot, 'PS' device, xsize=20., xoffset=1., ysize=20., yoffset=3., filename=file, /color !p.multi=[0,3,11] loadct, 39 landscape=1. !x.style=1 !y.style=1 !P.FONT=1 DEVICE, SET_FONT='Helvetica*thin*proof', /TT_FONT !X.MARGIN=[3.,3.] !Y.MARGIN=[3.,3.] years=[' ','00',' ','01',' ','02',' ','03',' ','04',' ','05',' ','06',' ','07',' '] for dd=0,nl-1 do begin lyrnam=strtrim(dd,2) dptnam=string(depth(dd),format='(F10.1)') pltvar1=reform(TT(dd,*),nt) plot,tim1,pltvar1,yrange=[min(pltvar1),max(pltvar1)],xticks=16.,xminor=0,xtickn=years,title='T at '+dptnam+'m and'+lon_nam+'E',color=245,$ ytit='[!uo!nC]' pltvar2=reform(VV(dd,*),nt) plot,tim1,pltvar2,yrange=[min(pltvar2),max(pltvar2)],xticks=16.,xminor=0,xtickn=years,title='V at '+dptnam+'m and'+lon_nam+'E',color=50,$ ytit='[m/s]' pltvar3=reform(UU(dd,*),nt) plot,tim1,pltvar3,yrange=[min(pltvar3),max(pltvar3)],xticks=16.,xminor=0,xtickn=years,title='U at '+dptnam+'m and'+lon_nam+'E',color=150,$ ytit='[m/s]' endfor endps,/notime Print,"Figure(s) complete..." spawn,'gv datacheck'+lon2+'_toMay07.ps &' endfor; lon_val loop ;*** end