HDF

advertisement
A Matlab tutorial in
working with HDF files
Overview
 Description of HDF data format

Programs available for visualizing and manipulating data

Features of HDF view and how/where to download

Introduction to case study and tasks for this lab

Ordering data

Reading HDF files into Matlab

Matlab coding exercises

Getting familiar with Giovanni (time permitting)
Basics of HDF data format
HDF (Hierarchical Data Format) is a library and multi-object file
format for storing and managing data between machines.
Two versions: HDF4 and HDF5. HDF-EOS specifically for EOS
satellites (Terra, Aqua and Aura)
Important features:

Self-describing;

Can store swaths, grids, in-situ data, instrument metadata, and
browse image in a single file;

No limits on size or number of data objects;

Support parallel I/O, multiple platforms and API with
C/C++/Fortran/Java/Matlab interfaces
Programs for HDF files:
http://www.hdfgroup.org/tools.html
Free*







HDF View*
IDL
Matlab
Pomegranate*
Igor Pro
GrADS*
Panpoly*
HDF View :Screenshot of main window
Menu and tool bar
Data panel
Tree panel
Info panel
Getting HDF View
Free download link for WIN/MAC/LINUX:
http://www.hdfgroup.org/hdf-javahtml/hdfview/index.html
User guide:
http://www.hdfgroup.org/hdf-javahtml/hdfview/UsersGuide/index.html
Case study for lab: 2009 Eruption of Mt. Redoubt
Tasks
1. Working with HDF files from MODIS:
a. Retrieve Terra MODIS Level 2 AOD’s at 550 nm for April 4, 2009 at 2220 UTC.
http://ladsweb.nascom.nasa.gov/data/search.html
http://modis.gsfc.nasa.gov/
b. Use Matlab to make a contour plot of AOD, with latitude on the Y-axis and
longitude on the X-axis. Be sure to add the coastline to your plot.
c. What are the ranges of AOD in your plot? What is the mean AOD?
Based on this information, was the event observed in the satellite data a strong
volcanic event?
2. Working with HDF files from OMI (time permitting):
a. Retrieve Aura OMI Level 3 AI (UV aerosol index) for April 4, 2009 from Giovanni
http://disc.sci.gsfc.nasa.gov/giovanni/overview/giovanni-parameters
b. Using Matlab, make a contour plot of AI, with latitude on the Y-axis and
longitude on the X-axis. Load the coast.
c. From the plot, which regions of the plume would you expect to be most rich in
ash?
Task 1a: Retrieving Terra MODIS Level 2 AOD
Task 1b: Reading MODIS HDF files into Matlab
clear
% reading in file
MODIS_ID = hdfsd ('start','filename.hdf', 'read');
% extract info about file description
[numdata, numdescr] = hdfsd ('fileinfo', MODIS_ID);
% assigning dataset ID(s)
AODid = hdfsd ('select', MODIS_ID, 9);
longid = hdfsd ('select', MODIS_ID, 0);
latid = hdfsd ('select', MODIS_ID, 1);
% extracting info from dataset
[name,numdim,dimvector,type,numdescr] = hdfsd('getinfo', AODid)
[name,numdim,dimvector,type,numdescr] = hdfsd('getinfo', longid)
[name,numdim,dimvector,type,numdescr] = hdfsd('getinfo', latid)
% Reading HDF datasets and importing into Matlab
startvector = [0 0];
endvector = dimvector;
stride = [];
AODvar = hdfsd('readdata', AODid, startvector, stride, endvector);
longvar = hdfsd('readdata', longid, startvector, stride, endvector);
latvar = hdfsd('readdata', latid, startvector, stride, endvector);
Tasks 1b & c: On your own or in groups
Steps and hints to problems:
1c. The plot:
• Change AOD fill values (-9999) to not a number (NaN)
• Don’t forget to multiply AOD by a scale factor of 0.001
• You will need to subtract 360 degrees from all values of
longitude that are greater than 0 to remap on a linear
scale.
• Use Matlab help. For example, type: help contourf
to gather more information on contourf.
1d. Based on the max/min and mean values of AOD for this
event, what might this mean about the strength of the
eruption? Hint: Fresh plumes from strong eruptions can
have AOD’s as high as those for meteorological clouds,
which can be in the 100’s.
April 4 AOD
Task 2a: Getting OMI AI data from Giovanni
Task 2b: Reading OMI data into Matlab
clear
% reading in file
OMI_ID = hdfsd ('start','filename.hdf, 'read');
% extract info about file description
[numdata, numdescr] = hdfsd ('fileinfo', OMI_ID);
% assigning dataset ID(s)
AIid = hdfsd ('select', OMI_ID, 0)
% extracting info from dataset
[name,numdim,dimvector,type,numdescr] = hdfsd('getinfo', AIid)
% Reading HDF datasets and importing into Matlab
startvector = [0 0];
endvector = dimvector;
stride = [];
AIvar = hdfsd('readdata', AIid, startvector, stride, endvector);
Task 2b & c: On your own
Steps and hints to problems:
1c. The plot:
• Longitude and latitude are not included in this hdf file.
You will need to calculate your own based on the
dimensions of the AI matrix and the long/lat ranges
(-180 to -136 longitude; 67 to 47 latitude)
• Remember to remove AI fill values
(for this dataset, fill value < -1 X 1030)
• You may notice when you plot this data that it needs to
be flipped about the x and/or y-axis to get the correct
orientation.
1d. Where would you expect to find the areas most rich in ash?
Hint: OMI AI serves as a qualitative indicator of the
presence of UV absorbing aerosols, such as ash.
April 4 OMI AI
Download