; ; This example code illustrates how to access and visualize ICESat/GLAS ; L2 HDF5 file in NCL. ; ; 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 GLAH13_633_2103_001_1317_0_01_0001.h5.idl ; ; Tested under: IDL 8.0 ; Last updated: 2013-1-14 ; Open file. file_name='GLAH13_633_2103_001_1317_0_01_0001.h5' ; file_id=H5F_OPEN(file_name) ; Read latitude. latitude_name='/Data_1HZ/Geolocation/d_lat' latitude_id=H5D_OPEN(file_id, latitude_name) lat=H5D_READ(latitude_id) ; Close dataset. H5D_CLOSE, latitude_id ; Read longitude. lon_name='/Data_1HZ/Geolocation/d_lon' lon_id=H5D_OPEN(file_id, lon_name) lon=H5D_READ(lon_id) ; Close dataset. H5D_CLOSE, lon_id ; Read temperature. temp_name='/Data_1HZ/Atmosphere/d_Surface_temp' temp_id=H5D_OPEN(file_id, temp_name) temp=H5D_READ(temp_id) ; Read unit attribute. units_temp_id=H5A_OPEN_NAME(temp_id, 'units') units_temp=H5A_READ(units_temp_id) H5A_CLOSE, units_temp_id ; Read long name attribute. ln_temp_id=H5A_OPEN_NAME(temp_id, 'long_name') long_name_temp=H5A_READ(ln_temp_id) H5A_CLOSE, ln_temp_id ; Close dataset. H5D_CLOSE, temp_id ; Read delta time. time_name='/Data_1HZ/DS_UTCTime_1' time_id=H5D_OPEN(file_id, time_name) time=H5D_READ(time_id) ; Close dataset. H5D_CLOSE, time_id ; Close file. H5F_CLOSE, file_id ; Subset locations that do not have fill values. ; We used HDFView to check lat/lon values. lat = lat[272:327] lon = lon[272:327] time = time[272:327] temp = temp[272:327] ; Create an elapsed time variable. time_e = time - time(0) ; Generate the plot. levels = 254 DEVICE, DECOMPOSED=0 LOADCT, 33, NCOLORS=levels, BOTTOM=1 ; Plot graphs. WINDOW, Title=file_name, XSIZE=800, YSIZE=400*2 ; Plot elapsed time vs temperature. ; ; Without the /NOERASE option, the previous plot will be erased. PLOT, time_e, temp, $ POSITION=[0.1, 0.52, 0.93, 0.94], $ XTITLE='ElapsedTime (sec)', /NOERASE XYOuts, 0.1, 0.96, /NORMAL, 'FIELD:' + long_name_temp, $ CHARSIZE=1.25, ALIGNMENT=0.0 XYOuts, 0.93, 0.96, /NORMAL, 'UNIT:' + units_temp, $ CHARSIZE=1.25, ALIGNMENT=1.0 XYOuts, 0.5, 0.98, /NORMAL, file_name, $ CHARSIZE=1.75, ALIGNMENT=0.5 ; Get corner values for lat and lon. lonmin=MIN(lon) lonmax=MAX(lon) latmin=MIN(lat) latmax=MAX(lat) ; Plot the trajectory on map. MAP_SET, /GRID, /CONTINENTS, XMARGIN=5, YMARGIN=5, $ POSITION=[0.1, 0.05, 0.45, 0.4], $ LIMIT=[latmin, lonmin, latmax, lonmax], /NOERASE MAP_GRID, /BOX_AXES, COLOR=255 MAP_CONTINENTS, COLOR=255 OPLOT, lon, lat, COLOR=45 PLOTS, lon(0), lat(0), COLOR=250, PSYM=1, SYMSIZE=2, THICK=2 XYOUTS, 0.1, 0.44, /NORMAL, 'Trajectory of Flight Path', $ CHARSIZE=1.75, COLOR=255, ALIGNMENT=0.0 ; Plot the location on global map. MAP_SET, /GRID, /CONTINENTS, XMARGIN=5, YMARGIN=5, $ POSITION=[0.5, 0.05, 0.93, 0.4], /NOERASE MAP_GRID, /BOX_AXES, COLOR=255 MAP_CONTINENTS, COLOR=255 PLOTS, lon(0), lat(0), COLOR=250, PSYM=1, SYMSIZE=2, THICK=2 XYOUTS, 0.9, 0.44, /NORMAL, 'Starting Location of Flight Path', $ CHARSIZE=1.75, COLOR=255, ALIGNMENT=1.0 ; Write JPEG image file. im = TVRD(TRUE=3) jpg = file_name + '.idl.jpg' WRITE_JPEG, jpg, im, QUALITY=100, TRUE=3 EXIT