; ; This example code illustrates how to access and visualize GES DISC HIRDLS ; Zonal Average HDF-EOS5 file in IDL. ; ; If you have any questions, suggestions, comments on this example, ; please use the HDF-EOS Forum (http://hdfeos.org/forums). ; ; If you would like to see an example of any other NASA HDF/HDF-EOS ; data product that is not listed in the HDF-EOS Comprehensive Examples page ; (http://hdfeos.org/zoo), feel free to contact us at eoshelp@hdfgroup.org ; or post it at the HDF-EOS Forum (http://hdfeos.org/forums). ; ; Usage: ; ; $idl HIRDLS-Aura_L3ZFCNO2_v07-00-20-c01_2005d022-2008d077.he5.idl ; ; Tested under: IDL 8.7.2 ; Last updated: 2019-11-05 ; Open file. file_name='HIRDLS-Aura_L3ZFCNO2_v07-00-20-c01_2005d022-2008d077.he5' file_id=H5F_OPEN(file_name) ; Read data. datafield_name='/HDFEOS/ZAS/HIRDLS/Data Fields/NO2Ascending' data_id=H5D_OPEN(file_id,datafield_name) data=H5D_READ(data_id) ; Get title. title_id=H5A_OPEN_NAME(data_id, 'Title') title=H5A_READ(title_id) H5A_Close, title_id ; Get units. units_id=H5A_OPEN_NAME(data_id, 'Units') units=H5A_READ(units_id) H5A_Close, units_id ; Get missing value. missingvalue_id=H5A_OPEN_NAME(data_id,'MissingValue') missingvalue=H5A_READ(missingvalue_id) H5A_Close, missingvalue_id ; Get fill value. fillvalue_id=H5A_OPEN_NAME(data_id,'_FillValue') fillvalue=H5A_READ(fillvalue_id) H5A_Close, fillvalue_id ; Close dataset. H5D_Close, data_id ; Read latitude. latitude_name='/HDFEOS/ZAS/HIRDLS/Data Fields/Latitude' latitude_id=H5D_OPEN(file_id, latitude_name) lat=H5D_READ(latitude_id) ; Get title. title_id=H5A_OPEN_NAME(latitude_id, 'Title') title_lat=H5A_READ(title_id) H5A_Close, title_id ; Get units. units_id=H5A_OPEN_NAME(latitude_id, 'Units') units_lat=H5A_READ(units_id) H5A_Close, units_id ; Close dataset. H5D_Close, latitude_id ; Read Pressure. pressure_name='/HDFEOS/ZAS/HIRDLS/Data Fields/Pressure' pressure_id=H5D_OPEN(file_id, pressure_name) pressure=H5D_READ(pressure_id) ; Get title. title_id=H5A_OPEN_NAME(pressure_id, 'Title') title_p=H5A_READ(title_id) H5A_Close, title_id ; Get units. units_id=H5A_OPEN_NAME(pressure_id, 'Units') units_p=H5A_READ(units_id) H5A_Close, units_id ; Close dataset. H5D_Close, pressure_id ; Read Time. Time_name='/HDFEOS/ZAS/HIRDLS/Data Fields/Time' time_id=H5D_OPEN(file_id,Time_name) time=H5D_READ(time_id) H5D_Close, time_id ; Read nCoeffs. nco_name='/HDFEOS/ZAS/HIRDLS/nCoeffs' nco_id=H5D_OPEN(file_id,nco_name) nco=H5D_READ(nco_id) H5D_Close, nco_id ; Close file. H5F_Close, file_id ; Convert type to double. dataf = float(data) ; Process missing value. idx=where(data eq missingvalue(0), cnt) if cnt gt 0 then dataf[idx] = !Values.F_NAN ; Process fill value. idx=where(data eq fillvalue(0), cnt) if cnt gt 0 then dataf[idx] = !Values.F_NAN ; Set subset index. tdim = 0 ; Subset data. data2D=dataf[0,*,*,tdim] data2D = Reform(data2D) ; data2D=data2D * 1000000000 time_at = time(tdim) ; Time's unit is TAI-93. start_time = JULDAY(1,1,1993, 0, 0, 0) sec = time_at / 86400 t = start_time + sec CALDAT, t, Mo, D, Y, H, Mi, S tstring = STRING(Y, FORMAT='(I4)') + '-' + STRING(Mo, FORMAT='(I2.2)') + $ '-' + STRING(D, FORMAT='(I2.2)') + ' ' + STRING(H, FORMAT='(I2.2)') $ + ':' + STRING(Mi, FORMAT='(I2.2)') + ':' + STRING(S, FORMAT='(I2.2)') d_max=MAX(pressure) d_min=MIN(pressure) ; Generate the plot. ct = COLORTABLE(13) c1 = CONTOUR(data2D, lat, pressure, $ /FILL, $ /BUFFER, $ /YLOG, $ YRANGE=[d_max, d_min], $ RGB_TABLE=ct, $ TITLE=file_name, $ XTITLE=title_lat +' (' + units_lat + ')', $ YTITLE=title_p + ' (' + units_p + ')', $ POSITION=[0.2, 0.1, 0.82, 0.8]) cb = COLORBAR(TARGET=c1, /BORDER, ORIENTATION=1, TEXTPOS=1, $ POSITION=[0.85,0.2,0.87,0.8], TITLE='vmr') nco_str = STRING(nco[0], FORMAT='(I1)') t1 = TEXT(0.2, 0.8, title+' at '+tstring+ ' and nCoeffs='+nco_str) ; Write PNG image file. png = file_name + '.idl.png' c1.save, png, HEIGHT=600, WIDTH=800 EXIT ; References ; ; [1] http://www.dfanning.com/documents/programs.html