pro read_dg,dg_data,input_file=input_file,style=style,no_stop=no_stop,$ about=about,$ ;;Instantaneous diagnostics - complete list - complete read statements aparms=aparms,x=x,nxn=nxn,y=y,nyn=nyn,z=z,nzn=nzn,rho=rho,rhon=rhon,$ ubar=ubar,vbar=vbar,thbar=thbar,thinit=thinit,thref=thref,qbar=qbar,$ prefn=prefn,$ ;;C2 Time Averaged diagnostics - complete list - incomplete read statements uu=uu,uusg=uusg,vv=vv,vvsg=vvsg,ubrav=ubrav,vbrav=vbrav,uv=uv,uvsg=uvsg,$ dis=dis,uw=uw,vw=vw,ww=ww,wp=wp,wpz=wpz,wke=wke,www=www,wwww=wwww,uwsg=uwsg,$ vwsg=vwsg,wwsg=wwsg,wkesg=wkesg,upx=upx,vpy=vpy,thbav=thbav,thth=thth,$ th2sg=th2sg,thdis=thdis,wthad=wthad,wthcn=wthcn,wthth=wthth,wthsg=wthsg,$ qbav=qbav,vis=vis,diff=diff,risg=risg,ri2sg=ri2sg,pp=pp,pbar=pbar,disr=disr,$ tend=tend,sres=sres,ssub=ssub,wbsg=wbsg,sed=sed,wqad=wqad,wqcn=wqcn,$ wqsg=wqsg,tstar=tstar,tpbav=tpbav,qlbav=qlbav,dra=dra,thflx=thflx,$ thgra=thgra,thdif=thdif,thboy=thboy,thprs=thprs,thcon=thcon,dwtdt=dwtdt,$ qflx=qflx,qgra=qgra,qdif=qdif,qboy=qboy,qprs=qprs,qcon=qcon,dwqdt=dwqdt,$ usub=usub,vsub=vsub,thsub=thsub,qsub=qsub,suls=suls,svls=svls,sthls=sthls,$ sqls=sqls,$ ;***C3 Conditional diagnostics***;- complete list - incomplete read statements acc_a=acc_a,all_w=all_w,acc_wq=acc_wq,$ ;*** C4 Timeseries ***; times=times,lathf=lathf,senhf=senhf,wmax=wmax,wmin=wmin,mflux=mflux,$ uflux=uflux,vflux=vflux,reske=reske,subke=subke,liqcc=liqcc,totc=totcc,$ cltop=cltop,clbas=clbas,qlmax=qlmax,hqlmax=hqlmax,citop=citop,cibas=cibas,$ ctocc=ctocc,totqv=totqv,totql=totql,totqi=totqi,totqr=totqr,totqs=totqs,$ totqg=totqg,ppt=ppt,pptcv=pptcv,pptst=pptst,acv=acv,ast=ast,olrav=olrav,$ dslwa=dslwa,uslwa=uslwa,dtswa=dtswa,utswa=utswa,dsswa=dsswa,usswa=usswa,$ qmx=qmx,hqm=hqm,pud=pud,$ ;*** C5 2D and 3D fields ***; u2d=u2d,v2d=v2d,w2d=w2d,th2d=th2d,q2d=q2d,$ p2d=p2d,pv2d=pv2d,theta2d=theta2d,$ thv2d=thv2d,lwpfld2d=lwpfld2d,iwpfld=iwpfld,$ swap_ends=swap_ends ;+ ;pro read_dg,dg_data,input_file=input_file,style=style,no_stop=no_stop,$ ;about=about,DIAGNOSTIC_KEYWORDS=DIAGNOSTIC_KEYWORDS ;JOHN MARSHAM 12/5/03 ; ;Reads an LEM diagnostic file (optionally specified by input_file) ;into a structure dg_data. Which components are read is specified by ;the diagnostic keywords or the style keyword. The final dg_data ;strcture is described if about=1. The code stops unless no_stop=1. ; ;style=default,'dj01','timeseries' ; ;Needs .run davtools to run. ; ;swap_ends=1 should do swap_endian on whole structure - untested! ; ;- if n_params() lt 1 then begin print,'pro read_dg,dg_data,input_file=input_file,style=style,no_stop=no_stop,' print,'about=about,DIAGNOSTIC_KEYWORDS=DIAGNOSTIC_KEYWORDS' print,'JOHN MARSHAM 12/5/03' print,'' print,'Reads an LEM diagnostic file (optionally specified by input_file)' print,'into a structure dg_data. Which components are read is specified by' print,'the diagnostic keywords or the style keyword. The final dg_data' print,'strcture is described if about=1. The code stops unless no_stop=1.' print,'Needs .run davtools to run.' return endif if not keyword_set(style) then begin x=1; this should be read from file somehow? nxn=1 y=1 nyn=1 z=1 nzn=1 qbar=1 ;2-D q2d=1 th2d=1 endif else begin if style eq 'dj01' then begin x=1; this should be read from file somehow? nxn=1 y=1 nyn=1 z=1 nzn=1 rho=1 rhon=1 ubar=1 vbar=1 thbar=1 thref=1 thinit=1 qbar=1 prefn=1 ;timeaveraged uu=1 uusg=1 vv=1 vvsg=1 ubrav=1 vbrav=1 ww=1 wke=1 wwsg=1 wkesg=1 risg=1 disr=1 tend=1 sres=1 ssub=1 wbsg=1 sed=1 ;conditionall all_iprm=1 all_ifrw=1 all_ihal=1 all_idep=1 all_icnt=1 all_isub=1 all_ssub=1 all_sdep=1 all_dth=1 all_lw=1 all_lwu=1 all_lwn=1 all_sw=1 all_swu=1 all_swd=1 all_swn=1 ;timeseries totqv=1 totql=1 totqi=1 ;2-D u2d=1 v2d=1 w2d=1 q2d=1 th2d=1 ; iwpfld=1 ;3d only i think endif if style eq 'timeseries' then begin x=1 nxn=1 y=1 nyn=1 z=1 nzn=1 times=1 wmax=1 reske=1 subke=1 totcc=1 ctocc=1 ctoqv=1 totql=1 totqi=1 totqr=1 totqs=1 totqg=1 acv=1 ast=1 olrav=1 dsswa=1 qmx=1 endif endelse if not keyword_set(input_file) then $ input_file=dialog_pickfile(filter='~jmarsham/LEM/AUTOOUT/*.*') dg_data=create_struct('file',input_file) ;Next set of commands obtain data from diagnostic input_file ;if keyword_set() then getdata, '', input_file, height_w ;***C1 Instantaneous diagnostics***; if keyword_set(aparms) then begin getdata, 'aparms', input_file, aparms dg_data=create_struct(dg_data,'aparms',aparms) endif if keyword_set(x) then begin getdata, 'x', input_file, x dg_data=create_struct(dg_data,'x',x) endif if keyword_set(nxn) then begin getdata, 'xn', input_file, xn dg_data=create_struct(dg_data,'xn',xn) endif if keyword_set(y) then begin getdata, 'y', input_file, y dg_data=create_struct(dg_data,'y',y) endif if keyword_set(nyn) then begin getdata, 'yn', input_file, yn dg_data=create_struct(dg_data,'yn',yn) endif ;1D height data at w points (m) if keyword_set(z) then begin getdata, 'Z', input_file, z dg_data=create_struct(dg_data,'z',z) endif ;1D height data at p points (m) if keyword_set(nzn) then begin getdata, 'ZN', input_file, zn dg_data=create_struct(dg_data,'zn',zn) endif if keyword_set(rho) then begin getdata, 'rho', input_file, rho dg_data=create_struct(dg_data,'rho',rho) endif if keyword_set(nrhon) then begin getdata, 'rhon', input_file,rhon dg_data=create_struct(dg_data,'rhon',rhon) endif if keyword_set(ubar) then begin getdata, 'ubar', input_file, ubar dg_data=create_struct(dg_data,'ubar',ubar) endif if keyword_set(vbar) then begin getdata, 'vbar', input_file, vbar dg_data=create_struct(dg_data,'vbar',vbar) endif if keyword_set(thbar) then begin getdata, 'thbar', input_file, thbar dg_data=create_struct(dg_data,'thbar',thbar) endif if keyword_set(thinit) then begin getdata, 'thinit', input_file, thinit dg_data=create_struct(dg_data,'thinit',thinit) endif if keyword_set(thref) then begin getdata, 'thref', input_file, thref dg_data=create_struct(dg_data,'thref',thref) endif if keyword_set(qbar) then begin ; generalise to nq q variables getdata, 'qbar01', input_file, qbar01 getdata, 'qbar02', input_file, qbar02 getdata, 'qbar03', input_file, qbar03 getdata, 'qbar04', input_file, qbar04 getdata, 'qbar05', input_file, qbar05 getdata, 'qbar06', input_file, qbar06 ;getdata, 'qbar07', input_file, qbar07 dg_data=create_struct(dg_data,'qbar01',qbar01) dg_data=create_struct(dg_data,'qbar02',qbar02) dg_data=create_struct(dg_data,'qbar03',qbar03) dg_data=create_struct(dg_data,'qbar04',qbar04) dg_data=create_struct(dg_data,'qbar05',qbar05) dg_data=create_struct(dg_data,'qbar06',qbar06) ;dg_data=create_struct(dg_data,'qbar07',qbar07) endif if keyword_set(prefn) then begin getdata, 'prefn', input_file, prefn dg_data=create_struct(dg_data,'prefn',prefn) endif ;***C2 Time Averaged diagnostics***; if keyword_set(uu) then begin getdata, 'uu', input_file, uu dg_data=create_struct(dg_data,'uu',uu) endif if keyword_set(uusg) then begin getdata, 'uusg', input_file, vvsg dg_data=create_struct(dg_data,'uusg',uusg) endif if keyword_set(vv) then begin getdata, 'vv', input_file, vv dg_data=create_struct(dg_data,'vv',vv) endif if keyword_set(vvsg) then begin getdata, 'vvsg', input_file, vvsg dg_data=create_struct(dg_data,'vvsg',vvsg) endif ;mean horizontal wind dir in U (m/s) if keyword_set(ubrav) then begin getdata, 'UBRAV', input_file, ubrav dg_data=create_struct(dg_data,'ubrav',ubrav) endif if keyword_set(vbrav) then begin getdata, 'vbrav', input_file, vbrav dg_data=create_struct(dg_data,'vbrav',vbrav) endif if keyword_set(ww) then begin getdata, 'ww', input_file, ww dg_data=create_struct(dg_data,'ww',ww) endif ;kinetic energy flux if keyword_set(wke) then begin getdata, 'WKE', input_file, wke dg_data=create_struct(dg_data,'wke',wke) endif if keyword_set(wwsg) then begin getdata, 'wwsg', input_file, wwsg dg_data=create_struct(dg_data,'wwsg',wwsg) endif if keyword_set(wkesg) then begin getdata, 'WKE', input_file, wkesg dg_data=create_struct(dg_data,'wkesg',wkesg) endif ;mean potential temp (K) if keyword_set(thbav) then begin getdata, 'THBAV', input_file, thbav dg_data=create_struct(dg_data,'thbav',thbav) endif ;mean mixing ratio for the q fields (water vapour kg/kg) ; generalise to nq q variables if keyword_set(qbav) then begin getdata, 'QBAV01', input_file, qbav01 getdata, 'QBAV02', input_file, qbav02 getdata, 'QBAV03', input_file, qbav03 getdata, 'QBAV04', input_file, qbav04 getdata, 'QBAV05', input_file, qbav05 getdata, 'QBAV06', input_file, qbav06 getdata, 'QBAV07', input_file, qbav07 getdata, 'QBAV08', input_file, qbav08 dg_data=create_struct(dg_data,'qbav01',qbav01) dg_data=create_struct(dg_data,'qbav02',qbav02) dg_data=create_struct(dg_data,'qbav03',qbav03) dg_data=create_struct(dg_data,'qbav04',qbav04) dg_data=create_struct(dg_data,'qbav05',qbav05) dg_data=create_struct(dg_data,'qbav06',qbav06) dg_data=create_struct(dg_data,'qbav07',qbav07) dg_data=create_struct(dg_data,'qbav08',qbav08) endif if keyword_set(risg) then begin getdata, 'risg', input_file, risg dg_data=create_struct(dg_data,'risg',risg) endif if keyword_set(disr) then begin getdata, 'disr', input_file, disr dg_data=create_struct(dg_data,'disr',disr) endif ;TKE energy tendency if keyword_set(tend) then begin getdata, 'TEND', input_file, tend dg_data=create_struct(dg_data,'tend',tend) endif if keyword_set(disr) then begin getdata, 'sres', input_file, sres dg_data=create_struct(dg_data,'sres',sres) endif if keyword_set(ssub) then begin getdata, 'ssub', input_file, ssub dg_data=create_struct(dg_data,'ssub',ssub) endif if keyword_set(wbsg) then begin getdata, 'wbsg', input_file, wbsg dg_data=create_struct(dg_data,'wbsg',wbsg) endif if keyword_set(sed) then begin getdata, 'sed', input_file, sed dg_data=create_struct(dg_data,'sed',sed) endif ;mean liquid water mixing ratio (kg/kg) if keyword_set(qlbrav) then begin getdata, 'QLBAV', input_file, qlbav dg_data=create_struct(dg_data,'qlbav',qlbav) endif ;***C3 Conditional diagnostics***; ;fractional coverage of cloudy points if keyword_set(acc_a) then begin getdata, 'ACC_A', input_file, acc_a dg_data=create_struct(dg_data,'acc_a',acc_a) endif ;vertical velocity for all points m/s if keyword_set(all_w) then begin getdata, 'ALL_W', input_file, all_w dg_data=create_struct(dg_data,'all_w',all_w) endif ;vertical flux in q field if keyword_set(acc_wq) then begin; generalise to nq q variables getdata, 'ACC_WQ01', input_file, acc_wq01 getdata, 'ACC_WQ02', input_file, acc_wq02 getdata, 'ACC_WQ03', input_file, acc_wq03 getdata, 'ACC_WQ04', input_file, acc_wq04 getdata, 'ACC_WQ05', input_file, acc_wq05 getdata, 'ACC_WQ06', input_file, acc_wq06 getdata, 'ACC_WQ07', input_file, acc_wq07 getdata, 'ACC_WQ08', input_file, acc_wq08 dg_data=create_struct(dg_data,'acc_wq01',acc_wq01) dg_data=create_struct(dg_data,'acc_wq02',acc_wq02) dg_data=create_struct(dg_data,'acc_wq03',acc_wq03) dg_data=create_struct(dg_data,'acc_wq04',acc_wq04) dg_data=create_struct(dg_data,'acc_wq05',acc_wq05) dg_data=create_struct(dg_data,'acc_wq06',acc_wq06) dg_data=create_struct(dg_data,'acc_wq07',acc_wq07) dg_data=create_struct(dg_data,'acc_wq08',acc_wq08) endif ;*** C4 Timeseries ***; if keyword_set(times) then begin getdata, 'times', input_file, times dg_data=create_struct(dg_data,'times',times) endif if keyword_set(wmax) then begin getdata, 'wmax', input_file, wmax dg_data=create_struct(dg_data,'wmax',wmax) endif if keyword_set(wmin) then begin getdata, 'wmin', input_file, wmin dg_data=create_struct(dg_data,'wmin',wmin) endif if keyword_set(reske) then begin getdata, 'reske', input_file, reske dg_data=create_struct(dg_data,'reske',reske) endif if keyword_set(subke) then begin getdata, 'subke', input_file, subke dg_data=create_struct(dg_data,'subke',subke) endif if keyword_set(totcc) then begin getdata, 'totcc', input_file, totcc dg_data=create_struct(dg_data,'totcc',totcc) endif if keyword_set(ctocc) then begin getdata, 'ctocc', input_file, ctocc dg_data=create_struct(dg_data,'ctocc',ctocc) endif if keyword_set(totqv) then begin getdata, 'totqv', input_file, totqv dg_data=create_struct(dg_data,'totqv',totqv) endif if keyword_set(totql) then begin getdata, 'totql', input_file, totql dg_data=create_struct(dg_data,'totql',totql) endif if keyword_set(totqi) then begin getdata, 'totqi', input_file, totqi dg_data=create_struct(dg_data,'totqi',totqi) endif if keyword_set(totqr) then begin getdata, 'totqr', input_file, totqr dg_data=create_struct(dg_data,'totqr',totqr) endif if keyword_set(totqs) then begin getdata, 'totqs', input_file, totqs dg_data=create_struct(dg_data,'totqs',totqs) endif if keyword_set(totqg) then begin getdata, 'totqg', input_file, totqg dg_data=create_struct(dg_data,'totqg',totqg) endif if keyword_set(acv) then begin getdata, 'acv', input_file, acv dg_data=create_struct(dg_data,'acv',acv) endif if keyword_set(ast) then begin getdata, 'ast', input_file, ast dg_data=create_struct(dg_data,'ast',ast) endif if keyword_set(olrav) then begin getdata, 'olrav', input_file, olrav dg_data=create_struct(dg_data,'olrav',olrav) endif if keyword_set(dtswa) then begin getdata, 'dtswa', input_file, dtswa dg_data=create_struct(dg_data,'dtswa',dtswa) endif if keyword_set(qmx) then begin getdata, 'q01mx', input_file, q01mx getdata, 'q02mx', input_file, q02mx getdata, 'q03mx', input_file, q03mx getdata, 'q04mx', input_file, q04mx getdata, 'q05mx', input_file, q05mx getdata, 'q06mx', input_file, q06mx getdata, 'q07mx', input_file, q07mx dg_data=create_struct(dg_data,'q01mx',q01mx) dg_data=create_struct(dg_data,'q02mx',q02mx) dg_data=create_struct(dg_data,'q03mx',q03mx) dg_data=create_struct(dg_data,'q04mx',q04mx) dg_data=create_struct(dg_data,'q05mx',q05mx) dg_data=create_struct(dg_data,'q06mx',q06mx) dg_data=create_struct(dg_data,'q07mx',q07mx) endif if keyword_set(all_ifrw) then begin getdata, 'ALL_PIFRW', input_file, all_ifrw dg_data=create_struct(dg_data,'all_ifrw',all_ifrw) endif if keyword_set(all_iprm) then begin getdata, 'ALL_PIPRM', input_file, all_iprm dg_data=create_struct(dg_data,'all_iprm',all_iprm) endif if keyword_set(all_ihal) then begin getdata, 'ALL_PIHAL', input_file, all_ihal dg_data=create_struct(dg_data,'all_ihal',all_ihal) endif if keyword_set(all_idep) then begin getdata, 'ALL_PIDEP', input_file, all_idep dg_data=create_struct(dg_data,'all_idep',all_idep) endif if keyword_set(all_icnt) then begin getdata, 'ALL_PICNT', input_file, all_icnt dg_data=create_struct(dg_data,'all_icnt',all_icnt) endif if keyword_set(all_isub) then begin getdata, 'ALL_PISUB', input_file, all_isub dg_data=create_struct(dg_data,'all_isub',all_isub) endif if keyword_set(all_ssub) then begin getdata, 'ALL_PSSUB', input_file, all_ssub dg_data=create_struct(dg_data,'all_ssub',all_ssub) endif if keyword_set(all_sdep) then begin getdata, 'ALL_PSDEP', input_file, all_sdep dg_data=create_struct(dg_data,'all_sdep',all_sdep) endif if keyword_set(all_dth) then begin getdata, 'ALL_DTH', input_file, all_dth dg_data=create_struct(dg_data,'all_dth',all_dth) endif if keyword_set(all_lw) then begin getdata, 'ALL_LW', input_file, all_lw dg_data=create_struct(dg_data,'all_lw',all_lw) endif if keyword_set(all_lwu) then begin getdata, 'ALL_LWU', input_file, all_lwu dg_data=create_struct(dg_data,'all_lwu',all_lwu) endif if keyword_set(all_lwn) then begin getdata, 'ALL_LWN', input_file, all_lwn dg_data=create_struct(dg_data,'all_lwn',all_lwn) endif if keyword_set(all_sw) then begin getdata, 'ALL_SW', input_file, all_sw dg_data=create_struct(dg_data,'all_sw',all_sw) endif if keyword_set(all_swu) then begin getdata, 'ALL_SWU', input_file, all_swu dg_data=create_struct(dg_data,'all_swu',all_swu) endif if keyword_set(all_swd) then begin getdata, 'ALL_SWD', input_file, all_swd dg_data=create_struct(dg_data,'all_swd',all_swd) endif if keyword_set(all_swn) then begin getdata, 'ALL_SWN', input_file, all_swn dg_data=create_struct(dg_data,'all_swn',all_swn) endif ;*** C5 2D and 3D fields ***; if keyword_set(u2d) then begin getdata, 'u2d[I=1]', input_file, u2di1 dg_data=create_struct(dg_data,'u2di1',u2di1) endif if keyword_set(v2d) then begin getdata, 'v2d[I=1]', input_file, v2di1 dg_data=create_struct(dg_data,'v2di1',v2di1) endif if keyword_set(w2d) then begin getdata, 'w2d[I=1]', input_file, w2di1 dg_data=create_struct(dg_data,'w2di1',w2di1) endif if keyword_set(th2d) then begin getdata, 'th2d[I=1]', input_file, th2di1 dg_data=create_struct(dg_data,'th2di1',th2di1) endif if keyword_set(q2d) then begin; generalise to nq q variables getdata, 'q012d[I=1]', input_file, q2d01i1 getdata, 'q022d[I=1]', input_file, q2d02i1 getdata, 'q032d[I=1]', input_file, q2d03i1 getdata, 'q042d[I=1]', input_file, q2d04i1 getdata, 'q052d[I=1]', input_file, q2d05i1 getdata, 'q062d[I=1]', input_file, q2d06i1 getdata, 'q072d[I=1]', input_file, q2d07i1 dg_data=create_struct(dg_data,'q2d01i1',q2d01i1) dg_data=create_struct(dg_data,'q2d02i1',q2d02i1) dg_data=create_struct(dg_data,'q2d03i1',q2d03i1) dg_data=create_struct(dg_data,'q2d04i1',q2d04i1) dg_data=create_struct(dg_data,'q2d05i1',q2d05i1) dg_data=create_struct(dg_data,'q2d06i1',q2d06i1) dg_data=create_struct(dg_data,'q2d07i1',q2d07i1) endif if keyword_set(p2d) then begin getdata, 'p2d[I=1]', input_file, p2di1 dg_data=create_struct(dg_data,'p2di1',p2di1) endif if keyword_set(pv2d) then begin getdata, 'pv2d[I=1]', input_file, pv2di1 dg_data=create_struct(dg_data,'pv2di1',pv2di1) endif if keyword_set(theta2d) then begin getdata, 'theta2d[I=1]', input_file, theta2di1 dg_data=create_struct(dg_data,'theta2di1',theta2di1) endif if keyword_set(thv2d) then begin getdata, 'thv2d[I=1]', input_file, thv2di1 dg_data=create_struct(dg_data,'thv2di1',thv2di1) endif if keyword_set(lwpfld2d) then begin getdata, 'lwpfld2d[I=1]', input_file, lwpfld2di1 dg_data=create_struct(dg_data,'lwpfld2di1',lwpfld2di1) endif if keyword_set(iwpfld) then begin getdata, 'iwpfld', input_file, iwpfld dg_data=create_struct(dg_data,'iwpfld',iwpfld) endif ;LINE UNTESTED if keyword_set(swap_ends) then dg_data=swap_endian(dg_data) if keyword_set(about) then help,dg_data,/str if not keyword_set(no_stop) then stop ;stop end