pro lidinterp,filedate ;----------------------------------------------------------------- ;Procedure to load in saved raw lidar 5-second data, ; read in saved CLD 10-sec data, and then read in the microwave ; radiometer netCDF for the necessary times. ; Then interpolate all of the data to the same time axis and ; save the workspace. ;Output: ; ;I/O format: lidinterp, '042898' ; ;Matthew Shupe, 5-25-99 ;------------------------------------------------------------------ common com_all,time05,depol05,height,time10,base10,top10,idepol10,mtime,water,$ time60,depol60,depol10, top60,top05,base60,base05,idepol60,$ idepol05,water60,water05,water10,dep05,dep10,dep60 ;Restore the lidar and CLD files ;-------------------------------- cd,'d:/lidar/raw' rawarg=filedate+'.lidargates.dat' cldarg=filedate+'.CLD10sec.dat' rawfile=findfile(rawarg) cldfile=findfile(cldarg) restore,rawfile[0] time05=time depol05=depol restore,cldfile[0] time10=time idepol10=depol base10=base top10=top ;Determine which mwr days are necessary to grab ;---------------------------------------------- cd,'d:/shebaar/microwave/raw' mw1arg='*'+strmid(filedate,4,2)+strmid(filedate,0,4)+'*.cdf' mwfiles=findfile(mw1arg) mwnum=1 if (fix(max(time05)) ge 24) then begin da=strmid(mw1arg,5,2) newda=strtrim(string(fix(da)+1),2) if strlen((newda)) eq 1 then newda='0'+newda mw2arg=strmid(mw1arg,0,5)+newda+'*.cdf' mwfiles=[mwfiles,findfile(mw2arg)] mwnum=2 endif ;Now get the microwave data ;-------------------------- for i=1,mwnum do begin mwfid=ncdf_open(mwfiles[i-1]) ncdf_varget,mwfid,0,mwbase_time ;sec since 1970-01-01 00:00:00 ncdf_varget,mwfid,1,mwtime_off ;sec since base_time ;ncdf_varget,mwfid,4,mwvap ;Total water vapor (cm) ncdf_varget,mwfid,5,mwwat ;Total liquid water (cm) ncdf_close,mwfid ;Convert the time data into a time axis ;---------------------------------------- base_date=julday(1,1,1970,0,0,0) tbase=jul_to_dt(base_date) !dt_base=tbase starttime=sec_to_dt(mwbase_time) mwtime=starttime.hour+(starttime.minute*60+starttime.second + mwtime_off)/3600. if i eq 1 then mtime=mwtime & water=mwwat if i eq 2 then mtime=[mtime,mwtime+24.] & water=[water,mwwat] endfor nmt=n_elements(mtime) nw=n_elements(water) if (nmt gt nw) then mtime=mtime(0:nw-1) if (nw gt nmt) then water=water(0:nmt-1) cd,'d:/lidar/raw' ;Now interpolate all three data sets to the same time axes (5, 10, 60-sec) ;---------------------------------------------------------------------------- ;The axes (make time05 and time10 with same start and end times) ;--------------------------------------------------------------- t05max=max(time05,min=t05min) t10max=max(time10,min=t10min) if (t10max gt t05max) then begin iwhere=where((time10 le t05max) and (time10 gt t05max-10/3600.)) if iwhere[0] ne -1 then begin time10=time10[0:iwhere[0]] idepol10=idepol10[0:iwhere[0],*] base10=base10[0:iwhere[0],*] top10=top10[0:iwhere[0],*] endif endif else begin iwhere=where((time05 le t10max) and (time05 gt t10max-5/3600.)) if iwhere[0] ne -1 then begin time05=time05[0:iwhere[0]] depol05=depol05[0:iwhere[0],*] endif endelse if (t10min lt t05min) then begin iwhere=where((time10 ge t05min) and (time10 lt t05min+10/3600.)) if iwhere[0] ne -1 then begin n10=n_elements(time10) time10=time10[iwhere[0]:n10-1] idepol10=idepol10[iwhere[0]:n10-1,*] base10=base10[iwhere[0]:n10-1,*] top10=top10[iwhere[0]:n10-1,*] endif endif else begin iwhere=where((time05 ge t10min) and (time05 lt t10min+5/3600.)) if iwhere[0] ne -1 then begin n05=n_elements(time05) time05=time05[iwhere[0]:n05-1] depol05=depol05[iwhere[0]:n05-1,*] endif endelse intervals=floor((max(time05)-min(time05))/(60./3600.)) time60=findgen(intervals+1)*(60./3600.)+min(time05) len_60=n_elements(time60) len_05=n_elements(time05) len_10=n_elements(time10) ;Sometimes the time05 has gaps. Make time05 axis with constant time steps. ;Replaced many of the below len_05 with len_05ax time05ax=findgen(floor((max(time05)-min(time05))/(5./3600))+1)*(5./3600.)+min(time05) len_05ax=n_elements(time05ax) ;Interpolate the CLD data (idepol10,base10,top10) ;------------------------------------------------ print,'Interp lidar' dimcld=size(top,/dimensions) if n_elements(dimcld) eq 1 then dimcld=[dimcld,1] top05=fltarr(len_05,dimcld[1]) base05=top05 & idepol05=top05 top60=fltarr(len_60,dimcld[1]) base60=top60 & idepol60=top60 for j=0,dimcld[1]-1 do begin top05[*,j]=interpol(top10[*,j],time10,time05) base05[*,j]=interpol(base10[*,j],time10,time05) idepol05[*,j]=interpol(idepol10[*,j],time10,time05) top60[*,j]=interpol(top10[*,j],time10,time60) base60[*,j]=interpol(base10[*,j],time10,time60) idepol60[*,j]=interpol(idepol10[*,j],time10,time60) endfor ;Interpolate the raw lidar data (depol05) ;--------------------------------------- dimlid=n_elements(height) depol60=fltarr(len_60,dimlid) depol10=fltarr(len_10,dimlid) for j=0,dimlid-1 do begin depol60[*,j]=interpol(depol05[*,j],time05,time60) depol10[*,j]=interpol(depol05[*,j],time05,time10) endfor ;Interpolate the mwr data (water) ;--------------------------------- print,'Interp mwr' water05=interpol(water,mtime,time05ax) water60=interpol(water,mtime,time60) water10=interpol(water,mtime,time10) ;Now grab the good depol data (i.e. the data between cloud bounds) ;------------------------------------------------------------------ print,'Get Good Data....' dep05=fltarr(len_05,dimlid) dep10=fltarr(len_10,dimlid) dep60=fltarr(len_60,dimlid) for j=0,dimcld[1]-1 do begin for i=0,n_elements(time05)-1 do begin ib=where((height gt base05[i,j]-0.015) and (height le base05[i,j]+0.015)) it=where((height ge top05[i,j]-0.015) and (height lt top05[i,j]+0.015)) if (it[0] eq -1) or (ib[0] eq -1) then print,i,' column of dep05: top/base where = -1' if (it[0]-ib[0] gt 0) and (it[0] ne -1) and (ib[0] ne -1) then begin dep05[i,ib[0]:it[0]]=depol05[i,ib[0]:it[0]] endif endfor for i=0,n_elements(time10)-1 do begin ib=where((height gt base10[i,j]-0.015) and (height le base10[i,j]+0.015)) it=where((height ge top10[i,j]-0.015) and (height lt top10[i,j]+0.015)) if (it[0]-ib[0] gt 0) then dep10[i,ib[0]:it[0]]=depol10[i,ib[0]:it[0]] if (it[0] eq -1) or (ib[0] eq -1) then print,i,' column of dep10: where = -1' endfor for i=0,n_elements(time60)-1 do begin ib=where((height gt base60[i,j]-0.015) and (height le base60[i,j]+0.015)) it=where((height ge top60[i,j]-0.015) and (height lt top60[i,j]+0.015)) if (it[0]-ib[0] gt 0) then dep60[i,ib[0]:it[0]]=depol60[i,ib[0]:it[0]] if (it[0] eq -1) or (ib[0] eq -1) then print,i,' column of dep60: where = -1' endfor endfor save,height,time05,time05ax,time10,time60,dep05,dep10,dep60,water05,water10,water60,$ filename=filedate+'.fullinterp.dat' end ;proc