Re: HDF frustrations [message #38119] |
Mon, 23 February 2004 13:37 |
Michael Wallace
Messages: 409 Registered: December 2003
|
Senior Member |
|
|
> This is a common complaint with HDF data. How do I get at the data!?
>
> The IDL HDF_BROWSER function will let you make a template to extract all of
> the data fields. The trick is that you have to explicity tell the template
> to extract the data.
It's these little things that always seem to trip me up. Now that I'm
able to dump my data into a structure, I'm a much happier (and less
frustrated camper) than last week. Thanks!!
-Mike
|
|
|
Re: HDF frustrations [message #38143 is a reply to message #38119] |
Sun, 22 February 2004 14:40  |
andrew.cool
Messages: 47 Registered: July 2003
|
Member |
|
|
Michael Wallace <mwallace.removethismunge@swri.edu.invalid> wrote in message news:<103d0qatlo9385a@corp.supernews.com>...
> My education in IDL continues. Today's lesson is HDF files. I had
> never heard of HDF, let alone try to work with it before now. (Boo!)
> But, it appears that IDL already had a fair number of HDF functions.
> (Yea!) But, the documentation makes absolutely zero sense. (Boo!) But
> there's always help at the IDL newsgroup. (Yea!) ... It's Friday
> afternoon and I'm in a weird mood.
>
> Anyway, someone far away on this vast internet was gracious enough to
> make some of his data available, but he created HDF files (with ample
> documentation of what all the fields mean). Maybe it's because I don't
> understand the HDF format itself, but I couldn't find any coherent
> explanation of the IDL API to HDF. In the past hour or so, I've only
> managed to determine that there are 13 tags in the file in question.
> And I've found which tags are being referenced. I tried using
> HDF_Browser to create a template for me, and I can see the field names
> and such, but there's nothing to click on to the make the template
> extract everything. When I try an HDF_Read afterward, I only get a
> couple of the metadata items in my structure. Where's the rest of the
> data? Why isn't it there?
>
> All I want to do is dump all of the data in the file into a structure!
> Is that too much to ask?! I really have no need or desire to learn all
> the ins and outs of HDF; I just want to read this data. Had this been
> plain text, I would already have my plots by now. Plain text files are
> _so_ much better.
>
> *sigh*
>
> -Mike
Hi Mike,
I know SFA about HDF, but I do know that for HDF 5 there's a routine
called H5_PARSE.PRO that returns a structure of all the goodies in the file.
The source code is in the LIB directory of the IDL distribution.
Might help.
Andrew
DSTO, Adelaide, South Australia
|
|
|
Re: HDF frustrations [message #38153 is a reply to message #38143] |
Fri, 20 February 2004 14:56  |
savoie
Messages: 68 Registered: September 1996
|
Member |
|
|
Michael Wallace <mwallace.removethismunge@swri.edu.invalid> writes:
> Anyway, someone far away on this vast internet was gracious enough to make
> some of his data available, but he created HDF files (with ample
> documentation of what all the fields mean). Maybe it's because I don't
> understand the HDF format itself, but I couldn't find any coherent
> explanation of the IDL API to HDF. In the past hour or so, I've only managed
> to determine that there are 13 tags in the file in question. And I've found
> which tags are being referenced. I tried using HDF_Browser to create a
> template for me, and I can see the field names and such, but there's nothing
> to click on to the make the template extract everything. When I try an
> HDF_Read afterward, I only get a couple of the metadata items in my
> structure. Where's the rest of the data? Why isn't it there?
This is a common complaint with HDF data. How do I get at the data!?
The IDL HDF_BROWSER function will let you make a template to extract all of
the data fields. The trick is that you have to explicity tell the template
to extract the data.
You have to highlight the data fields that you want in the GUI**, and then push
down the 'Read' button under the ATTRIBUTE VALUES button. Then the Extract
As: field will be visible. You can change this if you want, but this is the
tag within the structure that the selected data will be located after
extraction.
** Note: you must do this one at a time, you can't highlight multiple fields
and then say read, but you can select multiple fields within a single
hdf_browser() session and get multiple fields out with the hdf_read().
Of course, your mileage may vary depending on how the data is stored in the
HDF file. For all of my purposes, the data I want are the SDs. I can
highlight the one I want and select Read. Then the data is in the returned
structure after my HDF_READ().
IDL> mytemp = hdf_browser()
IDL> mydatastruct = hdf_read(template=mytemp)
IDL> help, mydatastruct,/st
** Structure <849814c>, 4 tags, length=25920036, data length=25920036, refs=1:
FILENAME STRING '/data/MOD10C2/MOD10C2.A2002313.003.20023280234'...
VERSION STRING '1.1'
DATE STRING 'Fri Feb 20 15:52:02 2004'
MOD_CMG_SNOW_5KM_EIGHT_DAY_CMG_SNOW_COVER
BYTE Array[7200, 3600]
> All I want to do is dump all of the data in the file into a structure! Is
> that too much to ask?! I really have no need or desire to learn all the ins
> and outs of HDF; I just want to read this data. Had this been plain text, I
> would already have my plots by now. Plain text files are _so_ much better.
Yup. But don't hesitate to ask if you have any more questions, I just wanted
to answer this as soon as possible. It is Friday afterall!
cheers,
Matt
--
Matthew Savoie - Scientific Programmer
National Snow and Ice Data Center
(303) 735-0785 http://nsidc.org
|
|
|