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

Home » Public Forums » archive » Re: Reprojecting an image file derived from Level 1B MODIS HDF
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: Reprojecting an image file derived from Level 1B MODIS HDF [message #74190] Mon, 03 January 2011 06:58
liamgumley is currently offline  liamgumley
Messages: 74
Registered: June 2005
Member
On Jan 2, 5:23 pm, Kasia <sia...@gmail.com> wrote:
> Hi,
>
> I have an image file that I created using IDL from a Level 1B MODIS
> HDF file. I now need to reproject this image file to display in Google
> Earth, but I'm having a hard time figuring out how to do this. The
> code that generated the image file also outputs a lat/lon for each
> value so I thought that would help since there is geographic
> information contained in the image file. But, that hasn't helped me.
>
> I've tried applying the header information from the original HDF file
> to the new image file using ENVI because I know it can read these
> MODIS files, but that hasn't worked too well. ENVI can reproject the
> MODIS HDF file beautifully but I also need it to do the same for the
> new image file.
>
> All of the projection and lat/lon information in the new image file is
> identical to that of the original MODIS HDF file that I can easily
> reproject in ENVI. I just can't figure out how to add that information
> to the image file so ENVI can do the same sort of magic on the new
> file.
>
> Any help would be greatly appreciated!
> Kasia

MRTSwath is an excellent tool for reprojecting MODIS L1B HDF4 swath
data:

https://lpdaac.usgs.gov/lpdaac/tools/modis_reprojection_tool _swath

If I was you, I would go directly from MODIS L1B HDF4 to
equirectangular projection using MRTSwath. This is the projection that
is used by Google Earth. The MRTSwath command line would look
something like this:

swath2grid -if=infile -gf=geofile -of=outfile -oproj="EQRECT" -kk=CC -
osp=8 -opsz=1000 -off=HDF_FMT

where

infile is the MODIS L1B HDF4 swath image file
geofile is the MODIS L1B HDF4 geolocation file
outfile is the reprojected HDF4 file

By default, MRTSwath will reproject all image arrays in the input
file, and store them in the output file.

If you are interested in creating true color MODIS images in tiled
JPEG format for Google Earth, you may wish to check out the "Direct
Broadcast Google Earth" or DBGE package available here:

http://cimss.ssec.wisc.edu/imapp/dbge_v1.2.shtml

DBGE reads MODIS Level 1B data and geolocation, and creates tiled
MODIS true color images at 250 meter resolution, along with the
Keyhole Markup Language (KML) files which allow the imagery to be
displayed in Google Earth. To make the MODIS images and KML files
viewable on the Internet, you will need a web server where the images
and KML files can be stored. It does not have to be the same system
where you run DBGE. Any computer which runs a web server (even a
Windows computer) may be used to serve the images to Google Earth.

The required input data for DBGE are MODIS Level 1B files in NASA HDF4
format:

MODIS Level 1B 1000 meter resolution (MOD021KM/MYD021KM),
MODIS Level 1B 500 meter resolution (MOD02HKM/MYD02HKM),
MODIS Level 1B 250 meter resolution (MOD02QKM/MYD02QKM),
MODIS Level 1B geolocation (MOD03/MYD03).
All four files are required for each granule or overpass of MODIS data
you wish to process with DBGE.

For an example of a real-time web page containing 250m true color
images along with the option to view them in Google Earth, please see
the University of Wisconsin Direct Broadcast MODIS today web page:

http://ge.ssec.wisc.edu/modis-today/

Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
Re: Reprojecting an image file derived from Level 1B MODIS HDF [message #74192 is a reply to message #74190] Mon, 03 January 2011 05:59 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Fabzou writes:

> Yes, but if this is easy with MODIS L2 products which are sinusoidal
> projection, the L1 products are swath files. I know the EOS_ routines
> provide easy tools to get the lat and lons for your grid but this is not
> very nice since the grid has no proper projection.
>
> Probably the EOS_ routines (or David Fannings Catalyst) provide methods
> to transform your swath files into a nice projection but I am not sure
> where to find those tools.

Yes, IDL typically gives you no help gridding or
projecting swath files. It is a weakness, in my opinion.
I think ms2gt is your answer here.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Reprojecting an image file derived from Level 1B MODIS HDF [message #74196 is a reply to message #74192] Mon, 03 January 2011 04:21 Go to previous message
Klemen is currently offline  Klemen
Messages: 80
Registered: July 2009
Member
Kasia,

there was a discussion, how to use ms2gt MODIS reprojection toolkit
months ago. I pasted there also some code that can be used in directly
IDL. The output is in geotiff that can be then read also in Google
Earth. The problem is, that the routine is slow if you want the output
to have the full MODIS resolution. See if it helps:
http://groups.google.com/group/comp.lang.idl-pvwave/browse_t hread/thread/688e9587fa29ecb7/2f7820d787d6047f?hl=en&lnk =gst&q=#2f7820d787d6047f

Cheers, Klemen
Re: Reprojecting an image file derived from Level 1B MODIS HDF [message #74197 is a reply to message #74196] Mon, 03 January 2011 02:19 Go to previous message
Fabzou is currently offline  Fabzou
Messages: 76
Registered: November 2010
Member
Hi,

On 01/03/2011 02:42 AM, David Fanning wrote:
> Kasia writes:
>
>> I have an image file that I created using IDL from a Level 1B MODIS
>> HDF file. I now need to reproject this image file to display in Google
>> Earth, but I'm having a hard time figuring out how to do this. The
>> code that generated the image file also outputs a lat/lon for each
>> value so I thought that would help since there is geographic
>> information contained in the image file. But, that hasn't helped me.
>>
>> I've tried applying the header information from the original HDF file
>> to the new image file using ENVI because I know it can read these
>> MODIS files, but that hasn't worked too well. ENVI can reproject the
>> MODIS HDF file beautifully but I also need it to do the same for the
>> new image file.
>>
>> All of the projection and lat/lon information in the new image file is
>> identical to that of the original MODIS HDF file that I can easily
>> reproject in ENVI. I just can't figure out how to add that information
>> to the image file so ENVI can do the same sort of magic on the new
>> file.
>
> Google Earth wants everything in a simple cylindrical
> projection with a WGS84 datum. I would just use Map_Proj_Image
> to warp your image, in its native projection, to a
> Cylindrical projection.

Yes, but if this is easy with MODIS L2 products which are sinusoidal
projection, the L1 products are swath files. I know the EOS_ routines
provide easy tools to get the lat and lons for your grid but this is not
very nice since the grid has no proper projection.

Probably the EOS_ routines (or David Fannings Catalyst) provide methods
to transform your swath files into a nice projection but I am not sure
where to find those tools.

Tell me if you find them!


Fabi
Re: Reprojecting an image file derived from Level 1B MODIS HDF [message #74199 is a reply to message #74197] Sun, 02 January 2011 17:42 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Kasia writes:

> I have an image file that I created using IDL from a Level 1B MODIS
> HDF file. I now need to reproject this image file to display in Google
> Earth, but I'm having a hard time figuring out how to do this. The
> code that generated the image file also outputs a lat/lon for each
> value so I thought that would help since there is geographic
> information contained in the image file. But, that hasn't helped me.
>
> I've tried applying the header information from the original HDF file
> to the new image file using ENVI because I know it can read these
> MODIS files, but that hasn't worked too well. ENVI can reproject the
> MODIS HDF file beautifully but I also need it to do the same for the
> new image file.
>
> All of the projection and lat/lon information in the new image file is
> identical to that of the original MODIS HDF file that I can easily
> reproject in ENVI. I just can't figure out how to add that information
> to the image file so ENVI can do the same sort of magic on the new
> file.

Google Earth wants everything in a simple cylindrical
projection with a WGS84 datum. I would just use Map_Proj_Image
to warp your image, in its native projection, to a
Cylindrical projection.

Here is an article that describes how this can be done:

http://www.dfanning.com/map_tips/warpimage.html

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: array handling
Next Topic: Random NetCDF I/O error

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

Current Time: Wed Oct 08 15:17:16 PDT 2025

Total time taken to generate the page: 0.00431 seconds