; Copyright (C) 2014 The HDF Group ; All rights reserved. ; ; This example code illustrates how to access and visualize OPeNDAP ; AIRS Grid file in GDL. ; ; If you have any questions, suggestions, comments on this example, ; please use the HDF-EOS Forum (http://hdfeos.org/forums). ; ; Acknowledgement: We'd like to thank "giloo" [1] for improving our code ; to make it work on world map. ; Tested under: GDL 0.9.4 ; Last updated: 2014-01-24 ; Open OPeNDAP URL. url='http://eosdap.hdfgroup.uiuc.edu:8080/opendap/data/NASAFILES/hdf4/AIRS.2002.08.01.L3.RetStd_H031.v4.0.21.0.G06104133732.hdf' fid = NCDF_OPEN(url) ; Open dataset. vid = NCDF_VARID(fid, 'Temperature_MW_A') ; Retrieve fill value attribute. NCDF_ATTGET, fid, vid, '_FillValue', fillvalue PRINT, fillvalue ; Retrieve data. NCDF_VARGET, fid, vid, data ; Retrieve lat/lon /data. vid = NCDF_VARID(fid, 'Longitude') NCDF_VARGET, fid, vid, lon vid = NCDF_VARID(fid, 'Latitude') NCDF_VARGET, fid, vid, lat ; Close. NCDF_CLOSE, fid ; Subset data. data2D = data[*,*,11] data2D=Reform(data2D) ; Process fill values, convert data that are equal to fillvalue to NaN. dataf=float(data2D) fillvaluef = float(fillvalue(0)) idx=WHERE(dataf eq fillvaluef, cnt) IF cnt GT 0 THEN dataf[idx] = !Values.F_NAN ; Plot contour on map. levels=254 LOADCT, 33, NCOLORS=levels, BOTTOM=1 ; Set projection. MAP_SET, POSITION=[0.05, 0.06, 0.82, 0.80] ; GDL's contour kills projection information. CONTOUR, dataf, lon,lat, /FILL, NLEVELS=levels, POSITION=[0.05, 0.06, 0.82, 0.80], $ /XST, /YST, XTICKINT=45, YTICKINT=30 ; Thus, restore projection information. MAP_SET, POSITION=[0.05, 0.06, 0.82, 0.80], /NOERASE MAP_CONTINENTS, COLOR=WHITE ; Add some labels. units = 'K' XYOUTS, 0.5, 0.9, /NORMAL, url , CHARSIZE=1.3, ALIGNMENT=0.5 XYOUTS, 0.05, 0.86, /NORMAL, 'FIELD:Temperature_MW_A at TempPrsLvls=11', $ CHARSIZE=1.25, ALIGNMENT=0.0 XYOUTS, 0.94, 0.86, /NORMAL, 'UNIT:' + units, $ CHARSIZE=1.25, ALIGNMENT=1.0 ; We assume that the coyote library [2] is installed under the current working ; directory that this code exists. !PATH=EXPAND_PATH('+coyote/')+':'+!PATH ; Get max and min value of data for color bar. datamin = MIN(dataf, /NAN) datamax = MAX(dataf, /NAN) ; The following code assumes that you've already download and installed ; "Dr. Fanning's Coyote Library" and add the coyote directory above. ; ; If you don't need a color bar in your plot, you can ignore this step ; by adding comment character ';' at the beginning of the code. COLORBAR, RANGE=[datamin, datamax], NCOLORS=levels, /VERTICAL, $ POSITION=[0.9,0.08,0.94,0.8] ; References ; ; [1] http://sourceforge.net/p/gnudatalanguage/discussion/338692/thread/88c6ad3d/ ; [2] http://www.dfanning.com/documents/programs.html