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

Home » Public Forums » archive » Plot radiances vs wavelengths
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Plot radiances vs wavelengths [message #93191 is a reply to message #93186] Tue, 10 May 2016 11:05 Go to previous messageGo to previous message
jiashenyue is currently offline  jiashenyue
Messages: 10
Registered: January 2013
Junior Member
On Monday, May 9, 2016 at 10:27:56 PM UTC-7, sami wrote:
> On Monday, May 9, 2016 at 9:30:53 PM UTC+2, jiash...@gmail.com wrote:
>> On Monday, May 9, 2016 at 7:35:03 AM UTC-7, sami wrote:
>>> Hi,
>>>
>>> I am working on MYD021KM data. I try to plot radiances vs wavelengths for one pixel (lat=", long=").I am using the 'EV_1KM_Emissive'.
>>> Unfortunately, I can't find how to extract the pixel value. I am still blocked. Please, does anywone know the procedure to do this? I really need your help.
>>>
>>> Thank you
>>
>> Hi Sami,
>>
>> Are you trying to ask how can you read the .hdf of this MODIS product?
>>
>> MODIS collection has a specific template you need to read the HDFs in IDL. You can find all the details about the template from the user's guide of this product. However, I have a shortcut that can save you so much time from all the hassles to create the template.
>>
>> I guess you have the access to ENVI. If so, download a tool called MCTK
>> https://github.com/dawhite/MCTK
>>
>> This tool is designed to read and reproject all kinds of MODIS HDFs. Make sure you are using the original file name of the HDF files, because MCTK needs the standard MODIS product ID and other information to read the HDF. This tool is based on ENVI and you can conveniently do a batch reading by running the functions of this tool in IDL. See the user's guide of MCTK for details.
>>
>> If the above method does not for you, you may also try another tool designed for this purpose. You don't need the ENVI license to run it:
>>
>> https://lpdaac.usgs.gov/tools/modis_reprojection_tool
>>
>> Good luck!
>>
>> Shenyue
>
> Hi,
>
> Thank you for your help. I have already used idl to read this MODIS data and to plot maps. I know all the specification about this data and how to convert radiances. The second step as I have said, I should plot radiances vs wavelengths for one pixel in the infrared and I cannot find a method or command to extract pixel value according to latitude and longitude.
>
> Thank you

Hi Sami,

I am going to give you a detailed description of how to solve this problem. Apologize if any of the information below sounds redundant or you've already known about it.

I am not sure if you are using a structure containing geographic information to save the data read into IDL, or you are just using a matrix storing all DN values, without dealing with the coordinate system?

The original MODIS data has its own specific coordinate system, and it is NOT lat and lon, although you can convert the MODIS projection coordinate system to lat and lon. But one thing to note is that the data you read from a MODIS file save all the pixels following the projection of MODIS. In other words, if you do want to display the data in lat and lon, you have to convert the coordinate of the pixels to lat and lon.

So that's why I am asking if you still have the geographic information saved to a structure so that you can make use of that. If you simply need to extract values based on the given coordinates (lat and lon) from the matrix with MODIS data, the most convenient and straightforward way is to make use of the following ENVI embedded routine:

ENVI_CONVERT_PROJECTION_COORDINATES, iXmap, iYmap, iProj, oXmap, oYmap, oProj [, INPUT_Z=array] [, OUTPUT_Z=variable]

ENVI_CONVERT_FILE_COORDINATES, FID, XF, YF, XMap, YMap [, /TO_MAP]

You can refer to the help document for the usage.

The first routine converts your lat and lon to the Map Coordinates of MODIS data. The second routine converts your current MODIS map coordinate (corresponding MODIS map coordinate to your original lat and lon) to the matrix col and row index. Remember to round XF and YF to a whole number so that you can use them to extract the value from the matrix.

The most important part of the second routine is that you have to make sure the FID points to an ENVI image, which includes the geographic coordinate information in the object and you WON'T have to deal with the projection and geographic coordinates ANYMORE.

I've done similar stuff before. In case I make a mistake when doing the conversion between projection on my own, I'd rather let ENVI embedded routines do it for me. So before doing any extraction, I converted the MODIS HDFs to ENVI images. This will keep the geographic and projection information in the ENVI header file.

If you don't have ENVI license, maybe you have to find functions associated with IDL to deal with the lat/lon to MODIS sinusoidal projection coordinates, then the col and row of your matrix. Whatever method you may use, the theory is the same. Always remember the MODIS data you've read into IDL are saved based on MODIS sinusoidal projection, not meaningless cols and rows or lat/lon.

If you only have to do this conversion for once, you can extract the col and row from a different software like QGIS/ArcGIS/ENVI, then use the cols and rows you've obtained as a look up table for your further extraction. The most important part here is still the projection of MODIS data. MODIS does not use a standard sinusoidal projection. It has its own elliptical parameters and thus a different cell size. If you have a ready-to-use TIFF file of MODIS product, I recommend load this data to QGIS, and obtain a shapefile of your lat and lon, then use the WARP tool in QGIS to get this projection conversion done. ArcGIS is not naturally embedded with a projection transformation between the lat/lon and MODIS sinusoidal projection. Doing this step in Arc will make discrepancy.

Feel free to post if you would like to get more details. I've spent a lot of time figuring this out on my own before so I know it actually sounds more complicated than you may expect.

Shenyue
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Using "tie points" in rasters
Next Topic: sqrt in legend() crossing power index

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

Current Time: Wed Oct 08 17:06:36 PDT 2025

Total time taken to generate the page: 0.00431 seconds