pro readmask,arg,NODATA=nodata,CUT=cut,NO_NAN=no_nan,AVERAGE=average ;-------------------------------------------------------------------- ;Title: readmask.pro ;Purpose: Procedure to load mask output file outputed from the MCRS. ; ;Inputs: arg - date for the file in "YYYYMMDD" or "YYYYMMDD.HH" ; ;Outputs: time - time in decimal hours ; jtime - julian time axis ; height - heights (km) ; dbz - reflectivity (dbz) ; dopp - velocity (m/s) ; bheight - cloud base heights (km) ; theight - cloud top heights (km) ; spwd - spectral width (m/s) ; stn - signal to noise ratio (dbz) ; origmask - the retrieval mask entered by the user initially ; retmask - the retrieval mask that was used in a retrieval ; ;Keywords: nodata - returns 0 if data present and 1 if no data ; cut - Allows for cutting the data down by the factor given. ; Takes every "cut"th element. ; no_nan - if set then cloud boundaries with value 0 are left alone, ; otherwise they are set to NaN. ; average - set to the width (in seconds) over which to average the data ; ;I/O Format: readmask,'20000118' ; ;Author: Matthew Shupe ;Date: 2/11/99 ;Modified: 3/8/01 Turned into readmask from readradar ;------------------------------------------------------------------------- ;------------------------------------------------------------------------- ;Declare common block variables ;------------------------------- common com_direct common com_platforms common com_const common com_radar,time,jtime,height,dbz,dopp,spwd,stn,bheight,theight common com_mask,mask,certmask,origmask ;Create the filename arguement and find the day's files ;--------------------------------------- marg='shbmcrs1shupemask*'+arg+'*.cdf' cd,maskdir,current=orig_dir rfile=findfile(marg[0],count=nfil) radarplat='shbmmcr60sec' if nfil gt 0 then nodata=0 else begin print,'No file named ',marg nodata=1 return endelse print,'Loading '+rfile[0] ;Load netCDF data ;-------------------- fid = ncdf_open(rfile[0]) ncdf_varget,fid,ncdf_varid(fid,'time'),time ncdf_varget,fid,ncdf_varid(fid,'height'),height ncdf_varget,fid,ncdf_varid(fid,'reflectivity'),dbz ncdf_varget,fid,ncdf_varid(fid,'velocity'),dopp ncdf_varget,fid,ncdf_varid(fid,'spectralwidth'),spwd ncdf_varget,fid,ncdf_varid(fid,'signaltonoise'),stn ncdf_varget,fid,ncdf_varid(fid,'baseheight'),bheight ncdf_varget,fid,ncdf_varid(fid,'topheight'),theight ncdf_varget,fid,ncdf_varid(fid,'origmask'),origmask ncdf_varget,fid,ncdf_varid(fid,'retmask'),mask ncdf_close,fid certmask=mask*0 ;Create a julian time axis ;---------------------------- jtime=(julday(strmid(arg,4,2),strmid(arg,6,2),strmid(arg,0,4),0,0,0)-julday(1,1,strmid(arg,0,4),0,0,0)+1.0)+time/24. ;Cut the time frequency down if keyword is set ;--------------------------------- if keyword_set(cut) then begin iwh=indgen(floor(n_elements(time)/float(cut)))*fix(cut) jtime=jtime[iwh] time=time[iwh] dbz=dbz[iwh,*] dopp=dopp[iwh,*] spwd=spwd[iwh,*] stn=stn[iwh,*] bheight=bheight[iwh,*] theight=theight[iwh,*] mask=mask[iwh,*] origmask=origmask[iwh,*] certmask=certmask[iwh,*] endif if keyword_set(AVERAGE) then print,'no average available' if keyword_set(NO_NAN) then begin iwh=where(finite(bheight) ne 1) bheight[iwh]=0 theight[iwh]=0 endif cd,orig_dir end