pro readceil,arg,ctime,cbasebest,CJTIME=cjtime,NO_NAN=no_nan,FILE=file,PLATFORM=platform ;---------------------------------------------------------------------- ;Title: readceil.pro ; ;Purpose: Read the NSA ceilometer netCDF files. ; ;Input: arg: a string filename argument for the desired file to read. ; ;Output: ctime: time [decimal hours] ; cbasebest: Ceilometer best estimated lowest cloud base height [km] ; ;Keywords: cjtime: optional variable for outputed decimal Julian day time ; nonan: if set then -999 is used as flag for no cloud base in cbasebest vector. ; file: set to an exact filename if only one file is to be read. ; platform: string variable containing the platform (i.e. nsavceil25kC1.a1) ; ; ;I/O format: readmwr,farg,ctime,cbase,CJ TIME=cjtime ; ;Author: Matthew Shupe ;Date: 3/06/00 ;Modified: 2/3/01 ;---------------------------------------------------------------------- base_date=julday(1,1,1970,0,0,0) base=jul_to_dt(base_date) !dt_base=base if not(keyword_set(FILE)) then begin farg='nsavceil*'+arg+'*.cdf*' file=findfile(farg,count=nfil) endif else nfil=1 if nfil eq 0 then begin ctime=-1 platform='' return endif platform=strmid(file[0],0,strpos(file[0],'.2')) for i=0,nfil-1 do begin fid=ncdf_open(file[i]) ncdf_varget,fid,ncdf_varid(fid,'base_time'),base_time ncdf_varget,fid,ncdf_varid(fid,'time_offset'),time_offset ncdf_varget,fid,ncdf_varid(fid,'first_cbh'),cb1 ncdf_varget,fid,ncdf_varid(fid,'second_cbh'),cb2 ncdf_varget,fid,ncdf_varid(fid,'third_cbh'),cb3 ncdf_varget,fid,ncdf_varid(fid,'vertical_visibility'),vv ncdf_varget,fid,ncdf_varid(fid,'detection_status'),ds ncdf_varget,fid,ncdf_varid(fid,'alt_highest_signal'),hs ncdf_close,fid ;Create the time axis starttime=sec_to_dt(base_time) mt=float(starttime.hour+(starttime.minute + (starttime.second+time_offset)/60.)/60.) mjt=float(floor(starttime.julian-julday(1,1,starttime.year,0,0,0)+1))+mt/24. if n_elements(where(mt gt 24.0)) gt n_elements(mt)/2 then mt=mt-24. if i eq 0 then begin cbase1=cb1 cbase2=cb2 cbase3=cb3 vertv=vv status=ds highsig=hs ctime=mt cjtime=mjt endif else begin cbase1=[cbase1,cb1] cbase2=[cbase3,cb2] cbase3=[cbase2,cb3] vertv=[vertv,vv] status=[status,ds] highsig=[highsig,hs] ctime=[ctime,mt] cjtime=[cjtime,mjt] endelse endfor ;Calculate the best estimated lowest cloud base height cbasebest=cbase1*0-999.0 iwh=where(status ge 1 and status le 3,num) if num gt 0 then cbasebest[iwh]=cbase1[iwh]/1000. iwh=where(status eq 4,num) if num gt 0 then cbasebest[iwh]=vertv[iwh]/1000. if not(keyword_set(NO_NAN)) then begin iwh=where(cbasebest eq -999,num) if num gt 0 then cbasebest[iwh]= !values.f_nan endif end