IDL (Interactive Data Language) is a programming language for scientific analysis and visualization. IDL provides APIs for reading and writing several file formats including HDF5 . This page presents a few examples on how to read and visualize HDF-EOS5 MLS data via IDL.
IDL provides a set of functions for handling HDF5 files. Since each of them is equivalent to an
HDF5 C API, those who are familiar with the HDF5 library can easily learn
how to handle HDF5 files in IDL. For example, H5F_OPEN
, H5D_OPEN
and
H5D_READ
are equivalent to H5Fopen
, H5Dopen
and H5Dread
,
respectively.
HDF-EOS5 MLS L2 data is special in that it has n points of vertical profiles. The location of each point stored in 1-D lat/lon arrays that have n dimension size.
To access a dataset in an HDF5 file, first open the enclosing HDF-EOS5 MLS file using
H5F_OPEN
. Then, using the descriptor returned by that API, open the dataset.
Since MLS holds the data values inside the L2gpValue dataset, you need to open and read it along with Latitude, Longitude, and Pressure dataset as shown in example(Figure 1).
Once all datasets are read, you pick one location. As shown in Figure 2,
we pick the location at array index 0 in this example.
The la0
and lo0
hold the values of latitude and longitude on that location.
The *
in val[*,0]
retrieves all data values on different levels
stored in lev
at location 0. Finally, we re-scales data values and levels
to generate a easy-to-read graph.
plot
command draws a vertical profile graph from the L2gpValue dataset.
After finishing processing all datasets, one needs to close the file using H5F_CLOSE
(Figure 3).
See the complete code here. Download the sample file. Run the code as follows:
Figure 5 shows the result.