Read particular band from air temperature image among MOD07 air products - Idl-pvwave
This is a discussion on Read particular band from air temperature image among MOD07 air products - Idl-pvwave ; Goodday, Everyone! I would like to ask how to process MODIS 07 air
product.
I am working on 3D-MOD07 image. As most of you may know, the dimension
of this file is, at least in my knowledge....
sample number(ns): 270, ...
-
Read particular band from air temperature image among MOD07 air products
Goodday, Everyone! I would like to ask how to process MODIS 07 air
product.
I am working on 3D-MOD07 image. As most of you may know, the dimension
of this file is, at least in my knowledge....
sample number(ns): 270, Line number(nl): 406, 그리고 band number(nb): 20
In order to get the map of band20, I wrote a source code below, but
this procedure is not working properly.
-----------------------------
pro test
close, /all
ns = 270
nl = 406
nb =20
file = 'MOD072003001.0130_Ta_5km.img'
openr, 1, file
image = bytarr(ns, nl, nb)
readu, 1, image
close, 1
tvscl, image(*, *, 19)
end
-----------------------
In my opinion, there must be something wrong at this line shown
below...
"image = bytarr(ns, nl, nb)"
However, I don't know how to solve this problem... I tried read_jpg,
and read_gif instead of bytarr, but all of these trials were not so
successful.
Please give me any suggestions. Thanks.
Harry
-
Re: Read particular band from air temperature image among MOD07 air products
DirtyHarry writes:
> Goodday, Everyone! I would like to ask how to process MODIS 07 air
> product.
> In my opinion, there must be something wrong at this line shown
> below...
>
> "image =3D bytarr(ns, nl, nb)"
>
> However, I don't know how to solve this problem... I tried read_jpg,
> and read_gif instead of bytarr, but all of these trials were not so
> successful.
>
> Please give me any suggestions.
I think the problem might have occurred earlier, when you
assumed satellite data would be packaged in a form that is
easily digested by IDL.
My suggestion would be to get onto a MODIS web page and
spend a few minutes reading about their data products.
Who knows what useful information might turn up!
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: Read particular band from air temperature image among MOD07 air products
On Jun 15, 2:00 pm, DirtyHarry <kim20...@gmail.com> wrote:
> Goodday, Everyone! I would like to ask how to process MODIS 07 air
> product.
>
> I am working on 3D-MOD07 image. As most of you may know, the dimension
> of this file is, at least in my knowledge....
>
> sample number(ns): 270, Line number(nl): 406, 그리고band number(nb): 20
>
> In order to get the map of band20, I wrote a source code below, but
> this procedure is not working properly.
>
> -----------------------------
> pro test
> close, /all
> ns = 270
> nl = 406
> nb =20
> file = 'MOD072003001.0130_Ta_5km.img'
> openr, 1, file
>
> image = bytarr(ns, nl, nb)
> readu, 1, image
> close, 1
>
> tvscl, image(*, *, 19)
>
> end
>
> -----------------------
> In my opinion, there must be something wrong at this line shown
> below...
>
> "image = bytarr(ns, nl, nb)"
>
> However, I don't know how to solve this problem... I tried read_jpg,
> and read_gif instead of bytarr, but all of these trials were not so
> successful.
>
> Please give me any suggestions. Thanks.
>
> Harry
At the very least, you also need to know the file's interleave, so
that you can make sure you are reading the data into memory in the
correct order.
Jeff
-
Re: Read particular band from air temperature image among MOD07 air products
DirtyHarry wrote:
> Goodday, Everyone! I would like to ask how to process MODIS 07 air
> product.
>
> I am working on 3D-MOD07 image. As most of you may know, the dimension
> of this file is, at least in my knowledge....
>
> sample number(ns): 270, Line number(nl): 406, 그리고band number(nb): 20
>
> In order to get the map of band20, I wrote a source code below, but
> this procedure is not working properly.
>
> -----------------------------
> pro test
> close, /all
> ns = 270
> nl = 406
> nb =20
> file = 'MOD072003001.0130_Ta_5km.img'
> openr, 1, file
>
> image = bytarr(ns, nl, nb)
> readu, 1, image
> close, 1
>
> tvscl, image(*, *, 19)
>
> end
>
> -----------------------
> In my opinion, there must be something wrong at this line shown
> below...
>
> "image = bytarr(ns, nl, nb)"
>
> However, I don't know how to solve this problem... I tried read_jpg,
> and read_gif instead of bytarr, but all of these trials were not so
> successful.
Like all MODIS products, MOD07 is in HDF-EOS format, which is built on
top of HDF. IDL provides wrappers for all of the HDF and HDF-EOS
library functions, and you should be using those routines to read this
file. It's format is laid out at <http://modis-atmos.gsfc.nasa.gov/
MOD07_L2/format.html>. You'll see that it's far more complicated than
just a simple multi-dmensional array of a single data type.
-
Thanks... David, Jeff, and Kuyper! Now that's more like it!!!
As you suggested, I went through MODIS website and I upgraded my
source code... But still 5% not enough, (T.T)
I made a JPG file of 1 band from original image with 20 bands, but the
shape was not what I wanted... Please check this and give me another
suggestions.
Harry
-------------------------------------------------------
PRO MOD07_getband_Ta
s_time = systime(1)
out_name_Ta = 'Ta_simple.img'
envi_open_file, out_name_Ta, r_fid=Ta_fid
envi_file_query, Ta_fid, ns=ns, nl=nl, nb=nb
dims = [-1, 0, ns-1, 0, nl-1]
pos_Ta = lindgen(nb)
data = ENVI_GET_DATA(fid=Ta_fid, dims=dims, pos=pos_Ta[19])
WRITE_jpeg,'Ta20test.jpg',data
close, /all
e_time = systime(1)
print, 'Elapsed time for this procedure: ', e_time - s_time , '
seconds!'
END
-------------------------------------------
-
Re: Thanks... David, Jeff, and Kuyper! Now that's more like it!!!
DirtyHarry wrote:
> As you suggested, I went through MODIS website and I upgraded my
> source code... But still 5% not enough, (T.T)
>
> I made a JPG file of 1 band from original image with 20 bands, but the
> shape was not what I wanted... Please check this and give me another
> suggestions.
I think that the most important part of your program probably isn't
the part where you select which band to display. What does the code
look like that you used to create the original JPG file?
> -------------------------------------------------------
> PRO MOD07_getband_Ta
> s_time = systime(1)
>
> out_name_Ta = 'Ta_simple.img'
>
> envi_open_file, out_name_Ta, r_fid=Ta_fid
> envi_file_query, Ta_fid, ns=ns, nl=nl, nb=nb
> dims = [-1, 0, ns-1, 0, nl-1]
> pos_Ta = lindgen(nb)
>
> data = ENVI_GET_DATA(fid=Ta_fid, dims=dims, pos=pos_Ta[19])
> WRITE_jpeg,'Ta20test.jpg',data
>
> close, /all
>
> e_time = systime(1)
> print, 'Elapsed time for this procedure: ', e_time - s_time , '
> seconds!'
I'm moderately familiar with the use of the envi GUI, but have no
experience with it's programming interface. However, reviewing the
Envi Help, I couldn't find anything obviously wrong with the code
above.
-
Re: Thanks... David, Jeff, and Kuyper! Now that's more like it!!!
You could try using the new MODIS Conversion Toolkit plugin for ENVI:
http://www.ittvis.com/codebank/search.asp?FID=485
It can handle MOD07 data, along with every other know MODIS product
(143 at last count). There is a GUI version and a fully-accessible
API. I tried to make the programmatic interface as easy to use as
possible. If you do try it out, and run into any issues, please let
me know. I'm always looking for ways to improve it.
On Jun 16, 3:43 am, DirtyHarry <kim20...@gmail.com> wrote:
> As you suggested, I went through MODIS website and I upgraded my
> source code... But still 5% not enough, (T.T)
>
> I made a JPG file of 1 band from original image with 20 bands, but the
> shape was not what I wanted... Please check this and give me another
> suggestions.
>
> Harry
> -------------------------------------------------------
> PRO MOD07_getband_Ta
> s_time = systime(1)
>
> out_name_Ta = 'Ta_simple.img'
>
> envi_open_file, out_name_Ta, r_fid=Ta_fid
> envi_file_query, Ta_fid, ns=ns, nl=nl, nb=nb
> dims = [-1, 0, ns-1, 0, nl-1]
> pos_Ta = lindgen(nb)
>
> data = ENVI_GET_DATA(fid=Ta_fid, dims=dims, pos=pos_Ta[19])
> WRITE_jpeg,'Ta20test.jpg',data
>
> close, /all
>
> e_time = systime(1)
> print, 'Elapsed time for this procedure: ', e_time - s_time , '
> seconds!'
>
> END
> -------------------------------------------
Similar Threads
-
By Application Development in forum labview
Replies: 0
Last Post: 12-13-2007, 08:10 AM
-
By Application Development in forum labview
Replies: 0
Last Post: 11-02-2007, 04:40 PM
-
By Application Development in forum Idl-pvwave
Replies: 4
Last Post: 08-16-2007, 04:19 PM
-
By Application Development in forum Adobe Tools
Replies: 10
Last Post: 06-20-2007, 07:02 PM