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

Home » Public Forums » archive » Re: Georefencing MODIS in ENVI batch mode!
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: Georefencing MODIS in ENVI batch mode! [message #67996] Fri, 11 September 2009 13:22
hethomas is currently offline  hethomas
Messages: 19
Registered: December 2008
Junior Member
Just incase anyone is interested, thanks to Devin and the people at
ITT technical support, I have managed to figure this out. I used the
MODIS Conversion Toolkit, but needed to set the NaN values to zero
(fill_replace_value=0, background=0), otherwise the decorrelation
stretch which I was doing after georeferencing would not work.

Thanks to everyone who replied.
Re: Georefencing MODIS in ENVI batch mode! [message #68001 is a reply to message #67996] Fri, 11 September 2009 02:58 Go to previous message
devin.white is currently offline  devin.white
Messages: 50
Registered: March 2007
Member
I'd recommend that you use the MODIS Conversion Toolkit (MCTK). It is
an ENVI plugin that was specifically designed for problems like this.
You can download it from the ITT VIS website:

http://www.ittvis.com/UserCommunity/CodeLibrary.aspx

Search for "MODIS" and it will be one of the first entries in the
returned list. I received your email about this, too, and replied
with the above recommendation.


On Sep 10, 8:05 am, hethomas <het...@googlemail.com> wrote:
> Hi all, I am seriously hoping someone out there can help me with
> this .  I am trying to georeference MODIS L1B hdf files using envi
> batch mode. I found a bit about this on the net (particularly the
> Ocean Color forums) and have tried to emulate their method, although
> as they wern't using L1B, I think I am encountering some sort of
> additional issue.
> What I have so far is pasted below. This actually does output a
> georeferenced-looking file, however the values are somewhat different
> to the result if I georeference it with ENVI normally.  I think the
> issue is either in making the GLT, or in the georeferencing itself.
> (nb.  I also tried the MODIS Conversion Toolkit, which georeferences
> the file just fine, but as it converts it to a .img is not suitable
> for what I need)
>
> Any help greatly appreciated,
> Cheers,
> Helen
>
> open lon file
>     ENVI_OPEN_DATA_FILE, filename, r_fid=x_fid, /hdf_sd,
> hdfsd_dataset=1, hdfsd_interleave=0
>       if (x_fid eq -1) then begin
>        envi_batch_exit
>        return
>       endif
>     ENVI_FILE_QUERY, x_fid, ns=xns, nl=xnl, nb=xnb
>     x_pos=lindgen(xnb)
>     xdims=[-1L, 0, xns-1, 0, xnl-1]
>
>     ;open lat file
>     ENVI_OPEN_DATA_FILE, filename, r_fid=y_fid, /hdf_sd,
> hdfsd_dataset=0, hdfsd_interleave=0
>       if (y_fid eq -1) then begin
>        envi_batch_exit
>        return
>      endif
>     ENVI_FILE_QUERY, y_fid, ns=yns, nl=ynl, nb=ynb
>     y_pos=lindgen(ynb)
>     ydims=[-1L, 0, yns-1, 0, ynl-1]
>
>     ;open file
>     ENVI_OPEN_DATA_FILE, filename, r_fid=therm_fid, /hdf_sd,
> hdfsd_dataset=4, hdfsd_interleave=0
>       if (therm_fid eq -1) then begin
>        envi_batch_exit
>        return
>       endif
>     ENVI_FILE_QUERY, therm_fid, ns=ns, nl=nl, nb=nb,
> data_type=data_type, bnames=bnames
>     pos=lindgen(nb)
>     dims=[-1L,0, ns-1, 0, nl-1]
>
> ;CD TO THE OUTPUT DIRECTORY
> cd, Outputdir
>
> ;  Figure out what UTM zone we're in.
> lat_data=envi_get_data(fid=y_fid, dims=ydims, pos=0)
> lon_data=envi_get_data(fid=x_fid, dims=xdims, pos=0)
>
> lat_lon=[lat_data, lon_data]
> zone = fix(31.0 + lat_lon[1]/6.0)
> south = (lat_lon[0] lt 0)
>
> nlat=  n_elements(lat_data)
> nlon = n_elements(lon_data)
> lat=mean(lat_data)      ;find the average (so approx center of image) to
> define the UTM zone.
> lon=mean(lon_data)
>
> LongTemp = (Lon+180)-fix((Lon+180)/360)*360-180; // -180.00 .. 179.9
>
> ZoneNumber = FIX((LongTemp + 180.0)/6.0) + 1
>
> if Lat GE 56.0 AND Lat LE 64.0 AND LongTemp GE 3.0 AND LongTemp LE
> 12.0 then ZoneNumber = 32
>
> ;special zones for Svalbard
> IF lat GE 72.0 and lat LE 84.0 then begin
>         if longtemp ge 0.0 and longtemp lt 9.0 then zonenumber =32
>         if longtemp GE 9.0 and longtemp lt 21.0 then zonenumber = 33
>         if longtemp ge 21.0 and longtemp lt 33.0 then zonenumber = 35
>         if longtemp ge 33.0 and longtemp lt 42.0 then zonenumber = 37
> ENDIF
>
> south = (lat lt 0)
>
> ;  Make the GLT.
> zone=zonenumber
> envi_file_query, therm_fid, sname=sname
> out_name1='GLT_file_'+fname
> ;pixel_size=[1000.0, 1000.0]
> rotation=0.0
> i_proj = envi_proj_create(/geographic)
> o_proj = envi_proj_create(/utm, zone=zone, south=south)
>
>     envi_glt_doit, i_proj=i_proj, o_proj=o_proj, out_name=out_name1,
> r_fid=glt_fid,$
>     x_fid=x_fid, y_fid=y_fid, x_pos=0, y_pos=0,pixel_size=pixel_size,
> rotation=rotation
>
> ;therm_fid contains all the emissive bands.We only need bands 29-32
> for the SO2 retrieval.
>
> t_fid=
> [therm_fid,therm_fid,therm_fid,therm_fid,therm_fid,therm_fid ,therm_fid,ther­m_fid,therm_fid,therm_fid,
> $
> therm_fid,therm_fid,therm_fid,therm_fid,therm_fid,therm_fid, therm_fid]
>
> t_pos=[11,10,9,8]
>
> ;  Georeference the image from the GLT.
> out_name2=fname+'georefferenced'
> envi_doit, 'envi_georef_from_glt_doit', fid=t_fid, $
>    glt_fid=glt_fid, out_name=out_name2, pos=t_pos, $
>    subset=dims, r_fid=r_fid
Re: Georefencing MODIS in ENVI batch mode! [message #68011 is a reply to message #68001] Thu, 10 September 2009 07:07 Go to previous message
lbusett@yahoo.it is currently offline  lbusett@yahoo.it
Messages: 30
Registered: February 2006
Member
Hi Helen,

I suggest you to use of the MODIS REPROJECTION SWATH TOOL
( https://lpdaac.usgs.gov/lpdaac/tools/modis_reprojection_tool _swath)

It allows georeferencing, reprojection and resizing of MODIS L1B
images providing both HDF and TIFF output.
Moreover, it has a command line interface that allows to process
sequentially a large number of images by using a simple batch file, or
by calling the tool with a SPAWN command from a IDL process cycling
on input file names.

Hope this helps,


Lorenzo
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL on the web?
Next Topic: issues with scrollwindow

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

Current Time: Wed Oct 08 16:52:33 PDT 2025

Total time taken to generate the page: 0.00644 seconds