;Program to compare and combine the processed MWR data mkDAM=0 ;If set then make DAMOCLES files device,decomposed=0 dir1='/cruises/ASCOS_2008/ODEN/radiometer/mailbox/Processed' dir2='/cruises/ASCOS_2008/ODEN/radiometer/mailbox/Processed2' dir3='/cruises/ASCOS_2008/ODEN/radiometer/mailbox/Processed3' pdir='/cruises/ASCOS_2008/ODEN/radiometer/mailbox/testplots' if mkDAM then odir='/cruises/ASCOS_2008/ODEN/radiometer/mailbox/DAMOCLES' else odir='/cruises/ASCOS_2008/ODEN/radiometer/mailbox/Final' cd,dir1 files=findfile('*20080*.cdf',count=numf) files=files[2:*] ;take off the first two days numf=numf-2 ;plot parameters pos=[.1,.1,.95,.95] pos1=[pos[0],pos[1]+(pos[3]-pos[1])*3./4,pos[2],pos[1]+(pos[3]-pos[1])*4./4] pos2=[pos[0],pos[1]+(pos[3]-pos[1])*2./4,pos[2],pos[1]+(pos[3]-pos[1])*3./4] pos3=[pos[0],pos[1]+(pos[3]-pos[1])*1./4,pos[2],pos[1]+(pos[3]-pos[1])*2./4] pos4=[pos[0],pos[1]+(pos[3]-pos[1])*0./4,pos[2],pos[1]+(pos[3]-pos[1])*1./4] xra=[0,24.] loadct,41,file='/home/mshupe/IDLcode/colorscopy.tbl' blk=strarr(10)+' ' c1=1 c2=80 c3=250 c4=40 sdev1=0 & sdev2=0 & sdev3=0 grad1=0 & grad2=0 & grad3=0 for i=0,numf-1 do begin ;Get the day's data cd,dir1 print,files[i] fid=ncdf_open(files[i]) ncdf_varget,fid,'base_time',bt ncdf_varget,fid,'time_offset',to ncdf_varget,fid,'liquid',liq1 ncdf_varget,fid,'vapor',vap1 ncdf_varget,fid,'t_ref',tref1 ncdf_varget,fid,'vt_sky',vts1 ncdf_varget,fid,'vt_ref',vtr1 ncdf_varget,fid,'tb',tb1 ncdf_varget,fid,'tmr',tmr1 ncdf_varget,fid,'timeoffmid',timeom ncdf_varget,fid,'wet_window',wet_window ncdf_varget,fid,'lat',lat ncdf_varget,fid,'lon',lon ncdf_varget,fid,'alt',alt ncdf_varget,fid,'temperature',temperature ncdf_varget,fid,'rh',rh ncdf_varget,fid,'presure',pressure ncdf_varget,fid,'pitch',pitch ncdf_varget,fid,'roll',roll ncdf_varget,fid,'heading',heading ncdf_close,fid tm1=basetime_to_time(bt,to) ;Make correction for time (9 steps) if i lt numf-1 then begin fid=ncdf_open(files[i+1]) ncdf_varget,fid,'liquid',liq0 ncdf_varget,fid,'vapor',vap0 ncdf_varget,fid,'vt_sky',vts0 ncdf_varget,fid,'vt_ref',vtr0 ncdf_varget,fid,'tb',tb0 ncdf_varget,fid,'tmr',tmr0 ncdf_close,fid liq1=[liq1[9:*],liq0[0:8]] vap1=[vap1[9:*],vap0[0:8]] vts1=[[vts1[*,9:*]],[vts0[*,0:8]]] vtr1=[[vtr1[*,9:*]],[vtr0[*,0:8]]] tb1=[[tb1[*,9:*]],[tb0[*,0:8]]] tmr1=[[tmr1[*,9:*]],[tmr0[*,0:8]]] endif sd1=tm1*0 & gr1=sd1 for t=2,n_elements(tm1)-3 do begin sd1[t]=stddev(vap1[t-2:t+2]) gr1[t]=(2*vap1[t]-vap1[t-1]-vap1[t+1])^2.0 endfor if i eq 0 then begin sdev1=sd1 grad1=gr1 endif else begin sdev1=[sdev1,sd1] grad1=[grad1,gr1] endelse cd,dir2 fid=ncdf_open(files[i]) ncdf_varget,fid,'base_time',bt ncdf_varget,fid,'time_offset',to ncdf_varget,fid,'liquid',liq2 ncdf_varget,fid,'vapor',vap2 ncdf_varget,fid,'vt_sky',vts2 ncdf_varget,fid,'vt_ref',vtr2 ncdf_varget,fid,'tb',tb2 ncdf_varget,fid,'tmr',tmr2 ncdf_close,fid tm2=basetime_to_time(bt,to) sd2=tm2*0 & gr2=sd2 for t=2,n_elements(tm2)-3 do begin sd2[t]=stddev(vap2[t-2:t+2]) gr2[t]=(2*vap2[t]-vap2[t-1]-vap2[t+1])^2.0 endfor if i eq 0 then begin sdev2=sd2 grad2=gr2 endif else begin sdev2=[sdev2,sd2] grad2=[grad2,gr2] endelse ;Implement a spike filter on P2 data wh=where(vap2 gt 2 or gr2 lt 0.12 or sd2 lt 0.12,nm) fvap2=interpol(vap2[wh],tm2[wh],tm2) fliq2=interpol(liq2[wh],tm2[wh],tm2) cd,dir3 fid=ncdf_open(files[i]) ncdf_varget,fid,'base_time',bt ncdf_varget,fid,'time_offset',to ncdf_varget,fid,'liquid',liq3 ncdf_varget,fid,'vapor',vap3 ncdf_varget,fid,'vt_sky',vts3 ncdf_varget,fid,'vt_ref',vtr3 ncdf_varget,fid,'tb',tb3 ncdf_varget,fid,'tmr',tmr3 ncdf_close,fid tm3=basetime_to_time(bt,to) ;Make correction for time (1 step) if i lt numf-1 then begin fid=ncdf_open(files[i+1]) ncdf_varget,fid,'liquid',liq0 ncdf_varget,fid,'vapor',vap0 ncdf_varget,fid,'vt_sky',vts0 ncdf_varget,fid,'vt_ref',vtr0 ncdf_varget,fid,'tb',tb0 ncdf_varget,fid,'tmr',tmr0 ncdf_close,fid liq3=[liq3[1:*],liq0[0]] vap3=[vap3[1:*],vap0[0]] vts3=[[vts3[*,1:*]],[vts0[*,0]]] vtr3=[[vtr3[*,1:*]],[vtr0[*,0]]] tb3=[[tb3[*,1:*]],[tb0[*,0]]] tmr3=[[tmr3[*,1:*]],[tmr0[*,0]]] endif sd3=tm3*0 & gr3=sd3 for t=2,n_elements(tm3)-3 do begin sd3[t]=stddev(vap3[t-2:t+2]) gr3[t]=(2*vap3[t]-vap3[t-1]-vap3[t+1])^2.0 endfor if i eq 0 then begin sdev3=sd3 grad3=gr3 endif else begin sdev3=[sdev3,sd3] grad3=[grad3,gr3] endelse ;Plot the pertinent data cd,pdir dstr=strmid(files[i],15,8) tit='MWR Comp, '+dstr yra=[min([liq1,liq2,liq3]),max([liq1,liq2,liq3])<1000] plot,tm1,liq1,position=pos1,color=c1,xrange=xra,/xstyle,xtickname=blk,ytitle='LWP [g/m2]',$ title=tit,yrange=yra,/ystyle oplot,tm2,liq2,color=c2 oplot,tm3,liq3,color=c3 oplot,tm1,liq1,color=c1 yra=[min([vap1,vap2,vap3])>(-0.3),max([vap1,vap2,vap3])<5] plot,tm1,vap1,position=pos2,/noerase,color=c1,xrange=xra,/xstyle,xtickname=blk,ytitle='Vap [cm]',yrange=yra,/ystyle oplot,tm2,vap2,color=c2 oplot,tm3,vap3,color=c3 oplot,tm1,vap1,color=c1 plot,tm1,tb1[0,*],position=pos3,/noerase,color=c1,xrange=xra,/xstyle,xtickname=blk,ytitle='TB23 [K]' oplot,tm2,tb2[0,*],color=c2 oplot,tm3,tb3[0,*],color=c3 oplot,tm1,tb1[0,*],color=c1 plot,tm1,tb1[1,*],position=pos4,/noerase,color=c1,xrange=xra,/xstyle,xtitle='Time [hour UTC]',ytitle='TB30 [K]' oplot,tm2,tb2[1,*],color=c2 oplot,tm3,tb3[1,*],color=c3 oplot,tm1,tb1[1,*],color=c1 fname='mwrcomp.'+dstr+'.png' tvlct,r,g,b,/get write_png,fname,tvrd(/true),r,g,b tit='MWR Diag, '+dstr yra=[min(fliq2),max(fliq2)] plot,tm2,fliq2,position=pos1,color=c1,xrange=xra,/xstyle,xtickname=blk,ytitle='despike, LWP [g/m2]',$ title=tit,yrange=yra,/ystyle oplot,tm2,liq2,color=c2 oplot,tm2,fliq2,color=c1 yra=[min([vap1,vap2,vap3])>(-0.3),max([vap1,vap2,vap3])<5] plot,tm1,vap1,position=pos2,/noerase,color=c1,xrange=xra,/xstyle,xtickname=blk,ytitle='Vap [cm]',yrange=yra,/ystyle oplot,tm2,vap2,color=c2 oplot,tm3,vap3,color=c3 oplot,tm1,vap1,color=c1 yra=[0,0.5];max([sd1,sd2,sd3])] plot,tm1,sd1,position=pos3,/noerase,color=c1,xrange=xra,/xstyle,xtickname=blk,ytitle='Vap 5pt SDev',yrange=yra,/ystyle oplot,tm2,sd2,color=c2 oplot,tm3,sd3,color=c3 oplot,tm1,sd1,color=c1 yra=[0,0.5];max([gr1,gr2,gr3])] plot,tm1,gr1,position=pos4,/noerase,color=c1,xrange=xra,/xstyle,xtitle='Time [hour UTC]',ytitle='(2*V-V!d-!n-V!d+!n)!u2!n',yrange=yra,/ystyle oplot,tm2,gr2,color=c2 oplot,tm3,gr3,color=c3 oplot,tm1,gr1,color=c1 fname='mwrdiag.'+dstr+'.png' tvlct,r,g,b,/get write_png,fname,tvrd(/true),r,g,b ;Implement that combination based on manual determination. ;Default: Adjust P2 using running mean of P1 ;Whenever there is a jump between data sets add in a smoother if n_elements(tm1) ne n_elements(tm2) or n_elements(tm1) ne n_elements(tm2) or n_elements(tm1) ne n_elements(tm2) then begin print,'Number of times do not match' stop endif ;Make some offset corrections if needed sliq1=liq1 svap1=vap1 case dstr of '20080824': begin wh=where(tm1 ge 8.764 and tm1 le 8.952) sliq1[wh]=sliq1[wh]-60. svap1[wh]=svap1[wh]+0.1 wh=where(tm1 ge 9.57 and tm1 le 9.755) sliq1[wh]=sliq1[wh]-55. svap1[wh]=svap1[wh]+0.1 wh=where(tm1 ge 10.074 and tm1 le 10.214) sliq1[wh]=sliq1[wh]-40. svap1[wh]=svap1[wh]+0.08 end '20080825': begin wh=where(tm1 ge 16.59 and tm1 le 16.645) sliq1[wh]=sliq1[wh]-130. svap1[wh]=svap1[wh]+0.35 wh=where(tm1 ge 16.695 and tm1 le 24) sliq1[wh]=sliq1[wh]-60. svap1[wh]=svap1[wh]+0.11 wh=where(tm1 ge 22.14 and tm1 le 24) sliq1[wh]=sliq1[wh]-42. svap1[wh]=svap1[wh]+0.105 wh=where(tm1 ge 23.065 and tm1 le 24) sliq1[wh]=sliq1[wh]-53. svap1[wh]=svap1[wh]+0.13 ;Modify the background filtered P2 with P3 wh=where(tm1 ge 23.1 and tm1 le 24,nm) fliq2[wh]=liq3[wh] fvap2[wh]=vap3[wh] end '20080826': begin wh=where(tm1 ge 0 and tm1 le 0.439) sliq1[wh]=sliq1[wh]-53. svap1[wh]=svap1[wh]+0.13 wh=where(tm1 ge 0.442 and tm1 le 0.574) sliq1[wh]=sliq1[wh]-53. svap1[wh]=svap1[wh]+0.13 wh=where(tm1 ge 0.576 and tm1 le 0.605) sliq1[wh]=sliq1[wh]-53. svap1[wh]=svap1[wh]+0.13 wh=where(tm1 ge 0.77 and tm1 le 0.773) sliq1[wh]=sliq1[wh]-53. svap1[wh]=svap1[wh]+0.13 wh=where(tm1 ge 0.779 and tm1 le 1.995) sliq1[wh]=sliq1[wh]-53. svap1[wh]=svap1[wh]+0.13 wh=where(tm1 ge 0 and tm1 le 1.995) sliq1[wh]=sliq1[wh]-102. svap1[wh]=svap1[wh]+0.215 fliq2[wh]=liq3[wh] fvap2[wh]=vap3[wh] end else: endcase numt=n_elements(tm1) vapor=fltarr(numt) liquid=fltarr(numt) qc=intarr(numt)*0+1 ;(-1: no eval, 0: bad, 1: good) for t=0,numt-1 do begin ;Get averages for P1 and P2 (2-min or 8 pt, with 3 back and 4 front) ;Make correction to point ;Use de-spiked P2 av1=mean(sliq1[(t-3)>0:(t+4)<(numt-1)]) av2=mean(fliq2[(t-3)>0:(t+4)<(numt-1)]) liquid[t]=fliq2[t]-(av2-av1) av1=mean(svap1[(t-3)>0:(t+4)<(numt-1)]) av2=mean(fvap2[(t-3)>0:(t+4)<(numt-1)]) vapor[t]=fvap2[t]-(av2-av1) endfor ;Add in specific daily corrections case dstr of '20080809': begin wh=where(tm1 ge 7 and tm1 le 10.2,nm) liquid[wh]=fliq2[wh] vapor[wh]=fvap2[wh] end '20080811': begin wh=where(tm1 ge 2.58 and tm1 le 3.6,nm) offs=mean(fliq2[(wh[0]-8):(wh[0]-1)])-mean(sliq1[(wh[0]-8):(wh[0]-1)]) offe=mean(fliq2[(wh[nm-1]+1):(wh[nm-1]+8)])-mean(sliq1[(wh[nm-1]+1):(wh[nm-1]+8)]) off=findgen(nm)/(nm-1)*(offe-offs)+offs liquid[wh]=fliq2[wh]-off offs=mean(fvap2[(wh[0]-8):(wh[0]-1)])-mean(svap1[(wh[0]-8):(wh[0]-1)]) offe=mean(fvap2[(wh[nm-1]+1):(wh[nm-1]+8)])-mean(svap1[(wh[nm-1]+1):(wh[nm-1]+8)]) off=findgen(nm)/(nm-1)*(offe-offs)+offs vapor[wh]=fvap2[wh]-off end '20080814': begin wh=where((tm1 ge 12 and tm1 le 17) or (tm1 ge 21 and tm1 le 24),nm) liquid[wh]=fliq2[wh] vapor[wh]=fvap2[wh] end '20080815': begin wh=where(tm1 ge 0 and tm1 le 1.3,nm) liquid[wh]=fliq2[wh] vapor[wh]=fvap2[wh] end '20080822': begin wh=where(tm1 ge 6 and tm1 le 11.2,nm) liquid[wh]=fliq2[wh] vapor[wh]=fvap2[wh] end '20080823': begin wh=where(tm1 ge 23 and tm1 le 24,nm) qc[wh]=0 end '20080824': begin wh=where((tm1 ge 0 and tm1 le 4) or (tm1 ge 6 and tm1 le 6.5) or (tm1 ge 13.2 and tm1 le 13.6),nm) qc[wh]=0 end '20080825': begin wh=where(tm1 ge 13.6 and tm1 le 14.2,nm) liquid[wh]=fliq2[wh] vapor[wh]=fvap2[wh] wh=where(tm1 ge 16.6 and tm1 le 24,nm) qc[wh]=0 end '20080826': begin wh=where(tm1 ge 1.995 and tm1 le 24,nm) liquid[wh]=fliq2[wh] vapor[wh]=fvap2[wh] wh=where(tm1 ge 0 and tm1 le 9,nm) qc[wh]=0 end '20080827': begin wh=where((tm1 ge 0 and tm1 le 1.6) or (tm1 ge 22 and tm1 le 23.6),nm) liquid[wh]=fliq2[wh] vapor[wh]=fvap2[wh] end '20080828': begin wh=where(tm1 ge 1 and tm1 le 2.9,nm) liquid[wh]=fliq2[wh] vapor[wh]=fvap2[wh] ;****used P3***** wh=where(tm1 ge 2.9 and tm1 le 3.6,nm) liquid[wh]=liq3[wh] vapor[wh]=vap3[wh] end '20080829': begin ;****used P3**** wh=where(tm1 ge 23.6 and tm1 le 24,nm) liquid[wh]=liq3[wh] vapor[wh]=vap3[wh] end '20080830': begin wh=where(tm1 ge 0 and tm1 le 1,nm) liquid[wh]=fliq2[wh] vapor[wh]=fvap2[wh] ;****used P3**** wh=where(tm1 ge 1 and tm1 le 24,nm) liquid[wh]=liq3[wh] vapor[wh]=vap3[wh] end '20080902': begin wh=where(tm1 ge 8.3 and tm1 le 8.7,nm) liquid[wh]=fliq2[wh] vapor[wh]=fvap2[wh] qc[wh]=0 end '20080912': begin wh=where((tm1 ge 2.8 and tm1 le 3.5) or (tm1 ge 6 and tm1 le 7.2),nm) qc[wh]=0 end '20080913': begin wh=where((tm1 ge 4 and tm1 le 5) or (tm1 ge 5.5 and tm1 le 7.2) or (tm1 ge 12 and tm1 le 22.6),nm) qc[wh]=0 end '20080915': begin wh=where(tm1 ge 3.5 and tm1 le 4.0,nm) qc[wh]=0 end else: endcase liquid=smooth(liquid,3) vapor=smooth(vapor,3) ;Make output plot ;Plot the pertinent data cd,pdir dstr=strmid(files[i],15,8) tit='MWR Best, '+dstr yra=[min([liq1,liq2,liq3])>(-100),max([liq1,liq2,liq3])<600] plot,tm1,liq1,position=pos1,color=c1,xrange=xra,/xstyle,xtickname=blk,ytitle='LWP [g/m2]',$ title=tit,yrange=yra,/ystyle oplot,tm2,liq2,color=c2 oplot,tm3,liq3,color=c3 oplot,tm1,liquid,color=c4 oplot,tm1,liq1,color=c1 plots,[0,24],[0,0],color=c1,linestyle=1 plot,tm1,liq1-liquid,color=c1,position=pos2,/noerase,xrange=xra,/xstyle,xtickname=blk,ytitle='LWP-LWP!d1!n [g/m2]' yra=[min([vap1,vap2,vap3])>(-0.3),max([vap1,vap2,vap3])<5] plot,tm1,vap1,position=pos3,/noerase,color=c1,xrange=xra,/xstyle,xtickname=blk,ytitle='Vap [cm]',yrange=yra,/ystyle oplot,tm2,vap2,color=c2 oplot,tm3,vap3,color=c3 oplot,tm1,vapor,color=c4 oplot,tm1,vap1,color=c1 plot,tm1,vap1-vapor,position=pos4,/noerase,color=c1,xrange=xra,/xstyle,xtitle='Time [hour UTC]',ytitle='PWV-PWV!d1!n [cm]' fname='mwrbest.'+dstr+'.png' tvlct,r,g,b,/get write_png,fname,tvrd(/true),r,g,b ;Make output netCDf file cd,odir btstring=strmid(dstr,0,4)+'-'+strmid(dstr,4,2)+'-'+strmid(dstr,6,2)+', '+strmid(files[i],24,2)+':'+strmid(files[i],26,2)+':'+strmid(files[i],28,2)+' UTC' ;The Basetime string print,'WRITING: ',files[i] if mkDAM then outfile='ascos_'+strmid(files[i],3,27)+'.nc' else outfile=files[i] outfid=ncdf_create(outfile,/clobber) ;Define Dimensions ;---------------------------- fdid=ncdf_dimdef(outfid,'freqs',2) tdid=ncdf_dimdef(outfid,'time',/unlim) ;Define Global Attributes ;------------------------ ncdf_attput,outfid,/global,'date_created',systime(0) ncdf_attput,outfid,/global,'title','Dual-channel microwave radiometer measurements and retrievals.' ncdf_attput,outfid,/global,'abstract','This data set includes measurements from a ground-based, vertically-pointing, dual-channel (23 and 30-GHz) microwave radiometer system and retrievals from that system of the total cloud liquid water path and precipitable water vapor in the vertical atmospheric column.' ncdf_attput,outfid,/global,'topiccategory','ClimatologyMeteorologyAtmosphere' ncdf_attput,outfid,/global,'keywords','Atmospheric Cloud Observation Measurement Polar Precipitable Tropospheric Vapour' ncdf_attput,outfid,/global,'gcmd_keywords',' ' ncdf_attput,outfid,/global,'activity_type','Cruise, Ice station' ncdf_attput,outfid,/global,'Conventions','CF-1.0' ncdf_attput,outfid,/global,'product_name','mwrlosC1.b1' ncdf_attput,outfid,/global,'history','2009-08-20 creation' ncdf_attput,outfid,/global,'area','Arctic Ocean' ncdf_attput,outfid,/global,'southernmost_latitude','56.48' ncdf_attput,outfid,/global,'northernmost_latitude','87.49' ncdf_attput,outfid,/global,'westernmost_longitude','-11.08' ncdf_attput,outfid,/global,'easternmost_longitude','20.78' ncdf_attput,outfid,/global,'start_date','2008-08-03 00:00:00 UTC' ncdf_attput,outfid,/global,'stop_date','2008-09-17 06:00:00 UTC' ncdf_attput,outfid,/global,'institution','Stockholm University' ncdf_attput,outfid,/global,'PI_name','Matthew Shupe' ncdf_attput,outfid,/global,'contact','matthew.shupe@noaa.gov' ncdf_attput,outfid,/global,'distribution_statement','Free' ncdf_attput,outfid,/global,'project_name','Arctic Summer Cloud Ocean Study' ncdf_attput,outfid,/global,'site_id','asc' ncdf_attput,outfid,/global,'facility_id','Icebreaker ODEN during ASCOS cruise, Arctic Ocean' ncdf_attput,outfid,/global,'instrument','NOAA/ESRL/PSD3 Mailbox microwave radiometer' ncdf_attput,outfid,/global,'PI_affiliation','University of Colorado CIRES and NOAA ESRL' ncdf_attput,outfid,/global,'comment',"During this measurement campaign there was an intermittently faulty component in one of the radiometer's channels. Attempts have been made using various filters to minimize the impact of that problem. As a result, fine-scale variations at times less than about 2-3 minutes may not be realistic. Average results at timescales longer than 2-3 minutes are expected to be accurate to within typical microwave retrieval uncertainties." ncdf_attput,outfid,/global,'reference','Westwater, ER, Y Han, MD Shupe, SY Matrosov 2001: Analysis of integrated cloud liquid and precipitable water vapor retrievals from microwave radiometers during SHEBA. J. Geophys. Res., 106, 32019-32030.' ncdf_attput,outfid,/global,'support','This material is based upon work supported by the National Science Foundation under Grant No. ARC0732925.' ;Define Variables and attributes btid=ncdf_vardef(outfid,'base_time',/long) ncdf_attput,outfid,btid,'string',btstring ncdf_attput,outfid,btid,'long_name','Base Time in Epoch' ncdf_attput,outfid,btid,'units','seconds since 1970-1-1 0:00:00 0:00 UTC' if mkDAM then begin toid=ncdf_vardef(outfid,'time',[tdid],/double) ncdf_attput,outfid,toid,'long_name','time' ncdf_attput,outfid,toid,'standard_name','time' ncdf_attput,outfid,toid,'units','seconds since '+btstring ncdf_attput,outfid,toid,'axis','T' endif else begin toid=ncdf_vardef(outfid,'time_offset',[tdid],/double) ncdf_attput,outfid,toid,'long_name','Time offset from base_time' ncdf_attput,outfid,toid,'units','seconds since '+btstring endelse if not mkDAM then begin ttid=ncdf_vardef(outfid,'time',[tdid],/double) ncdf_attput,outfid,ttid,'long_name','Time offset from midnight' ncdf_attput,outfid,ttid,'units','seconds since '+strmid(btstring,0,11)+'00:00:00 UTC' endif wwid=ncdf_vardef(outfid,'wet_window',[tdid],/long) ncdf_attput,outfid,wwid,'long_name','moisture detector' ncdf_attput,outfid,wwid,'value','0 = off (dry), 1 = on (wet)' ncdf_attput,outfid,wwid,'units','none' if mkDAM then ltid=ncdf_vardef(outfid,'latitude',[tdid],/float) else ltid=ncdf_vardef(outfid,'lat',[tdid],/float) ncdf_attput,outfid,ltid,'long_name','latitude' ncdf_attput,outfid,ltid,'standard_name','latitude' ncdf_attput,outfid,ltid,'units','degree_north' if mkDAM then lnid=ncdf_vardef(outfid,'longitude',[tdid],/float) else lnid=ncdf_vardef(outfid,'lon',[tdid],/float) ncdf_attput,outfid,lnid,'long_name','longitude' ncdf_attput,outfid,lnid,'standard_name','longitude' ncdf_attput,outfid,lnid,'units','degree_east' ptid=ncdf_vardef(outfid,'pitch',[tdid],/float) ncdf_attput,outfid,ptid,'long_name','pitch' ncdf_attput,outfid,ptid,'units','degrees' rlid=ncdf_vardef(outfid,'roll',[tdid],/float) ncdf_attput,outfid,rlid,'long_name','roll' ncdf_attput,outfid,rlid,'units','degrees' alid=ncdf_vardef(outfid,'alt',[tdid],/float) ncdf_attput,outfid,alid,'long_name','altitude' ncdf_attput,outfid,alid,'units','m MSL' hdid=ncdf_vardef(outfid,'heading',[tdid],/float) ncdf_attput,outfid,hdid,'long_name','heading' ncdf_attput,outfid,hdid,'units','degrees_N' prid=ncdf_vardef(outfid,'pressure',[tdid],/float) ncdf_attput,outfid,prid,'long_name','pressure' ncdf_attput,outfid,prid,'units','mBars' rhid=ncdf_vardef(outfid,'rh',[tdid],/float) ncdf_attput,outfid,rhid,'long_name','relative humidity' ncdf_attput,outfid,rhid,'units','%' tpid=ncdf_vardef(outfid,'temperature',[tdid],/float) ncdf_attput,outfid,tpid,'long_name','temperature' ncdf_attput,outfid,tpid,'units','degrees C' trid=ncdf_vardef(outfid,'t_ref',[fdid,tdid],/float) ncdf_attput,outfid,trid,'long_name','reference load temperature' ncdf_attput,outfid,trid,'units','K' vsid=ncdf_vardef(outfid,'vt_sky',[fdid,tdid],/float) ncdf_attput,outfid,vsid,'long_name','sky voltage' ncdf_attput,outfid,vsid,'units','volts' vrid=ncdf_vardef(outfid,'vt_ref',[fdid,tdid],/float) ncdf_attput,outfid,vrid,'long_name','reference voltage' ncdf_attput,outfid,vrid,'units','volts' tbid=ncdf_vardef(outfid,'tb',[fdid,tdid],/float) ncdf_attput,outfid,tbid,'long_name','brightness temperature' ncdf_attput,outfid,tbid,'units','K' tmid=ncdf_vardef(outfid,'tmr',[fdid,tdid],/float) ncdf_attput,outfid,tmid,'long_name','mean radiating tmeperature' ncdf_attput,outfid,tmid,'units','K' lqid=ncdf_vardef(outfid,'liquid',[tdid],/float) ncdf_attput,outfid,lqid,'long_name','Total liquid water path along line-of-site path' ncdf_attput,outfid,lqid,'units','g/m2' vpid=ncdf_vardef(outfid,'vapor',[tdid],/float) ncdf_attput,outfid,vpid,'long_name','Total precipitable water vapor along line-of-site path' ncdf_attput,outfid,vpid,'units','cm' qcid=ncdf_vardef(outfid,'qc',[tdid],/long) ncdf_attput,outfid,qcid,'long_name','Quality control flag for liquid and vapor' ncdf_attput,outfid,qcid,'units','none' ncdf_attput,outfid,qcid,'value','-1: no evaluation. 0: questionable data. 1: data expected to be good.' ;Close define mode and enter data mode ncdf_control,outfid,/fill ncdf_control,outfid,/endef ;Assign data to variables ncdf_varput,outfid,btid,bt ncdf_varput,outfid,toid,to if not mkDAM then ncdf_varput,outfid,ttid,timeom ncdf_varput,outfid,wwid,wet_window ncdf_varput,outfid,ltid,lat ncdf_varput,outfid,lnid,lon ncdf_varput,outfid,ptid,pitch ncdf_varput,outfid,rlid,roll ncdf_varput,outfid,alid,alt ncdf_varput,outfid,hdid,heading ncdf_varput,outfid,prid,pressure ncdf_varput,outfid,rhid,rh ncdf_varput,outfid,tpid,temperature ncdf_varput,outfid,trid,tref1 ncdf_varput,outfid,vsid,vts1 ncdf_varput,outfid,vrid,vtr1 ncdf_varput,outfid,tbid,tb1 ncdf_varput,outfid,tmid,tmr1 ncdf_varput,outfid,lqid,liquid ncdf_varput,outfid,vpid,vapor ncdf_varput,outfid,qcid,qc ;Close the netCDF file ncdf_close,outfid endfor end