;Title: acse_ingest_mwr ;Purpose: Read Radiometrics MWR brightness temperature and retrieval files ; ;Inputs: sarg: date/time string, YYYYMMDD ; earg: data/time string, YYYYMMDD ;Outputs: ;Keywords: directory: directory containing data ; ;I/O: ;Author: Matthew Shupe ;Date: 7/15/08, Adapted 7/8/14 ;--------------------------------------------------- pro acse_ingest_mwr,sarg,earg in_dir='/psd3data/cruises/ACSE_2014/ODEN/mwr' out_dir='/psd3data/cruises/ACSE_2014/ODEN/mwr/ingested' ;Set up time reference base_date=julday(1,1,1970,0,0,0) base=jul_to_dt(base_date) !dt_base=base ;Determine the files to open if strmid(sarg,6,2) ne strmid(earg,6,2) then begin sjd=julday(strmid(sarg,4,2),strmid(sarg,6,2),strmid(sarg,0,4)) ejd=julday(strmid(earg,4,2),strmid(earg,6,2),strmid(earg,0,4)) numa=ejd-sjd+1 farg=strarr(numa) darg=strarr(numa) for i=0,numa-1 do begin caldat,sjd+i,mo,da,yr if mo lt 10 then mo='0'+strtrim(mo,2) else mo=strtrim(mo,2) if da lt 10 then da='0'+strtrim(da,2) else da=strtrim(da,2) yr=strtrim(yr,2) farg[i]=yr+'-'+mo+'-'+da darg[i]=yr+mo+da endfor endif else begin farg=strmid(sarg,0,4)+'-'+strmid(sarg,4,2)+'-'+strmid(sarg,6,2) darg=sarg numa=n_elements(darg) endelse ;Loop over all daily arguments for d=0,numa-1 do begin ;Initialize arrays st1=strarr(28) st2=strarr(62) st3=strarr(5) st4=strarr(6) jnk=' ' f1=0.0 & f2=0.0 & f3=0.0 & f4=0.0 & f5=0.0 & f6=0.0 & f7=0.0 & f8=0.0 & f9=0.0 time=fltarr(10000*numa)*0-999. t22p234=time & t22p500=time & t23p034=time & t23p834=time & t25p000=time & t26p234=time t28p000=time & t30p000=time & t51p248=time & t51p760=time & t52p280=time & t52p804=time t53p336=time & t53p848=time & t54p400=time & t54p940=time & t55p500=time & t56p020=time t56p660=time & t57p228=time & t57p964=time & t58p800=time timep=fltarr(10000*numa) lwp=fltarr(10000*numa) pwv=lwp & cbase=lwp & tamb=lwp & rh=lwp & pres=lwp & tir=lwp & rain=lwp tprof=fltarr(10000*numa,58) qprof=fltarr(10000*numa,58) height=[0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.6,0.7,0.8,0.9,1,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2,2.25,2.5,2.75,3,3.25,3.5,3.75,4,4.25,4.5,4.75,5,5.25,5.5,5.75,6,6.25,6.5,6.75,7,7.25,7.5,7.75,8,8.25,8.5,8.75,9,9.25,9.5,9.75,10] ind=0 indp=0 cd,in_dir ;read the TB data ;Get the list of files for the daily argument arg=farg[d]+'*lv1.csv' file=findfile(arg,count=numf) ;Loop over all files in the day for f=0,numf-1 do begin print,'Reading ',file[f] openr,lun,/get_lun,file[f] for i=0,3 do readf,lun,jnk ;scrap the header while not eof(lun) do begin readf,lun,jnk ;51 st1=strsplit(jnk,',',/extract) st4=strsplit(st1[1],'/ :',/extract) time[ind]=float(st4[3])+float(st4[4])/60.+float(st4[5])/3600. t22p234[ind]=float(st1[6]) & t22p500[ind]=float(st1[7]) & t23p034[ind]=float(st1[8]) t23p834[ind]=float(st1[9]) & t25p000[ind]=float(st1[10]) & t26p234[ind]=float(st1[11]) t28p000[ind]=float(st1[12]) & t30p000[ind]=float(st1[13]) & t51p248[ind]=float(st1[14]) t51p760[ind]=float(st1[15]) & t52p280[ind]=float(st1[16]) & t52p804[ind]=float(st1[17]) t53p336[ind]=float(st1[18]) & t53p848[ind]=float(st1[19]) & t54p400[ind]=float(st1[20]) t54p940[ind]=float(st1[21]) & t55p500[ind]=float(st1[22]) & t56p020[ind]=float(st1[23]) t56p660[ind]=float(st1[24]) & t57p228[ind]=float(st1[25]) & t57p964[ind]=float(st1[26]) & t58p800[ind]=float(st1[27]) if not eof(lun) then readf,lun,jnk ;41 ind=ind+1 endwhile free_lun,lun endfor ;Now read the retrieved data ;Get the list of files for the daily argument arg=farg[d]+'*lv2.csv' file=findfile(arg,count=numf) file=file[sort(long(strmid(file,11,2)+strmid(file,14,2)))] ;Loop over all files in the day for f=0,numf-1 do begin print,'Reading ',file[f] openr,lun,/get_lun,file[f] for i=0,22 do readf,lun,jnk ;scrap the header while not eof(lun) do begin readf,lun,jnk ;201 st1=strsplit(jnk,',',/extract) st4=strsplit(st1[1],'/ :',/extract) timep[indp]=float(st4[3])+float(st4[4])/60.+float(st4[5])/3600.+d*24.0 tamb[indp]=float(st1[3]) rh[indp]=float(st1[4]) pres[indp]=float(st1[5]) tir[indp]=float(st1[6]) rain[indp]=float(st1[7]) if not eof(lun) then begin readf,lun,jnk ;401-T st2=strsplit(jnk,',',/extract) tprof[indp,*]=st2[4:*] endif if not eof(lun) then begin readf,lun,jnk ;402-q st2=strsplit(jnk,',',/extract) qprof[indp,*]=st2[4:*] endif if not eof(lun) then readf,lun,jnk ;403-lwc if not eof(lun) then readf,lun,jnk ;404-RH if not eof(lun) then begin readf,lun,jnk ;301 st3=strsplit(jnk,',',/extract) pwv[indp]=float(st3[3]) lwp[indp]=float(st3[4]) cbase[indp]=float(st3[5]) endif indp=indp+1 endwhile free_lun,lun endfor if numf gt 0 then begin ;Trim to length timep=timep[0:indp-1] pwv=pwv[0:indp-1] ;cm lwp=lwp[0:indp-1]*1000. ;in g/m2 tamb=tamb[0:indp-1] ;K rh=rh[0:indp-1] ;% pres=pres[0:indp-1] ;mb tir=tir[0:indp-1] ;K rain=rain[0:indp-1] ; cbase=cbase[0:indp-1] ;km tprof=tprof[0:indp-1,*] ;K qprof=qprof[0:indp-1,*] ;g/m3 time=time[0:ind-1] t22p234=t22p234[0:ind-1] & t22p500=t22p500[0:ind-1] & t23p034=t23p034[0:ind-1] & t23p834=t23p834[0:ind-1] t25p000=t25p000[0:ind-1] & t26p234=t26p234[0:ind-1] & t28p000=t28p000[0:ind-1] & t30p000=t30p000[0:ind-1] t51p248=t51p248[0:ind-1] & t51p760=t51p760[0:ind-1] & t52p280=t52p280[0:ind-1] & t52p804=t52p804[0:ind-1] t53p336=t53p336[0:ind-1] & t53p848=t53p848[0:ind-1] & t54p400=t54p400[0:ind-1] & t54p940=t54p940[0:ind-1] t55p500=t55p500[0:ind-1] & t56p020=t56p020[0:ind-1] & t56p660=t56p660[0:ind-1] & t57p228=t57p228[0:ind-1] t57p964=t57p964[0:ind-1] & t58p800=t58p800[0:ind-1] ;Now combine the data into the same time axis pwv=interpol(pwv,timep,time) lwp=interpol(lwp,timep,time) tamb=interpol(tamb,timep,time) rh=interpol(rh,timep,time) pres=interpol(pres,timep,time) tir=interpol(tir,timep,time) rain=interpol(rain,timep,time) cbase=interpol(cbase,timep,time) nh=n_elements(tprof[0,*]) tprof2=fltarr(ind,nh) qprof2=fltarr(ind,nh) for h=0,nh-1 do begin tprof2[*,h]=interpol(tprof[*,h],timep,time) qprof2[*,h]=interpol(qprof[*,h],timep,time) endfor tprof2=transpose(tprof2) qprof2=transpose(qprof2) ;make other fields that are needed ;compute base_time and time_offset sec=dt_to_sec( str_to_dt( strmid(darg[d],4,2)+'/'+strmid(darg[d],6,2)+'/'+strmid(darg[d],0,4) ) ) base_time=sec+fix(time[0]*3600) time_offset=long((time-time[0])*3600) ;***Could read in some of these from other sources elev=time*0+90 ;nominally vertically pointing lat=time*0-999. lon=time*0-999. pitch=time*0-999. roll=time*0-999. alt=time*0-999. heading=time*0-999. tref=fltarr(8,ind)*0-999. vts=fltarr(8,ind)*0-999. vtr=fltarr(8,ind)*0-999. tmrr=fltarr(8,ind)*0-999. qc=fix(time)*0-1 tref1=fltarr(14,ind)*0-999. vts1=fltarr(14,ind)*0-999. vtr1=fltarr(14,ind)*0-999. tmr1=fltarr(14,ind)*0-999. tb1=transpose([[t51p248],[t51p760],[t52p280],[t52p804],[t53p336],[t53p848],[t54p400],[t54p940],[t55p500],$ [t56p020],[t56p660],[t57p228],[t57p964],[t58p800]]) ;Write daily output file for MWRLOS cd,out_dir jk=fix(time[0]) if jk lt 10 then hh='0'+strtrim(jk,2) else hh=strtrim(jk,2) jk=(time[0] mod 1)*60 jk1=fix(jk) if jk1 lt 10 then mm='0'+strtrim(jk1,2) else mm=strtrim(jk1,2) jk=fix((jk mod 1)*60) if jk lt 10 then ss='0'+strtrim(jk,2) else ss=strtrim(jk,2) btstring=strmid(darg[d],0,4)+'-'+strmid(darg[d],4,2)+'-'+strmid(darg[d],6,2)+', '+hh+':'+mm+':'+ss+' UTC' ;The Basetime string outfile='acsmwrlosC1.b1.'+darg[d]+'.'+hh+mm+ss+'.cdf' print,'Writing ',outfile outfid=ncdf_create(outfile,/clobber) ;Define Dimensions ;---------------------------- tdid=ncdf_dimdef(outfid,'time',/unlim) fdid=ncdf_dimdef(outfid,'freqs',8) ;Define Global Attributes ;------------------------ ncdf_attput,outfid,/global,'date_created',systime(0) ncdf_attput,outfid,/global,'title','Multi-channel microwave radiometer measurements and retrievals.' ncdf_attput,outfid,/global,'abstract','This data set includes measurements from a ground-based, vertically-pointing, multi-channel (22 to 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,'keywords','Atmospheric Cloud Observation Measurement Polar Precipitable Tropospheric Vapour' 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,'area','Arctic Ocean' ncdf_attput,outfid,/global,'PI_name','Matthew Shupe' ncdf_attput,outfid,/global,'contact','matthew.shupe@noaa.gov' ncdf_attput,outfid,/global,'project_name','Arctic Clouds in Summer Experiment (ACSE / SWERUS-C3)' ncdf_attput,outfid,/global,'site_id','acs' ncdf_attput,outfid,/global,'facility_id','Icebreaker ODEN during ACSE 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' ;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' 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 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' 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' 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' 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' evid=ncdf_vardef(outfid,'elevation',[tdid],/float) ncdf_attput,outfid,evid,'long_name','elevation angle' ncdf_attput,outfid,evid,'units','degrees' 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' tmid=ncdf_vardef(outfid,'tmr',[fdid,tdid],/float) ncdf_attput,outfid,tmid,'long_name','mean radiating tmeperature' ncdf_attput,outfid,tmid,'units','K' t222id=ncdf_vardef(outfid,'tbsky222',[tdid],/float) ncdf_attput,outfid,t222id,'long_name','brightness temperature at 22.234 GHz' ncdf_attput,outfid,t222id,'units','K' t225id=ncdf_vardef(outfid,'tbsky225',[tdid],/float) ncdf_attput,outfid,t225id,'long_name','brightness temperature at 22.500 GHz' ncdf_attput,outfid,t225id,'units','K' t230id=ncdf_vardef(outfid,'tbsky230',[tdid],/float) ncdf_attput,outfid,t230id,'long_name','brightness temperature at 23.034 GHz' ncdf_attput,outfid,t230id,'units','K' t238id=ncdf_vardef(outfid,'tbsky238',[tdid],/float) ncdf_attput,outfid,t238id,'long_name','brightness temperature at 23.834 GHz' ncdf_attput,outfid,t238id,'units','K' t250id=ncdf_vardef(outfid,'tbsky250',[tdid],/float) ncdf_attput,outfid,t250id,'long_name','brightness temperature at 25.000 GHz' ncdf_attput,outfid,t250id,'units','K' t262id=ncdf_vardef(outfid,'tbsky262',[tdid],/float) ncdf_attput,outfid,t262id,'long_name','brightness temperature at 26.234 GHz' ncdf_attput,outfid,t262id,'units','K' t280id=ncdf_vardef(outfid,'tbsky280',[tdid],/float) ncdf_attput,outfid,t280id,'long_name','brightness temperature at 28.000 GHz' ncdf_attput,outfid,t280id,'units','K' t300id=ncdf_vardef(outfid,'tbsky300',[tdid],/float) ncdf_attput,outfid,t300id,'long_name','brightness temperature at 30.000 GHz' ncdf_attput,outfid,t300id,'units','K' lqid=ncdf_vardef(outfid,'lwp',[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,'pwv',[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,base_time ncdf_varput,outfid,toid,time_offset ncdf_varput,outfid,ttid,time ncdf_varput,outfid,wwid,rain ncdf_varput,outfid,ltid,lat ncdf_varput,outfid,lnid,lon ncdf_varput,outfid,evid,elev ncdf_varput,outfid,ptid,pitch ncdf_varput,outfid,rlid,roll ncdf_varput,outfid,alid,alt ncdf_varput,outfid,hdid,heading ncdf_varput,outfid,prid,pres ncdf_varput,outfid,rhid,rh ncdf_varput,outfid,tpid,tamb ncdf_varput,outfid,trid,tref ncdf_varput,outfid,vsid,vts ncdf_varput,outfid,vrid,vtr ncdf_varput,outfid,tmid,tmrr ncdf_varput,outfid,t222id,t22p234 ncdf_varput,outfid,t225id,t22p500 ncdf_varput,outfid,t230id,t23p034 ncdf_varput,outfid,t238id,t23p834 ncdf_varput,outfid,t250id,t25p000 ncdf_varput,outfid,t262id,t26p234 ncdf_varput,outfid,t280id,t28p000 ncdf_varput,outfid,t300id,t30p000 ncdf_varput,outfid,lqid,lwp ncdf_varput,outfid,vpid,pwv ncdf_varput,outfid,qcid,qc ;Close the netCDF file ncdf_close,outfid ;Write daily output file for Profiles outfile='acsmwrprofC1.b1.'+darg[d]+'.'+hh+mm+ss+'.cdf' print,'Writing ',outfile outfid=ncdf_create(outfile,/clobber) ;Define Dimensions ;---------------------------- fdid=ncdf_dimdef(outfid,'freqs',14) tdid=ncdf_dimdef(outfid,'time',/unlim) hdid=ncdf_dimdef(outfid,'height',nh) ;Define Global Attributes ;------------------------ ncdf_attput,outfid,/global,'date_created',systime(0) ncdf_attput,outfid,/global,'title','Multi-channel microwave radiometer measurements and retrievals.' ncdf_attput,outfid,/global,'abstract','This data set includes measurements from a ground-based, vertically-pointing, multi-channel (51 to 58-GHz) microwave radiometer system and retrievals from that system of the vertical atmospheric profiles of T and q.' ncdf_attput,outfid,/global,'keywords','Atmospheric Cloud Observation Measurement Polar Precipitable Tropospheric Vapour' ncdf_attput,outfid,/global,'activity_type','Cruise, Ice station' ncdf_attput,outfid,/global,'Conventions','CF-1.0' ncdf_attput,outfid,/global,'product_name','mwrprofC1.b1' ncdf_attput,outfid,/global,'area','Arctic Ocean' ncdf_attput,outfid,/global,'PI_name','Matthew Shupe' ncdf_attput,outfid,/global,'contact','matthew.shupe@noaa.gov' ncdf_attput,outfid,/global,'project_name','Arctic Clouds in Summer Experiment (ACSE / SWERUS-C3)' ncdf_attput,outfid,/global,'site_id','acs' ncdf_attput,outfid,/global,'facility_id','Icebreaker ODEN during ACSE 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' ;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' 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 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' 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' 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' 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' evid=ncdf_vardef(outfid,'elevation',[tdid],/float) ncdf_attput,outfid,evid,'long_name','elevation angle' ncdf_attput,outfid,evid,'units','degrees' 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' hgid=ncdf_vardef(outfid,'heading',[tdid],/float) ncdf_attput,outfid,hgid,'long_name','heading' ncdf_attput,outfid,hgid,'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','%' taid=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' htid=ncdf_vardef(outfid,'height',[hdid],/float) ncdf_attput,outfid,htid,'long_name','Height for vertical profiles' ncdf_attput,outfid,htid,'units','km' tpid=ncdf_vardef(outfid,'Tprof',[hdid,tdid],/float) ncdf_attput,outfid,tpid,'long_name','Temperature profiles' ncdf_attput,outfid,tpid,'units','K' qpid=ncdf_vardef(outfid,'qprof',[hdid,tdid],/float) ncdf_attput,outfid,qpid,'long_name','Specific humidity profiles' ncdf_attput,outfid,qpid,'units','g/m3' qcid=ncdf_vardef(outfid,'qc',[tdid],/long) ncdf_attput,outfid,qcid,'long_name','Quality control flag for profile retrievals' 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,base_time ncdf_varput,outfid,toid,time_offset ncdf_varput,outfid,ttid,time ncdf_varput,outfid,wwid,rain ncdf_varput,outfid,ltid,lat ncdf_varput,outfid,lnid,lon ncdf_varput,outfid,evid,elev ncdf_varput,outfid,ptid,pitch ncdf_varput,outfid,rlid,roll ncdf_varput,outfid,alid,alt ncdf_varput,outfid,hgid,heading ncdf_varput,outfid,prid,pres ncdf_varput,outfid,rhid,rh ncdf_varput,outfid,taid,tamb ncdf_varput,outfid,trid,tref1 ncdf_varput,outfid,vsid,vts1 ncdf_varput,outfid,vrid,vtr1 ncdf_varput,outfid,tmid,tmr1 ncdf_varput,outfid,tbid,tb1 ncdf_varput,outfid,htid,height ncdf_varput,outfid,tpid,tprof2 ncdf_varput,outfid,qpid,qprof2 ncdf_varput,outfid,qcid,qc ;Close the netCDF file ncdf_close,outfid endif endfor ;day end