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

Home » Public Forums » archive » calling MRT Swath from IDL
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
calling MRT Swath from IDL [message #87641] Thu, 20 February 2014 11:20 Go to next message
lhashemi is currently offline  lhashemi
Messages: 9
Registered: February 2014
Junior Member
Hi

Do you know how to call MRT Swath from IDL? I need it for reading , processing and writing a MOD02HKM (modis level 1b, 500 m).

Thanks
LH
Re: calling MRT Swath from IDL [message #87642 is a reply to message #87641] Thu, 20 February 2014 11:26 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
lhashemi@g.harvard.edu writes:

> Do you know how to call MRT Swath from IDL? I need it for reading , processing and writing a MOD02HKM (modis level 1b, 500 m).

I guess I'd use the SPAWN command. That's the usual way of calling
third-party software.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: calling MRT Swath from IDL [message #87649 is a reply to message #87642] Thu, 20 February 2014 14:21 Go to previous messageGo to next message
lhashemi is currently offline  lhashemi
Messages: 9
Registered: February 2014
Junior Member
>
> I guess I'd use the SPAWN command. That's the usual way of calling
>
> third-party software.
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")


Thanks David, it works.

another question: using some IDL codes from NASA website I've read MOD02KHM (500 m) data as an array of reflectance for each band (no longitude and attitude is assigned).using metadata I generate the long/lat of the bounding box(upper left and lower left, upper right and lower right long and lat). is there a way to convert the array and bounding box to a Geotiff? the problem is the pixel size is not fix.

on the other hand, I've read and convert MOD02KHM to Geotiff by Gdal, but the value needs to convert to reflectance and I don't know how to do it.

can anybody help me with this

Thanks
LH
Re: calling MRT Swath from IDL [message #87650 is a reply to message #87649] Thu, 20 February 2014 15:11 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
lhashemi@g.harvard.edu writes:

> another question: using some IDL codes from NASA website I've read MOD02KHM (500 m) data as an array of reflectance for each band (no longitude and attitude is assigned).using metadata I generate the long/lat of the bounding box(upper left and lower left, upper right and lower right long and lat). is there a way to convert the array and bounding box to a Geotiff? the problem is the pixel size is not fix.
>
> on the other hand, I've read and convert MOD02KHM to Geotiff by Gdal, but the value needs to convert to reflectance and I don't know how to do it.

I don't understand what you mean. You say the MOD02KHM is an array of
reflectance values. How do they become something else when GDAL puts
them into a different file with a map projection?

And, doesn't GDAL require arrays of latitude and longitude (MOD03 files)
to do the conversion? I can't see how it could possibly work without
these values.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: calling MRT Swath from IDL [message #87652 is a reply to message #87650] Thu, 20 February 2014 16:56 Go to previous messageGo to next message
lhashemi is currently offline  lhashemi
Messages: 9
Registered: February 2014
Junior Member
> I don't understand what you mean. You say the MOD02KHM is an array of
>
> reflectance values. How do they become something else when GDAL puts
>
> them into a different file with a map projection?
>
>
>
> And, doesn't GDAL require arrays of latitude and longitude (MOD03 files)
>
> to do the conversion? I can't see how it could possibly work without
>
> these values.
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

Gdal read the data correctly, however, the data are raw integer counts , I need to convert the data to floating-point corrected counts for my process. and I don't know how to do it? (this process needs an offset and scale, and I don't know where these data are located).

as I mentioned I got some IDL codes from NASA website for reading the data and converting them to floating-point corrected counts. however the result is an array for each band without any long/lat associated. I am looking for an idl code to re-project this arrays.

MOD02HKM (500 m) contains an array of long/lat (1000 m), I think it doesn't need MOD03 for re-projection (I'm not sure though). It should involve interpolation for generating long/lat for each pixel of data array or for a user defied grid.

I want to read, process and write MOD02HKM. I am looking either for an idl code to re-project the data (read by some other IDL codes) or for an idl code to convert the raw integer number to floating corrected values (so I can use gdal for re-projection or MRTSwath). Any help would highly appreciated.

Thanks
LH
Re: calling MRT Swath from IDL [message #87656 is a reply to message #87652] Thu, 20 February 2014 20:14 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
lhashemi@g.harvard.edu writes:

> Gdal read the data correctly, however, the data are raw integer counts , I need to convert the data to floating-point corrected counts for my process. and I don't know how to do it? (this process needs an offset and scale, and I don't know where these data are located).
>
> as I mentioned I got some IDL codes from NASA website for reading the data and converting them to floating-point corrected counts. however the result is an array for each band without any long/lat associated. I am looking for an idl code to re-project this arrays.
>
> MOD02HKM (500 m) contains an array of long/lat (1000 m), I think it doesn't need MOD03 for re-projection (I'm not sure though). It should involve interpolation for generating long/lat for each pixel of data array or for a user defied grid.
>
> I want to read, process and write MOD02HKM. I am looking either for an idl code to re-project the data (read by some other IDL codes) or for an idl code to convert the raw integer number to floating corrected values (so I can use gdal for re-projection or MRTSwath). Any help would highly appreciated.

I happen to have one of those files here, and when I open it with
ncdf_browser (which also reads HDF files), it appears the latitude,
longitude, bands, and offsets are all present in the file. If you just
pass the file name to GDAL, it probably gets everything it needs from
the file itself.

To "calibrate" the data, you just multiply it by the scale factor and
add the offset. All this information should be available to you in the
documentation available on the MODIS web page.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: calling MRT Swath from IDL [message #87700 is a reply to message #87656] Sun, 23 February 2014 19:07 Go to previous message
devin.white is currently offline  devin.white
Messages: 50
Registered: March 2007
Member
On Thursday, February 20, 2014 11:14:22 PM UTC-5, David Fanning wrote:
> lhashemi@g.harvard.edu writes:
>
>
>
>> Gdal read the data correctly, however, the data are raw integer counts , I need to convert the data to floating-point corrected counts for my process. and I don't know how to do it? (this process needs an offset and scale, and I don't know where these data are located).
>
>>
>
>> as I mentioned I got some IDL codes from NASA website for reading the data and converting them to floating-point corrected counts. however the result is an array for each band without any long/lat associated. I am looking for an idl code to re-project this arrays.
>
>>
>
>> MOD02HKM (500 m) contains an array of long/lat (1000 m), I think it doesn't need MOD03 for re-projection (I'm not sure though). It should involve interpolation for generating long/lat for each pixel of data array or for a user defied grid.
>
>>
>
>> I want to read, process and write MOD02HKM. I am looking either for an idl code to re-project the data (read by some other IDL codes) or for an idl code to convert the raw integer number to floating corrected values (so I can use gdal for re-projection or MRTSwath). Any help would highly appreciated.
>
>
>
> I happen to have one of those files here, and when I open it with
>
> ncdf_browser (which also reads HDF files), it appears the latitude,
>
> longitude, bands, and offsets are all present in the file. If you just
>
> pass the file name to GDAL, it probably gets everything it needs from
>
> the file itself.
>
>
>
> To "calibrate" the data, you just multiply it by the scale factor and
>
> add the offset. All this information should be available to you in the
>
> documentation available on the MODIS web page.
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")


You can also try the MODIS Conversion Toolkit (MCTK). It's written in IDL, leverages ENVI, and works with every known product. It used to be available in the Exelis VIS code library. When that went down a few months ago, I moved all of my plugins over to GitHub:

https://github.com/dawhite/ENVIPlugins

MCTK is the first entry on the list. The user guide that comes in the zip file will walk you through how to drive it.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: possible cgContour bug
Next Topic: fitting using maximum likelihood

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

Current Time: Wed Oct 08 11:35:51 PDT 2025

Total time taken to generate the page: 0.00445 seconds