; Get the Scientific Data information from an HDF file Function get_sd, filename, name ;Attempt to catch some errors CATCH, Error_status If Error_status NE 0 then begin Print, 'Error index: ', Error_status Print, 'Error message: ', !ERR_STRING var = -99999. return, var endif sd_id = hdf_sd_start(filename,/read) index = hdf_sd_nametoindex(sd_id, name) sds_id = hdf_sd_select(sd_id,index) hdf_sd_getdata, sds_id, var hdf_sd_endaccess, sds_id hdf_sd_end, sd_id return, var end ;------------------------------------------------------------ ; Get the Vdata information from an HDF file Function get_vd,file_id,name ;Attempt to catch some errors CATCH, Error_status If Error_status NE 0 then begin Print, 'Error index: ', Error_status Print, 'Error message: ', !ERR_STRING return, -99999. endif vd_ref = hdf_vd_find(file_id, strtrim(name,2)) vdata=hdf_vd_attach(file_id,vd_ref) nread=hdf_vd_read(vdata,var) hdf_vd_detach, vdata return,var end ;------------------------------------------------------------ ; Get sw information from an HDF file function get_sw, filename, attrname ;Attempt to catch some errors CATCH, Error_status If Error_status NE 0 then begin Print, 'Error index: ', Error_status Print, 'Error message: ', !ERR_STRING var = -99999. return, var endif file_id = eos_sw_open(filename, /read) sw_id = eos_sw_attach(file_id, 'MOP02') sws_id = eos_sw_readfield(sw_id, attrname, databuffer) status = eos_sw_detach(sw_id) status = eos_sw_close(sw_id) return, databuffer end ;------------------------------------------------------------ ;------------------------------------------------------------ ; INPUT: mopfile ; OUTPUTS: secs,lat,lon,psurf,tsurf,co_data,co_err,co_surf_data,co_surf_err,covmatrix,frac_ap pro read_mopitt, mopfile, secs,lat,lon,psurf,tsurf, $ co_data,co_err,co_surf_data,co_surf_err,covmatrix,frac_ap ;Open HDF file print,mopfile file_id = hdf_open(mopfile, /read) lat = get_vd(file_id, 'Latitude') lon = get_vd(file_id, 'Longitude') secs = get_vd(file_id, 'Seconds in Day') psurf = get_sd(mopfile, 'Retrieval Bottom Pressure') psurf = reform(psurf[0,*]) ;psurf[1,*] contains uncertainty tsurf = get_sd(mopfile, 'Derived Effective Retrieval Bottom Temperature') tsurf = reform(tsurf[0,*]) pres = get_sw(mopfile, 'Pressure Grid') mixing_ratio = get_sd(mopfile, 'CO Mixing Ratio') co_data = reform(mixing_ratio[0,*,*]) co_err = reform(mixing_ratio[1,*,*]) mixing_ratio = get_sd(mopfile, 'Retrieval Bottom CO Mixing Ratio') co_surf_data = reform(mixing_ratio[0,*]) co_surf_err = reform(mixing_ratio[1,*]) covmatrix = get_sd(mopfile, 'Retrieval Error Covariance Matrix') frac_ap = get_sd(mopfile, 'CO Mixing Ratio Percent Apriori') ;Close HDF file hdf_close, file_id end