How to Visualize HDF-EOS data Using IDL via OPeNDAP

IDLexternal is a solution for data visualization and it can visualize a remote HDF-EOS file through OPeNDAPexternal . This is possible because OPeNDAP provides the OPeNDAP IDL Client. In this example, we assume that you have both IDL software and the OPeNDAP IDL Client installed on your system. The IDL is a commercial software that requires a purchase of license. You can download the OPeNDAP IDL Client from here for free.

The first step is to create a URL variable. Define an OPeNDAP URL variable that serves an HDF-EOS file. You can download the file in this example here.

Call the OPENDAP_GET function. This function is provided by the OPeNDAP IDL client library. If IDL failed to retrieve the data specified in URL, you'll see an error message failed to retrieve OPeNDAP data. Also, the return value of stat will be 0. You can view the contents of the data by typing help, /str, data.

Figure 2 Get data from the URL
stat = OPENDAP_GET(url, data, mode='data')
PRINT, stat
HELP, /str, data

From the contents, you'll see that OPeNDAP Grid is represented as an IDL STRUCT variable.

Figure 3 Get data from the URL
TOPOGRAPHYSTRUCT-> <Anonymous> Array[1]
You can define new variables for the array and the map data inside the OPeNDAP Grid as follows.
Figure 4 Get data from the URL
dataset = data.TOPOGRAPHY.TOPOGRAPHY.TOPOGRAPHY
lat = data.TOPOGRAPHY.lat.lat
lon = data.TOPOGRAPHY.lon.lon
levels = 12
As you can infer from the above code, IDL represents an OPeNDAP Grid data as a structure(e.g., data.TOPOGRAPHY). Inside the Grid structure, each member variable name(e.g., data.TOPOGRAPHY.lat) becomes another IDL structure and its array data is referred as the member of its own structure (e..g., data.TOPOGRAPHY.lat.lat). The levels will be used later to generate a contour map.

Now we're ready to draw the dataset defined above. The following code prepares a window with 12 colors and grid map. The CONTOUR command fills the grid map with HDF-EOS data(e.g., data.TOPOGRAPHY.TOPOGRAPHY.TOPOGRAPHY).

Figure 5 Display data from the URL
DEVICE, decomposed=0
LOADCT, 33, Ncolors=12, Bottom=3
WINDOW, 0, Title='AIRS.2008.10.27.L3 Topography', XSize=600, YSize=400
MAP_SET, /GRID, /CONTINENT
CONTOUR, dataset, lon, lat, /OVERPLOT, /FILL, C_Colors=Indgen(levels)+3, Background=1, NLEVELS=levels, Color=Black

As you can see from the Figure 6, the color filled contour can hide the original map grid and continents because the dataset covers the world. Thus, we want to draw the outlines of the continent again. The following codes will add the grid lines and world maps on top of the color-filled contour map.

Figure 7 Draw grids and maps
MAP_GRID, /LABEL, COLOR=255
MAP_CONTINENTS, COLOR=255
The Figure 8 shows the final IDL image. You can see the complete code from here.


Last modified: 04/06/2010
About Us | Contact Info | Archive Info | Disclaimer
Sponsored by NASA Cooperative Agreement Grant Number NNX08AO77A / Maintained by The HDF Group