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 
Switch to threaded view of this topic Create a new topic Submit Reply
Plot radiances vs wavelengths [message #93178] Mon, 09 May 2016 07:35 Go to next message
sami[1] is currently offline  sami[1]
Messages: 7
Registered: April 2016
Junior Member
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
Re: Plot radiances vs wavelengths [message #93181 is a reply to message #93178] Mon, 09 May 2016 12:30 Go to previous messageGo to next message
jiashenyue is currently offline  jiashenyue
Messages: 10
Registered: January 2013
Junior Member
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
Re: Plot radiances vs wavelengths [message #93186 is a reply to message #93181] Mon, 09 May 2016 22:27 Go to previous messageGo to next message
sami[1] is currently offline  sami[1]
Messages: 7
Registered: April 2016
Junior Member
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
Re: Plot radiances vs wavelengths [message #93191 is a reply to message #93186] Tue, 10 May 2016 11:05 Go to previous messageGo to next 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
Re: Plot radiances vs wavelengths [message #93196 is a reply to message #93191] Wed, 11 May 2016 10:32 Go to previous messageGo to next message
zacharyanorman is currently offline  zacharyanorman
Messages: 17
Registered: July 2015
Junior Member
I think it might also be worth pointing out that you can convert coordinates in the new ENVI API very easily. Here is a link to the documentation for converting file coordinates to map coordinates and convertin map coordinates to lon/lat:


https://www.harrisgeospatial.com/docs/envistandardrasterspat ialref__convertfiletomap.html

https://www.harrisgeospatial.com/docs/ENVIStandardRasterSpat ialRef__ConvertMapToLonLat.html

If you look on the right side of the screen there will also be a list of the other methods you can do with spatial references in the new ENVI API.


-Zach (VIS)
Re: Plot radiances vs wavelengths [message #93203 is a reply to message #93196] Wed, 11 May 2016 20:27 Go to previous messageGo to next message
jiashenyue is currently offline  jiashenyue
Messages: 10
Registered: January 2013
Junior Member
On Wednesday, May 11, 2016 at 10:32:33 AM UTC-7, Zachary Norman wrote:
> I think it might also be worth pointing out that you can convert coordinates in the new ENVI API very easily. Here is a link to the documentation for converting file coordinates to map coordinates and convertin map coordinates to lon/lat:
>
>
> https://www.harrisgeospatial.com/docs/envistandardrasterspat ialref__convertfiletomap.html
>
> https://www.harrisgeospatial.com/docs/ENVIStandardRasterSpat ialRef__ConvertMapToLonLat.html
>
> If you look on the right side of the screen there will also be a list of the other methods you can do with spatial references in the new ENVI API.
>
>
> -Zach (VIS)

Yeh, Sami, I don't want to confuse you. The API Zach mentioned does exactly the same thing as I told you. The only difference is that we are using two different styles of programming. I have not switched to the new ENVI API now and still use the old fashioned way for ENVI/IDL programming. Anyway, if you are more familiar with the new API, go for it. The most important thing of doing this task is to understand your MODIS data are saved using MODIS projection, and if you want to retrieve data based on a series of lat and lon, you have to do it in 2 steps:

1. Convert your lat/lon to the corresponding coordinates of MODIS projection
2. Convert the map coordinates (MODIS projection coordinates) to image col and row.

Shenyue
Re: Plot radiances vs wavelengths [message #93209 is a reply to message #93203] Thu, 12 May 2016 12:48 Go to previous messageGo to next message
sami[1] is currently offline  sami[1]
Messages: 7
Registered: April 2016
Junior Member
On Thursday, May 12, 2016 at 5:27:09 AM UTC+2, SHENYUE JIA wrote:
> On Wednesday, May 11, 2016 at 10:32:33 AM UTC-7, Zachary Norman wrote:
>> I think it might also be worth pointing out that you can convert coordinates in the new ENVI API very easily. Here is a link to the documentation for converting file coordinates to map coordinates and convertin map coordinates to lon/lat:
>>
>>
>> https://www.harrisgeospatial.com/docs/envistandardrasterspat ialref__convertfiletomap.html

Thank for your help. I have solved the problem.
>>
>> https://www.harrisgeospatial.com/docs/ENVIStandardRasterSpat ialRef__ConvertMapToLonLat.html
>>
>> If you look on the right side of the screen there will also be a list of the other methods you can do with spatial references in the new ENVI API.
>>
>>
>> -Zach (VIS)
>
> Yeh, Sami, I don't want to confuse you. The API Zach mentioned does exactly the same thing as I told you. The only difference is that we are using two different styles of programming. I have not switched to the new ENVI API now and still use the old fashioned way for ENVI/IDL programming. Anyway, if you are more familiar with the new API, go for it. The most important thing of doing this task is to understand your MODIS data are saved using MODIS projection, and if you want to retrieve data based on a series of lat and lon, you have to do it in 2 steps:
>
> 1. Convert your lat/lon to the corresponding coordinates of MODIS projection
> 2. Convert the map coordinates (MODIS projection coordinates) to image col and row.
>
> Shenyue
Re: Plot radiances vs wavelengths [message #93210 is a reply to message #93203] Thu, 12 May 2016 12:49 Go to previous message
sami[1] is currently offline  sami[1]
Messages: 7
Registered: April 2016
Junior Member
On Thursday, May 12, 2016 at 5:27:09 AM UTC+2, SHENYUE JIA wrote:
> On Wednesday, May 11, 2016 at 10:32:33 AM UTC-7, Zachary Norman wrote:
>> I think it might also be worth pointing out that you can convert coordinates in the new ENVI API very easily. Here is a link to the documentation for converting file coordinates to map coordinates and convertin map coordinates to lon/lat:
>>
>>
>> https://www.harrisgeospatial.com/docs/envistandardrasterspat ialref__convertfiletomap.html
>>
>> https://www.harrisgeospatial.com/docs/ENVIStandardRasterSpat ialRef__ConvertMapToLonLat.html
>>
>> If you look on the right side of the screen there will also be a list of the other methods you can do with spatial references in the new ENVI API.
>>
>>
>> -Zach (VIS)
>
> Yeh, Sami, I don't want to confuse you. The API Zach mentioned does exactly the same thing as I told you. The only difference is that we are using two different styles of programming. I have not switched to the new ENVI API now and still use the old fashioned way for ENVI/IDL programming. Anyway, if you are more familiar with the new API, go for it. The most important thing of doing this task is to understand your MODIS data are saved using MODIS projection, and if you want to retrieve data based on a series of lat and lon, you have to do it in 2 steps:
>
> 1. Convert your lat/lon to the corresponding coordinates of MODIS projection
> 2. Convert the map coordinates (MODIS projection coordinates) to image col and row.
>
> Shenyue

Thank you for your help. I have solved the problem.
  Switch to threaded view of this topic Create a new topic Submit Reply
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 15:12:16 PDT 2025

Total time taken to generate the page: 0.00840 seconds