Re: Help Working with HDF Files [message #43363] |
Thu, 07 April 2005 12:49 |
vinit
Messages: 7 Registered: March 2005
|
Junior Member |
|
|
April 7, 2005
Dr. Fanning,
Thank you for your prompt reply. I will try out your suggestions and
get back on the forum.
Thanks very much,
Vinit
|
|
|
Re: Help Working with HDF Files [message #43368 is a reply to message #43363] |
Thu, 07 April 2005 12:40  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
vinit writes:
> First off, I'd like to say that I am a real newbie to IDL and this is
> the first time that I've heard of the HDF file format. I have bought
> Dr. Fanning's excellent book and am aware that there is a chapter on
> working with HDF files. I would be grateful if someone could help me
> figure out what it is I must do to achieve my goals.
Well, you are walking in the right direction, anyway. :-)
> My first goal is to simply read an HDF file (which was given to me by
> my lab partner - I am a programmer, not a scientist)that contains
> rainfall precipitation data as an image and display it using IDL
> (essentially get the same image as when I open it with ENVI).
>
> I have tried running the code found in the "coyote" folder called
> "hdfread" but the program halts in the middle and gives the following
> error message:
That program is meant to read a file that was created
with its companion HDFWRITE, and is used just to give you
a feel for how you deal with HDF files. It is NOT a general
purpose HDF file reader.
> I believe that my data doesn't have the HDF_SD dataset. How to work
> around this?
I would try to have a look at the file with HDF_BROWSER (or, if
this is an HDF5 data file, with H5_BROWSER). The HDF_BROWSER
interface is exceedingly clunky, but if you fool around long
enough you ought to be able to figure out how to extract the
piece of the file you need. This would impress your lab partner,
even if it didn't give you deep insight into HDF files and
programming in general.
To make it look like the one in ENVI, you are probably
going to have to scale the data in some way. But you
won't know this for sure until you get it into a variable
and poke around a little bit.
> I would then like to "process" the data. More explicitly, I'd like to
> divide the picture into n x n pixel regions, extract the value of each
> pixel, compute the average value of that region and compare it to a
> threshold value. If the average value is less than the threshold value
> I want to assign the whole n x n pixel region (i.e each pixel in that
> region) a value of -99 else I want to assign the whole region the
> computed average value. I'm not sure how to go about doing that, but
> perhaps I am getting ahead of myself.
Yes, you are WAY ahead of yourself. Check back in once you have
the data in hand and can display it (somehow) on your screen. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|