pro sofie_read_l2_netcdf,file,idump,$ dp_version,nevent,nz,nwave,wave,miss,orbit,event,mode,date,time83,lat83,lon83,$ z,p,t,h2o,h2o_pr,o3,o3_pr,ch4,ch4_pr,no,no_pr,co2,co2_pr,ext,ext_pr,ext1037dv ;----------------------------------------------------------------------------------- ; ; Routine reads a SOFIE level2 NetCDF file and returns named variables. ; ; Input: ; ; file.......path + name of the SOFIE L2 netcdf file ; idump......1 = echo the variable names, 0 = be quiet ; ; Output: ; ; Scalar header info: ; ; dp_version..SOFIE data product version, string, scalar ; nevent......number of events in this file, scalar ; nz..........number of altitude points in profiles, scalar ; nwave.......number of SOFIE wavelengths, scalar ; miss........number that represents missing data (-1e24) ; ; Vectors with 1 value per event: ; ; orbit.....AIM orbit number ; event.....SOFIE event number ; mode......occultation mode, 0 = sunrise, 1 = sunset ; date......date as yyyyddd ; time83....time at 83 km tangent point, seconds since UNIX epoch ; lat83.....latitude (deg, -90 to 90), @ 83 km tangent point ; lon83.....longitude (deg E, 0 to 360), @ 83 km tangent point ; pmc_pres..pmc presence flag, 0 = no PMC present, 1 = PMC present ; pmc_z.....altitude of brightest layer in PMC (km), 0 if no PMC present ; meso_z....mesopause altitude (km) ; ; The common altitude grid for all profile data: ; ; z.........altitude vector (km), dblarr(nz) ; ; Profile data, all are dblarr(nz,nevent): ; ; p.........pressure (hPa) ; t.........temperature (K) ; t_pr......temperature precision (K) ; h2o.......water vapor mixing ratio (ppmv) ; h2o_pr....water vapor precision (ppmv) ; o3........ozone mixing ratio (ppmv) ; o3_pr.....ozone precision (ppmv) ; no........nitric oxide mixing ratio (ppbv) ; no_pr.....nitric oxide precision (ppbv) ; ch4.......methane mixing ratio (ppmv) ; ch4_pr....methane precision (ppmv) ; co2.......carbon dioxide mixing ratio (ppmv) ; co2_pr....carbon dioxide precision (ppmv) ; ; below are the aerosol extinction profile data: ; ; wave........SOFIE band center wavelengths (microns), fltarr(nwave) ; ext.........aerosol extinction (1/km), dblarr(nz,nevent,nwave), the radiometer ("V") rerievals ; ext_pr......aerosol extinction precision (1/km), dblarr(nz,nevent,nwave) ; ext1037dv...aerosol extinction from chan. 2 dV, 1.037 micron wavelength (1/km), dblarr(nz,nevent) ; ; Source: Mark Hervig, GATS Inc. ; ; Revision: Mar 16, 2008 ; ;----------------------------------------------------------------------------------- ;- miscelaneous miss = -1d24 ; missing data value ;- open the file id = ncdf_open(file) glob = ncdf_inquire(id) ;- echo the file contents glob = ncdf_inquire(id) varname = strarr(glob.nvars) ; this will contain the variable names for i = 0,glob.nvars-1 do begin info = ncdf_varinq(id, i) varname(i) = info.name if (idump eq 1) then print,info.name endfor ;- get the global attributes ncdf_diminq,id,'altitude',name,nz ; number of points in profiles ncdf_attget,id,/global,'Title',out & title = string(out) ncdf_attget,id,/global,'DP_Type',out & dp_type = string(out) ncdf_attget,id,/global,'Source',out & source = string(out) ncdf_attget,id,/global,'Mission',out & mission = string(out) ncdf_attget,id,/global,'DP_Version',out & dp_version = string(out) ncdf_attget,id,/global,'PF_Version',out & pf_version = string(out) ncdf_attget,id,/global,'SW_Version',out & sw_version = string(out) ncdf_attget,id,/global,'SW_Name',out & sw_name = string(out) ncdf_attget,id,/global,'Calib_Version',out & cal_version = string(out) ncdf_attget,id,/global,'Description',out & description = string(out) ncdf_attget,id,/global,'History',out & history = string(out) ncdf_attget,id,/global,'Gen_Date',out & gen_date = string(out) if (idump eq 1) then begin print,'Title: ',title print,'DP_Type: ',dp_type print,'Source: ',source print,'DP_Version: ',dp_version print,'PF_Version: ',pf_version print,'SW_Version: ',sw_version print,'SW_Name: ',sw_name print,'Calib_Version: ',cal_version print,'Gen_Date: ',gen_date endif ;- Read the header data ncdf_varget,id,'event' , event ncdf_varget,id,'Orbit' , orbit ncdf_varget,id,'Date' , date ncdf_varget,id,'Mode' , mode ncdf_varget,id,'Time_83km' , time83 ncdf_varget,id,'Longitude_83km', lon83 ncdf_varget,id,'Latitude_83km' , lat83 ;ncdf_varget,id,'PMC_presence' , pmc_pres ;ncdf_varget,id,'PMC_z , pmc_z ;ncdf_varget,id,'Mesopause_altitude' , meso_z nevent = n_elements(event) ;- Read the profile data ncdf_varget,id,'Altitude' , z ncdf_varget,id,'Pressure' , p ncdf_varget,id,'Temperature', t ncdf_varget,id,'H2O_vmr', h2o & h2o = h2o *1d6 ncdf_varget,id,'O3_vmr' , o3 & o3 = o3 *1d6 ncdf_varget,id,'CH4_vmr', ch4 & ch4 = ch4 *1d6 k = where(varname eq 'NO_vmr',nk) if nk gt 0 then begin ncdf_varget,id,'NO_vmr' , no & no = no *1d9 ; ppbv endif k = where(varname eq 'CO2_vmr',nk) if nk gt 0 then begin ncdf_varget,id,'CO2_vmr', co2 & co2 = co2 *1d6 ; ppmv endif k = where(varname eq 'H2O_vmr_precision',nk) if nk gt 0 then begin ncdf_varget,id,'H2O_vmr_precision' , h2o_pr & h2o_pr = h2o_pr *1d6 ; ppmv endif k = where(varname eq 'O3_vmr_precision',nk) if nk gt 0 then begin ncdf_varget,id,'O3_vmr_precision' , o3_pr & o3_pr = o3_pr *1d6 ; ppmv endif k = where(varname eq 'CH4_vmr_precision',nk) if nk gt 0 then begin ncdf_varget,id,'CH4_vmr_precision' , ch4_pr & ch4_pr = ch4_pr *1d6 ; ppmv endif k = where(varname eq 'NO_vmr_precision',nk) if nk gt 0 then begin ncdf_varget,id,'NO_vmr_precision' , no_pr & no_pr = no_pr *1d9 ; ppbv endif k = where(varname eq 'CO2_vmr_precision',nk) if nk gt 0 then begin ncdf_varget,id,'CO2_vmr_precision' , co2_pr & co2_pr = co2_pr *1d6 ; ppmv endif ncdf_varget,id,'Extinction_0330' , e0330 ncdf_varget,id,'Extinction_0867' , e0867 ncdf_varget,id,'Extinction_1037' , e1037 ncdf_varget,id,'Extinction_2462' , e2462 ncdf_varget,id,'Extinction_2939' , e2939 ncdf_varget,id,'Extinction_3064' , e3064 ncdf_varget,id,'Extinction_3186' , e3186 ncdf_varget,id,'Extinction_3479' , e3479 ncdf_varget,id,'Extinction_4646' , e4646 ncdf_varget,id,'Extinction_5006' , e5006 k=where(varname eq 'Extinction_0330_precision',nk) & if nk gt 0 then ncdf_varget,id,'Extinction_0330_precision',e0330_pr k=where(varname eq 'Extinction_0867_precision',nk) & if nk gt 0 then ncdf_varget,id,'Extinction_0867_precision' , e0867_pr k=where(varname eq 'Extinction_1037_precision',nk) & if nk gt 0 then ncdf_varget,id,'Extinction_1037_precision' , e1037_pr k=where(varname eq 'Extinction_2462_precision',nk) & if nk gt 0 then ncdf_varget,id,'Extinction_2462_precision' , e2462_pr k=where(varname eq 'Extinction_2939_precision',nk) & if nk gt 0 then ncdf_varget,id,'Extinction_2939_precision' , e2939_pr k=where(varname eq 'Extinction_3064_precision',nk) & if nk gt 0 then ncdf_varget,id,'Extinction_3064_precision' , e3064_pr k=where(varname eq 'Extinction_3186_precision',nk) & if nk gt 0 then ncdf_varget,id,'Extinction_3186_precision' , e3186_pr k=where(varname eq 'Extinction_3479_precision',nk) & if nk gt 0 then ncdf_varget,id,'Extinction_3479_precision' , e3479_pr k=where(varname eq 'Extinction_4646_precision',nk) & if nk gt 0 then ncdf_varget,id,'Extinction_4646_precision' , e4646_pr k=where(varname eq 'Extinction_5006_precision',nk) & if nk gt 0 then ncdf_varget,id,'Extinction_5006_precision' , e5006_pr k = where(varname eq 'Extinction_1037dv',nk) if (nk gt 0) then $ ncdf_varget,id,'Extinction_1037dv', ext1037dv ; arr(event,time) ;- Order the extinctions into one array nwave = 16L ; band 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 wave = [0.292,0.330,0.867,1.037,2.462,2.618,2.785,2.939,3.064,3.186,3.384,3.479,4.324,4.646,5.006,5.316] ; SOFIE band center wavelengths, microns ext = dblarr(nz,nevent,nwave) ext_pr = dblarr(nz,nevent,nwave) ;ext(*,*, 0) = ext(*,*, 1) = e0330 ext(*,*, 2) = e0867 ext(*,*, 3) = e1037 ext(*,*, 4) = e2462 ;ext(*,*, 5) = ;ext(*,*, 6) = ext(*,*, 7) = e2939 ext(*,*, 8) = e3064 ext(*,*, 9) = e3186 ;ext(*,*,10) = ext(*,*,11) = e3479 ;ext(*,*,12) = ext(*,*,13) = e4646 ;ext(*,*,14) = ext(*,*,15) = e5006 ;ext(*,*,16) = if 1 eq 2 then begin ;ext_pr(*,*, 0) = ext_pr(*,*, 1) = e0330_pr ext_pr(*,*, 2) = e0867_pr ext_pr(*,*, 3) = e1037_pr ext_pr(*,*, 4) = e2462_pr ;ext_pr(*,*, 5) = ;ext_pr(*,*, 6) = ext_pr(*,*, 7) = e2939_pr ext_pr(*,*, 8) = e3064_pr ext_pr(*,*, 9) = e3186_pr ;ext_pr(*,*,10) = ext_pr(*,*,11) = e3479_pr ;ext_pr(*,*,12) = ext_pr(*,*,13) = e4646_pr ;ext_pr(*,*,14) = ext_pr(*,*,15) = e5006_pr ;ext_pr(*,*,16) = endif ;- Close the file ncdf_close,id ;- Done return end