;---------------------------------------------------------------------- ;Title: readaeri.pro ; ;Purpose: Read the NSA AERI netCDF files. ; ;Input: file: a string filename for the desired file to read. ; ;Output: atime: time [decimal hours] ; tbirc: IR brightness temperature [C] ; tsurf: Ambient surface temperature [C] ;Keyword: ajtime: optional variable containing time in decimal Julian day. ; no_nan: if set then bad data is not set to NaN, but instead left as is. ; ;Note: RULE: if hatch NOT OPEN then tbirc=NaN ; if tsurf < 100K then NaN ; ;I/O format: readaeri,file,atime,tbirc,tsurf,AJTIME=ajtime ; ;Author: Matthew Shupe ;Date: 3/07/00 ;Modified: 8/27/00 ;---------------------------------------------------------------------- function bright,nu,rad ;Function to calculate the brightness temperature [in C] ; at the given frequency [in cm-1] and measured ; radiance [in mW / m2 sr cm-1]. h=6.62e-34 c=2.9979e+8 bz=1.383e-23 T=(h*c*nu*100)/(bz*alog((2*h*c^2*nu^3*1e11/rad)+1))-273.16 return,T end ;func pro readaeri,file,atime,tbirc,tsurf,AJTIME=ajtime,NO_NAN=no_nan fid=ncdf_open(file) ;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,'Time'),atime ncdf_varget,fid,ncdf_varid(fid,'JulianDay'),ajtime ncdf_varget,fid,ncdf_varid(fid,'outsideAirTemp'),tsurf ncdf_varget,fid,ncdf_varid(fid,'wnum'),wnum ncdf_varget,fid,ncdf_varid(fid,'mean_rad'),mean_rad ncdf_varget,fid,ncdf_varid(fid,'hatchOpen'),hatch ncdf_close,fid ;Calculate the brightness temperature from a 25cm-1 window surrounding 900cm-1 ;------------------------------------------------------------ if n_elements(size(wnum,/dim)) eq 2 then restore,'wnum.dat' nel=n_elements(atime) tbirc=fltarr(nel) iwh=where(wnum gt 887.5 and wnum le 912.5) for i=0,nel-1 do tbirc[i]=bright(900.169,mean(mean_rad[iwh,i])) ;Flag any bad data ;------------- iwh=where(hatch ne 1) if keyword_set(NO_NAN) then begin if iwh[0] ne -1 then tbirc[iwh]=-999. endif else begin if iwh[0] ne -1 then tbirc[iwh]=!values.f_nan iwh=where(tsurf lt 100) if iwh[0] ne -1 then tsurf[iwh]=!values.f_nan endelse tsurf=tsurf-273.16 end