comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Modis Georeferencing
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Modis Georeferencing [message #53044] Sat, 17 March 2007 07:22 Go to next message
devin.white is currently offline  devin.white
Messages: 50
Registered: March 2007
Member
ENVI's MODIS georeferencing capabilities are only accessible through
the GUI. Why this is the case is a very long story. There is an
alternative approach you can use, though. To programmatically
georeference MODIS data (swaths only--grids are already
georeferenced), you could build a custom program that does the
following:

- Retrieves the Scientific Dataset (SD) of interest, by name, from the
MODIS HDF file
- Converts the SD from its stored byte or integer version to a
scientifically meaninful version (floating point, via scale and offset
factors stored in the SD)
- Retrieves the Longitude and Latitude geofields
- Uses the geofields to either (1) create tie points for warping using
Image to Map Registration, as in the GUI, or (2) create a Geographic
Lookup Table (GLT) which can be used to place each image pixel in its
proper location in a georeferenced output image. The latter is far
more accurate than the former and doesn't take much more time. It
also takes care of the infamous bowtie effect.

The above process is not straightforward, though. There are over 100
types of MODIS data and each type has its own set of products, spatial
extents, and spatial resolutions. Products can occur in two, three,
or even four dimensions. Three and four dimensional data can exist in
all three interleave types (BSQ, BIL, BIP). Files can contain more
than seven hundred valid SDs, although a dozen or so is more common.
To make matters more complicated, swath geofields can exist at a
different spatial resolution than the image data, so interpolation
becomes necessary to make the geofields work correctly. The geofields
are also sometimes stored in integer rather than floating point, so
they have to be converted before being used. In a few cases, the
geofields aren't even stored in the standard locations or under the
standard SD names. Then there's the challenge of accounting for the
International Dateline during the georeferencing process. Let's just
say that it is not fun. For grid data, the georeferencing has already
been taken care of, but the data and the georeferencing information
can be stored in ways that ENVI doesn't recognize as being valid so
little to none of your data will show up in the Available Bands List.
You can around this, but it is not easy. In other words, there is a
great deal that you have to account for when attempting to both
georeference MODIS data and open it in ENVI.

I've been working on a universal MODIS data conversion and
georeferencing tool for ENVI for a few weeks now and I have a
prototype up and running. Believe me, it was no small task to account
for the wide variability in MODIS data across the four communities
(Atmosphere, Land, Cryosphere, Oceans). At the moment, it works with
all but one type (MOD14), which is going to require some additional
special case coding due to how its datafields are constructed. It has
a GUI version (very simple at present), but is accessible
programmatically as well. All you have to provide is the full path to
the input file, an output path for the converted data, and yes/no
decision with respect to georeferencing. You get floating point
output, with all relevant scale and offset factors applied.
Georeferencing is handled via GLTs for swaths. Rather than suggesting
that you reinvent the wheel, I'd be happy to let you play with the
prototype as a beta tester. I could use the feedback. =)




On Mar 15, 9:06 am, raval.chin...@gmail.com wrote:
> Dear All,
>
> Does any one know how to georeference the Modis data programmatically
> in ENVI?
> I am not able to find any ENVI_MODIS_GEOREF_DOIT in envi routines
> though the routines to georeference the envisat, radarsat data are
> available.
>
> If it is not available, how can I georeference the Modis data
> programattically in ENVI?.
>
> -Chintan Raval
Re: Modis Georeferencing [message #53098 is a reply to message #53044] Wed, 21 March 2007 08:03 Go to previous message
BLesht is currently offline  BLesht
Messages: 89
Registered: March 2007
Member
Chitan,

Devin's GUI tool will be a welcome addition. I've played with an
early version using MODIS ocean data and it is fine for doing
interactive analysis - I haven't tried using it in batch mode,
though. The batch mode programming isn't that difficult using
existing ENVI routines, however. Assuming that you have ENVI+IDL, you
just open the MODIS hdf file, extract the data you want including
latitude and longitude using the HDF routines, write your data as an
ENVI file, open the ENVI file, create the GLT file, and georeference
using the GLT. Here is a extract from my code that does the above:

; Processing logic:
; 1. Write the calibrated MODIS L2 data to an ENVI
file in memory
; 2. Open that file
; 3. Create a GLT file mapping the original pixel
lat/lon to the standard projection (in memory)
; 4. Georeference the MODIS L2 data using the GLT
map (in memory)
; 5. Get map coordinages from geographic
definition of area of interest
; 6. Extract data from area of interest
; 7. Write extracted data
;
; geoData = calibrated data from original image
; enviName = ENVI file with calibrated data - mapped image
; geo_Points= A 16-element double floating array of geographic
coordinates for the four corners of the input data.
;
ENVI_WRITE_ENVI_FILE, geoData, BNAMES=geoNames,
GEOPOINTS=geo_Points, NB=nGeo, NL=nlines, NS=nsamps, $
/NO_OPEN,/IN_MEMORY, R_FID = fid1
ENVI_FILE_QUERY, fid1, NS=ns, NL=nl, NB=nb, DIMS=dims
;
ENVI_DOIT, 'ENVI_GLT_DOIT', DIMS=dims, I_PROJ=dataProj,
O_PROJ=gridProj, /IN_MEMORY, $
PIXEL_SIZE=pixel_size, R_FID=glt_FID, ROTATION=rotation,
$
X_FID=fid1, X_POS=xpos, Y_FID=fid1, Y_POS=ypos, /
NO_REALIZE
;
ENVI_FILE_QUERY, glt_Fid, DIMS=glt_dims, NS=nsglt, NL=nlglt
;
; At this point we've created the GLT file which gives the map
location for
; every pixel in the input file. Note the input file pixels are
referred to
; in a one-based coordinate system.
;
ENVI_DOIT, 'ENVI_GEOREF_FROM_GLT_DOIT', FID=fid1, GLT_DIMS=glt_dims,
GLT_FID=glt_FID, /IN_MEMORY, $
MIN_PIXELS=1, $
POS=LIndGen(nb), R_FID=map_FID
;

I hope this helps. Barry
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Manipulation using where
Next Topic: Re: spawn issue - was: open sockets

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 12:48:16 PDT 2025

Total time taken to generate the page: 0.39908 seconds