MODIS Data at NSIDCHome | Data Summaries | Versions | Image Gallery | Order Data | News | V004 CMG Browse | Research | FAQs | Terra vs. Aqua |
![]() |
The MS2GT installation provides most of the files you will need for the tutorials. The tutorial shows the process you need to use to create the files when performing operations on data files. The MS2GT installation does not provide the data files, so you will need to find and order the data through the EDG.
In this tutorial, we want to put some MODIS 1 km sea ice swath data covering the western portion of the Ross Sea into a Polar Stereographic ellipsoidal projection centered at the south pole with the parallel of true scale set to 71 S. We want the vertical axis of the grid pointing due north towards the top of the grid and parallel to 180 E. We want the upper left corner of the grid at exactly 70 S 165 E and the lower right corner near 79 S 160 W. The grid resolution is 1 km and we want to use the WGS84 ellipsoid (equatorial radius of 6378.137 km and an eccentricity of 0.081819190843). We will grid all available MOD29 "channels."
We could simply order MOD29 data. As you can see in Supported Data Sets, the latlon data are stored at only 5-km resolution in MOD29 granules. We could have mod29.pl work with only the MOD29 granules (i.e. by setting latlonlistfile to "none"). We decide that 5-km resolution for the latlon data is good enough for our purposes, so we won't order any MOD03 granules.
NOTE: To run this example, you'll need a machine with at least 100 MB of memory and at least 200 MB of free disk space.
We know that January 24, 2001 was fairly clear over the western Ross Sea and that there was a significant amount of sea ice present, so we use the EDG to order two MOD29 granules acquired on January 24, 2001 at 1635 and 1640 that appear to cover the Ross Sea. Use the following values for performing the search using the EDG:
Data Set
MODIS/TERRA SEA ICE EXTENT 5-MIN L2 SWATH 1KM
Search Area
Type in Lat/Lon Range:
Northern latitude: -70.0000
Southern latitude: -79.0000
Western longitude: 165.0000
Eastern longitude: -160.0000
Start Date: 2001-10-24 Time (UTC): 16:00:00
End Date: 2001-10-24 Time (UTC): 17:00:00
The search should find two granules having the following names:
MOD29.A2001024.1635.002.2001089060137.hdf
MOD29.A2001024.1640.002.2001089060152.hdf
Note that January 24, 2001 is day-of-year 024.
Order and download the above files to some directory we'll call the tutorial_4 directory where you have at least 200 MB of free disk space. Note that you can also download the *.met files that accompany the *.hdf files, but the MS2GT software doesn't use them.
Create a text file in the tutorial_4 directory called wross_2001024_1635.csh containing the following line:
mod29.pl . wross_2001024_1635 listfile.txt WRoss1km.gpd 123456
This command specifies the following information (see mod29.pl):
| Parameter | Value | Description |
|---|---|---|
| dirinout | "." | The current directory will contain the input and output files when wross_2001024_1635.csh is invoked. |
| tag | wross_2001024_1635 | All output filenames containing gridded data created by mod29.pl will begin with the string "wross_2001024_1635". |
| listfile | listfile.txt | The text file contains a list of the MOD29 files to process. (See Creating the listfile.) |
| gpdfile | WRoss1km.gpd | The gdp file contains a specification of the grid and the associated map projection to use in gridding the data. (See Creating the gpd and mpp files.) |
| chanlist | 123456 | The text file specifies that all the MOD29 "channels" should be gridded. |
| latlonlistfile | not specified | The default value of "none" is used indicating that the 5 km latlon data in the MOD29 files should be used for geolocation. |
| keep | not specified | The default value of "0" is used, which indicates that intermediate chan, lat, lon, col, and row files are deleted. |
| rind | not specified | The default value of "50" is used. If you see holes in the final grid that seem to correspond to the boundaries between adjacent swath granules, then you can try increasing the rind value. |
Make wross_2001024_1635.csh executable by typing:
chmod +x wross_2001024_1635.csh
Create a text file called listfile.txt in the tutorial_4 directory containing the following two lines:
MOD29.A2001024.1635.002.2001089060137.hdf
MOD29.A2001024.1640.002.2001089060152.hdf
Note that we list the MOD29 files to be gridded.
See Points, Pixels, Grids, and Cells for a description of the gpd and mpp file formats used by the mapx library in defining a grid and its associated map projection. In Tutorial 3, we created gpd and mpp files from scratch, but we required an exact location for the center of the grid. Here we do something similar, but we specify an exact location for the center of the upper left cell. Start with creating the mpp file called S_stereo.mpp, in the ms2gt/grids directory (or copy S_stereo.mpp from the ms2gt/tutorial_4 directory to the ms2gt/grids directory):
Polar Stereographic ellipsoid
-90.0 0.0 -71.0 lat0 lon0 lat1
180.0
rotation
100.0
scale (km/map unit)
-90.00 0.00 center lat lon
-90.00 -20.00 lat min max
-180.00 180.00 lon min max
10.00 15.00 grid
0.00 0.00 label lat lon
1 0 0
cil bdy riv
6378.137 Earth equatorial
radius (km) -- wgs84
0.081819190843 eccentricity -- wgs84
In preparing the gpd file that defines the grid, we need to know following:
We now have all the information we need to create a preliminary gpd file called WRoss1km0.gpd in the ms2gt/grids directory (or copy WRoss1km0.gpd from the ms2gt/tutorial_4 directory to the ms2gt/grids directory):
S_stereo.mpp map projection parameters
# Western Ross Sea
1006 999 columns rows
# preliminary values
100
grid cells per map unit
# 1 km
0 0
origin column, row
# origin south pole initially
Once WRoss1km0.gpd has been created in the ms2gt/grids directory, use gtest to determine the negative grid coordinates of the center of the map:
gtest
enter .gpd file name: WRoss1km0.gpd
> assuming old style fixed format file
gpd: WRoss1km0.gpd
mpp:S_stereo.mpp
forward_grid:
enter lat lon: -70 165
col,row = -567.976929 -2119.718262 status = 0
lat,lon = -70.000000 164.999985 status = 1
enter lat lon:
inverse_grid:
enter r s:
enter .gpd file name:
You can see that the grid cell coordinates of the center of the map should be column 567.976929 and row 2119.718262. Edit WRoss1km0.gpd to create WRoss1km1.gpd in the ms2gt/grids directory with the above values (or copy WRoss1km1.gpd from the ms2gt/tutorial_4 directory to the ms2gt/grids directory):
S_stereo.mpp map projection parameters
# Western Ross Sea
1006 999 columns rows
# preliminary values
100
grid cells per map unit
# 1 km
567.976929 2119.718262 origin column, row
We still have only approximate values for the number of columns and rows. We use gtest again, this time with WRoss1km1.gpd, to find the grid coordinates of 79 S 160 W, which is close to the center of our lower right cell, and we'll use these grid coordinates to determine the final number of columns and rows for our grid:
gtest
enter .gpd file name: WRoss1km1.gpd
> assuming old style fixed format file
gpd: WRoss1km1.gpd
mpp:S_stereo.mpp
forward_grid:
enter lat lon: -79 -160
col,row = 977.960999 993.297119 status = 1
lat,lon = -79.000000 -160.000000 status = 1
enter lat lon:
inverse_grid:
enter r s:
enter .gpd file name:
So we see that our grid should have round(977.96099) + 1 = 979 columns and round(993.297119) + 1 = 994 rows. Edit WRoss1km1.gpd to create the final gpd file which we'll call WRoss1km.gpd in the ms2gt/grids directory where we have replaced the preliminary numbers of columns and rows with the values 979 and 994, respectively (or, if you don't want to type it in, copy WRoss1km.gpd from the ms2gt/tutorial_4 directory to the ms2gt/grids directory):
S_stereo.mpp map projection parameters
# Western Ross Sea
979 994 columns
rows
# Polar Stereographic
100
grid cells per map unit
# 1 km
567.976929 2119.718262 origin column, row
We now use gtest a third and final time to check that the upper left and lower right corners of WRoss1km.gpd are where they should be:
gtest
enter .gpd file name: WRoss1km.gpd
> assuming old style fixed format file
gpd: WRoss1km.gpd
mpp:S_stereo.mpp
forward_grid:
enter lat lon:
inverse_grid:
enter r s: 0 0
lat,lon = -70.000000 164.999985 status = 1
col,row = -0.000488 0.000000 status = 1
enter r s: 978 993
lat,lon = -78.997337 -160.003098 status = 1
col,row = 977.999878 993.000488 status = 1
enter r s:
enter .gpd file name:
You can see that the upper left corner values of -70.000000 164.999985 are essentially the same as our target values of 70 S and 165 E and that the lower right corner values of -78.997337 -160.003098 are very close to our target values of 79 S and 160 W.
Run the shell script containing the mod29.pl command by changing to the tutorial_4 directory, and then typing:
wross_2001024_1635.csh
You'll see messages display while the mod29.pl script runs various IDL and C programs.
In this example, the programs are:
The final message should contain the string:
MOD29: MESSAGE: done
Enter the command:
ls -l *.img
You should see something like this:
-rw-r--r-- 1 haran nsidc
973126 May 1 13:15 wross_2001024_1635_rawm_icer_00979_00994.img
-rw-r--r-- 1 haran nsidc
973126 May 1 13:16 wross_2001024_1635_rawm_icet_00979_00994.img
-rw-r--r-- 1 haran nsidc
973126 May 1 13:16 wross_2001024_1635_rawm_icrt_00979_00994.img
-rw-r--r-- 1 haran nsidc
973126 May 1 13:16 wross_2001024_1635_rawm_irqa_00979_00994.img
-rw-r--r-- 1 haran nsidc
973126 May 1 13:16 wross_2001024_1635_rawm_itqa_00979_00994.img
-rw-r--r-- 1 haran nsidc
1946252 May 1 13:16 wross_2001024_1635_rawm_temp_00979_00994.img
Each of the first five files listed contains a gridded array of 979 columns and 994 rows of binary byte values (979 * 994 * 1 = 973126 bytes). The sixth file listed (the "temp" or Ice Surface Temperature file), contains a gridded array of 979 columns and 994 rows of binary, 2-byte unsigned values (979 * 994 * 2 = 1946252 bytes).
The file naming convention for gridded MOD29 files is as follows:
<tag>_<conversion><weight_type>_<chan>_<columns>_<rows>.img