pro read_mls_v04, date, tracer_id, data, press, lon, lat, time, time_utc, $ missingvalue=missingvalue, units=units, error=error, $ col_o3_geos5=col_o3_geos5,col_o3_mls=col_o3_mls, $ col_temp_geos5=col_temp_geos5,col_temp_mls=col_temp_mls, $ nrt=nrt, version=version, quality=quality, conv=conv, $ sza=sza, status=status, precision=precision, apriori=apriori, $ admode=admode ;+ ; NAME: read_mls ; ; PURPOSE: read in L2 data from mls hdf-eos files ; Returns the data fields and geolocation for data in ; simple arrays of (press,location tag) ; screen bad data (precision < 0) and put in missing value = -999.99 ; ; CATEGORY: Input/Output ; ; CALLING SEQUENCE: ; ; read_mls, date, tracer_id, data, press, lon, lat, time, $ ; missingvalue=missingvalue, units=units, error=error ; ; REQUIRED INPUT PARAMETERS: ; date = scaler string = scalar string(YYYYMMDD or YYMMDD) ; The files are searched in the science system only. ; ; tracer_id = scaler string(' ') ;Parameters are CASE INSENSITIVE ; e.g. 'CH3CN' ; 'CO' ; 'GPH' ; 'HCL' ; 'HCl-640-b13' ;this is a DGG file included up to V02 ; 'HCl-640' ;this is a DGG file included up to V02 ; 'HNO3' ; 'HNO3-190 ;since V04, apriori defaults to HNO3-APriori ; 'HNO3-240 ;since V04, apriori defaults to HNO3-APriori ; 'HOCL' ; 'IWC' ;does not contain apriori information ; 'IWP' ;does not contain apriori information ; 'O3' ; 'O3 column' ;apriori defaults to O3-APriori ; 'RHI' ; 'UTRHI' ; 'Temperature' ; 'BRO' ; 'CLO' ; 'H2O' ; 'HCN' ; 'N2O' ; 'N2O-190' ; 'N2O-640' ; 'OH' ; 'SO2' ; ; ; ; OUTPUT PARAMETERS: ; data = 2D float array (pr essure level, location) ; NOTE: if columns=1 data are 1D arrays based on location tag ; press = single float array (hPa) ; unless keyword(column) is set then press=-1 ; lon = single float array (deg longitude) ; lat = single float array (deg latitude) ; time = single float array (local solar time for each measurement) ; units=h ; time_utc = single float array (time in seconds) ; The field time describes time as the number of seconds elapsed ; (including the 5 or 6 subsequent leap seconds to ; date) since midnight universal time on 1 January 1993. ; ; ; ; KEYWORD PARAMETERS: ; status= 1-D integer array of status ; conv = 1-D float array of convergence ; precision = 2-D float array of precision ; sza = 1-D float array of Solar Zenith Angle ; quality = 1-D float array of quality flags ; units = scalar string format ; missingvalue = scaler float = -999.99 ; error = 0 (successfully read); 1 (unsuccessful) ; col_o3_GEOS5 = call with tracer_id='O3' to read strat column amounts, V02 only ; col_o3_mls = call with tracer_id='O3' to read strat column amounts, V02 only ; col_temp_GEOS5 = call with tracer_id='Temperature' to read tropopause heights, V02 only ; col_temp_mls = call with tracer_id='Temperature' to read tropopause heights, V02 only ; ; version = string('V01' or 'V02') ; Looks for version V0X data. Default is to read the most current version. ; ex. read_mls, '061004','O3',data,press,lon,lat,time,version='V02' ; ; ; nrt = Near-Real-Time assimilation data are read ; = only until 2008 ; = missing value of -999.99 for precision < 0 ; = tracer_id = 'O3' ONLY ; = column amounts not counted ; = The data are sparse. Check data at '/science/aura/MLS/data/L2/NRT' ; ; Example: read_mls, '20061004', 'O3', data, press, lon, lat, time, /nrt ; ; apriori = keyword activated ; = returns the 2D apriori variable to output parameter 'data' ; = available in/since version V04 ; = If called, will return the quality, status, convergence and precision. ; ; Example: read_mls, '20061004', 'O3', data, press, lon, lat, time, /apriori, $ ; quality=quality, conv=conv, status=status, precision=precision ; ; admode = Ascending/Descending mode ; = returns a 1D array ; ; returns apriori into output variable 'data', along with the apriori ; quality, convergence, status, and precision ; ; ; Example1: read_mls,'20061004','O3',data,press,lon,lat,time,/col_o3_geos5 ; ; Example2: read_mls,'20061004','Temperature',data,press,lon,lat,time,/col_temp_mls ; ; will return tropopause pressure height data ; ; REQUIRED ROUTINES ; tai2utc.pro - converts universal atomic time to hours, minutes, sec ; ; ORIGINAL AUTHOR: ; Jacquelyn Witte, SSAI, 2008/01 ; ; added assimilation data, 2008/02 ; reads the most recent data 'V03', 2013/02 ; added precision, 2013/06 ; added apriori in V04, 2016/01 ; added Ascending/Descending mode, 2018/04 ; ;- ;----------------------------------------------------------------------- ; *****Check date datein=date if strlen(datein) eq 6 then datein='20'+datein if strlen(datein) ne 8 then begin print, 'Incorrect date entry (should be YYYYMMDD)' stop endif yyyyddd=convert_date(datein,/from_yyyymmdd,/to_yyyyddd) year=strmid(yyyyddd,0,4) jday=strmid(yyyyddd,4,3) error=0 ; *****Get Directory ID CASE STRLOWCASE(tracer_id) of 'iwp': dir_id='iwc' 'bro-640': dir_id='dgg' 'ch3cn-190': dir_id='dgg' 'ch3cn-640': dir_id='dgg' 'ch3cl-640': dir_id='dgg' 'ch3cl-methanol': dir_id='dgg' 'co-240': dir_id='dgg' 'co-ozone': dir_id='dgg' 'clo-190': dir_id='dgg' 'clo-640': dir_id='dgg' 'clo-methanol': dir_id='dgg' 'h2o-190': dir_id='dgg' 'hcn-190': dir_id='dgg' 'hcl-640': dir_id='dgg' 'hno3-190': dir_id='dgg' 'hno3-240': dir_id='dgg' 'hno3-640': dir_id='dgg' 'ho2-640': dir_id='dgg' 'hocl-640': dir_id='dgg' 'n2o-190': dir_id='dgg' 'n2o-640': dir_id='dgg' 'n2o-stdprod': dir_id='dgg' 'o3-190': dir_id='dgg' 'o3-240': dir_id='dgg' 'o3-640': dir_id='dgg' 'oh-2t5': dir_id='dgg' 'so2-190': dir_id='dgg' 'so2-240': dir_id='dgg' 'so2-640': dir_id='dgg' 'o3 column': dir_id='o3' 'utrhi': dir_id='rhi' ELSE: dir_id = STRLOWCASE(tracer_id) ENDCASE ; *****get path name to file if keyword_set(nrt) then $ path='/science/aura/MLS/data/L2/NRT/'+year+'/' else $ path='/science/aura/MLS/data/L2/V04/'+dir_id+'/'+year+'/' if keyword_set(version) then path='/science/aura/MLS/data/L2/'+version+'/'+dir_id+'/'+year+'/' ; *****get filename id for upper/lower case mixed names CASE STRLOWCASE(tracer_id) OF 'bro': fname_id='BrO' 'bro-640': fname_id='BrO-640' 'ch3cl': fname_id='CH3Cl' 'ch3cl-640': fname_id='CH3Cl-640' 'ch3cl-methanol': fname_id='CH3Cl-Methanol' 'clo': fname_id='ClO' 'clo-190': fname_id='ClO-190' 'clo-640': fname_id='ClO-640' 'clo-methanol': fname_id='ClO-Methanol' 'co-ozone': fname_id='CO-Ozone' 'hcl': fname_id='HCl' 'hcl-640': fname_id='HCl-640' 'hcl-640-b13': fname_id='HCl-640-B13' 'hocl': fname_id='HOCl' 'hocl-640': fname_id='HOCl-640' 'n2o-stdprod': fname_id='N2O-StdProd' 'iwp': fname_id='IWC' 'temperature': fname_id='Temperature' ELSE: fname_id=STRUPCASE(tracer_id) ENDCASE ; *****get the file if keyword_set(nrt) then begin file_name = FINDFILE(path+'MLS-Aura_L2GP*'+fname_id+'*'+year+'d'+jday+'*',count=cnt) if cnt eq 0 then begin print, 'Assimilation File not found for ', datein error=1 GOTO, end_program endif else file_name=file_name(0) endif else begin file_name = FINDFILE(path+'MLS-Aura_L2GP*'+year+'d'+jday+'*',count=cnt) if cnt eq 0 then begin print, 'File not found for ', datein error=1 GOTO, end_program endif else file_name=file_name(n_elements(file_name)-1) endelse if error eq 0 then print, 'Read file: '+file_name ; so the file exists we can move on ... ; *****get the swaths where data are located for upper/lower case mixed names CASE STRLOWCASE(tracer_id) OF 'bro': swath_id='BrO' 'bro-640': swath_id='BrO-640' 'ch3cl': swath_id='CH3Cl' 'ch3cl-640': swath_id='CH3Cl-640' 'ch3cl-methanol': swath_id='CH3Cl-Methanol' 'clo': swath_id='ClO' 'clo-190': swath_id='ClO-190' 'clo-640': swath_id='ClO-640' 'clo-methanol': swath_id='ClO-Methanol' 'co-ozone': swath_id='CO-Ozone' 'hcl': swath_id='HCl' 'hcl-640-b13': swath_id='HCl-640-B13' 'hcl-640': swath_id='HCl-640' 'hocl': swath_id='HOCl' 'hocl-640': swath_id='HOCl-640' 'n2o-stdprod': swath_id='N2O-StdProd' 'o3 column':swath_id='O3 column' 'temperature': swath_id='Temperature' ELSE: swath_id=STRUPCASE(tracer_id) ENDCASE ; *****override to read apriori if keyword_set(apriori) then begin CASE STRLOWCASE(tracer_id) OF 'o3 column': swath_id='O3-APriori' 'bro-640': swath_id='BRO-APriori' 'ch3cn-190': swath_id='CH3CN-APriori' 'ch3cn-640': swath_id='CH3CN-APriori' 'ch3cl-640': swath_id='CH3Cl-APriori' 'ch3cl-methanol': swath_id='CH3Cl-APriori' 'co-240': swath_id='CO-APriori' 'co-ozone': swath_id='CO_APriori' 'clo-190': swath_id='ClO-APriori' 'clo-640': swath_id='ClO-APriori' 'clo-methanol': swath_id='ClO-APriori' 'h2o-190': swath_id='H2O-APriori' 'hcn-190': swath_id='HCN-APriori' 'hcl-640': swath_id='HCl-APriori' 'hno3-190': swath_id='HNO3-APriori' 'hno3-240': swath_id='HNO3-APriori' 'hno3-640': swath_id='HNO3-APriori' 'ho2-640': swath_id='HO2-APriori' 'hocl-640': swath_id='HOCl-APriori' 'n2o-190': swath_id='N2O-APriori' 'n2o-640': swath_id='N2O-APriori' 'n2o-stdprod': swath_id='N2O-APriori' 'o3-190': swath_id='O3-APriori' 'o3-240': swath_id='O3-APriori' 'o3-640': swath_id='O3-APriori' 'oh-2t5': swath_id='OH-APriori' 'so2-190': swath_id='SO2-APriori' 'so2-240': swath_id='SO2-APriori' 'so2-640': swath_id='SO2-APriori' ELSE: swath_id=swath_id+'-APriori' ENDCASE endif ; *****check for column calls if keyword_set(col_o3_geos5) then swath_id='O3 column-GEOS5' if keyword_set(col_o3_mls) then swath_id='O3 column-MLS' if keyword_set(col_temp_geos5) then swath_id='WMOTPPressure-GEOS5' if keyword_set(col_temp_mls) then swath_id='WMOTPPressure-MLS' file_id = H5F_OPEN(file_name) path_str='/HDFEOS/SWATHS/'+swath_id+'/Data Fields/' path_str_geo='/HDFEOS/SWATHS/'+swath_id+'/Geolocation Fields/' ; *****TEST MLS Data field variables exist path_str_test='/HDFEOS/SWATHS/'+swath_id H5_LIST,file_name,output=direct aa=where(direct[1,*] eq path_str_test, cnt) if cnt eq 0 then begin print, 'Variable '+swath_id+' does not exist' error=1 GOTO, end_program endif ; *****extract MLS Data field variables dataset_id=H5D_OPEN(file_id,path_str+swath_id) ; *****check that data is successfully read IF (n_elements(dataset_id) eq 0) THEN BEGIN error=1 goto , end_program ENDIF ELSE BEGIN data=H5D_READ(dataset_id) H5D_CLOSE,dataset_id ENDELSE ; *****read variable Precision dataset_id=H5D_OPEN(file_id,path_str+swath_id+'Precision') ; *****check that data is successfully read IF (n_elements(dataset_id) eq 0) THEN BEGIN error=1 goto , end_program ENDIF ELSE BEGIN precision=H5D_READ(dataset_id) H5D_CLOSE,dataset_id ENDELSE ; *****read variable Ascending/Descending Mode dataset_id=H5D_OPEN(file_id,path_str+'AscDescMode') ; *****check that data is successfully read IF (n_elements(dataset_id) eq 0) THEN BEGIN error=1 goto , end_program ENDIF ELSE BEGIN admode=H5D_READ(dataset_id) H5D_CLOSE,dataset_id ENDELSE ; *****read variable Quality dataset_id=H5D_OPEN(file_id,path_str+'Quality') ; *****check that data is successfully read IF (n_elements(dataset_id) eq 0) THEN BEGIN error=1 goto , end_program ENDIF ELSE BEGIN quality=H5D_READ(dataset_id) H5D_CLOSE,dataset_id ENDELSE ; *****read variable Convergence dataset_id=H5D_OPEN(file_id,path_str+'Convergence') ; *****check that data is successfully read IF (n_elements(dataset_id) eq 0) THEN BEGIN error=1 goto , end_program ENDIF ELSE BEGIN conv=H5D_READ(dataset_id) H5D_CLOSE,dataset_id ENDELSE ; *****read variable Status dataset_id=H5D_OPEN(file_id,path_str+'Status') ; *****check that data is successfully read IF (n_elements(dataset_id) eq 0) THEN BEGIN error=1 goto , end_program ENDIF ELSE BEGIN status=H5D_READ(dataset_id) H5D_CLOSE,dataset_id ENDELSE ; *****read Geolocation Fields ; NOTE: Pressure not available for column data CASE swath_id of 'O3 column-GEOS5': press=-1 'O3 column-MLS': press=-1 'O3 column': press=-1 'WMOTPPressure-GEOS5': press=-1 'WMOTPPressure-MLS': press=-1 ELSE: begin dataset_id=H5D_OPEN(file_id,path_str_geo+'Pressure') press=H5D_READ(dataset_id) H5D_CLOSE,dataset_id end ENDCASE ; Latitude dataset_id=H5D_OPEN(file_id,path_str_geo+'Latitude') lat=H5D_READ(dataset_id) H5D_CLOSE,dataset_id ; Longitude dataset_id=H5D_OPEN(file_id,path_str_geo+'Longitude') lon=H5D_READ(dataset_id) H5D_CLOSE,dataset_id ; LocalSolarTime dataset_id=H5D_OPEN(file_id,path_str_geo+'LocalSolarTime') time=H5D_READ(dataset_id) H5D_CLOSE,dataset_id ; Local UTC time dataset_id=H5D_OPEN(file_id,path_str_geo+'Time') time_utc=H5D_READ(dataset_id) H5D_CLOSE,dataset_id ; Solar Zenith Angle dataset_id=H5D_OPEN(file_id,path_str_geo+'SolarZenithAngle') sza=H5D_READ(dataset_id) H5D_CLOSE,dataset_id H5F_CLOSE,file_id ; *****fill negative precision with missing values missingvalue=-999.99 tag=where(precision lt 0, tcnt ) if tcnt gt 0 then data(tag)=missingvalue ; *****define units CASE STRLOWCASE(tracer_id) of 'iwc': units='g/m^3' 'iwp': units='g/m^3' 'temperature': units='K' 'o3 column': units='DU' 'wmotppressure-geos5': units='hPa' 'wmotppressure-mls': units='hPa' 'gph': units='m' 'rhi': units='%' ELSE: units='vmr' ENDCASE end_program: END