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

Home » Public Forums » archive » Re: opening .h5 data files
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: opening .h5 data files [message #74236] Wed, 05 January 2011 09:10 Go to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 1/5/11 9:55 AM, David Fanning wrote:
> Michael Galloy writes:
>
>> I use MG_H5_GETDATA to do it:
>>
>> IDL> u = mg_h5_getdata(file, '/result/hdfeos/grids/set1/data_fields/u')
>>
>> It also can grab a section of a variable if you don't want to read the
>> entire variable:
>>
>> IDL> f = filepath('hdf5_test.h5', subdir=['examples', 'data'])
>> IDL> res3 = mg_h5_getdata(f, '/arrays/3D int array[3, 5:*:2, 0:49:3]')
>>
>> Get mg_h5_getdata.pro at:
>>
>> http://michaelgalloy.com/wp-content/uploads/2011/01/mg_h5_ge tdata.pro
>
> OK, I've looked this over and I know you didn't
> learn how to read HDF5 files from the IDL documentation. :-)
>
> May I ask what you referred to when you were figuring
> all this out? Thanks.

The online help, library routines like H5_PARSE, and trial and error.

Mike
--
www.michaelgalloy.com
Research Mathematician
Tech-X Corporation
Re: opening .h5 data files [message #74237 is a reply to message #74236] Wed, 05 January 2011 08:55 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Michael Galloy writes:

> I use MG_H5_GETDATA to do it:
>
> IDL> u = mg_h5_getdata(file, '/result/hdfeos/grids/set1/data_fields/u')
>
> It also can grab a section of a variable if you don't want to read the
> entire variable:
>
> IDL> f = filepath('hdf5_test.h5', subdir=['examples', 'data'])
> IDL> res3 = mg_h5_getdata(f, '/arrays/3D int array[3, 5:*:2, 0:49:3]')
>
> Get mg_h5_getdata.pro at:
>
> http://michaelgalloy.com/wp-content/uploads/2011/01/mg_h5_ge tdata.pro

OK, I've looked this over and I know you didn't
learn how to read HDF5 files from the IDL documentation. :-)

May I ask what you referred to when you were figuring
all this out? Thanks.

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: opening .h5 data files [message #74238 is a reply to message #74237] Wed, 05 January 2011 08:42 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Michael Galloy writes:

> I use MG_H5_GETDATA to do it:
>
> IDL> u = mg_h5_getdata(file, '/result/hdfeos/grids/set1/data_fields/u')
>
> It also can grab a section of a variable if you don't want to read the
> entire variable:
>
> IDL> f = filepath('hdf5_test.h5', subdir=['examples', 'data'])
> IDL> res3 = mg_h5_getdata(f, '/arrays/3D int array[3, 5:*:2, 0:49:3]')
>
> Get mg_h5_getdata.pro at:
>
> http://michaelgalloy.com/wp-content/uploads/2011/01/mg_h5_ge tdata.pro

Yeah, that's the one-liner I was looking for. I just
didn't realize it was going to take a 1000 lines of
code to do it. :-)

Thanks! Very useful.

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: opening .h5 data files [message #74239 is a reply to message #74238] Wed, 05 January 2011 08:23 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 1/5/11 7:55 am, David Fanning wrote:
> Liam Gumley writes:
>
>> Neil, try this:
>>
>> result = h5_parse(file, /read_data)
>> help, result, /structure
>
> Whoa! That's pretty impressive. :-)
>
> So, now I have the data:
>
> IDL> help, result.hdfeos.grids.set1.data_fields.u._data
> <Expression> FLOAT = Array[360, 180]
>
> How do I read just that variable out of the file
> without reading everything?

I use MG_H5_GETDATA to do it:

IDL> u = mg_h5_getdata(file, '/result/hdfeos/grids/set1/data_fields/u')

It also can grab a section of a variable if you don't want to read the
entire variable:

IDL> f = filepath('hdf5_test.h5', subdir=['examples', 'data'])
IDL> res3 = mg_h5_getdata(f, '/arrays/3D int array[3, 5:*:2, 0:49:3]')

Get mg_h5_getdata.pro at:

http://michaelgalloy.com/wp-content/uploads/2011/01/mg_h5_ge tdata.pro

Mike
--
www.michaelgalloy.com
Research Mathematician
Tech-X Corporation
Re: opening .h5 data files [message #74243 is a reply to message #74239] Wed, 05 January 2011 06:55 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Liam Gumley writes:

> Neil, try this:
>
> result = h5_parse(file, /read_data)
> help, result, /structure

Whoa! That's pretty impressive. :-)

So, now I have the data:

IDL> help, result.hdfeos.grids.set1.data_fields.u._data
<Expression> FLOAT = Array[360, 180]

How do I read just that variable out of the file
without reading everything?

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: opening .h5 data files [message #74244 is a reply to message #74243] Wed, 05 January 2011 06:45 Go to previous messageGo to next message
liamgumley is currently offline  liamgumley
Messages: 74
Registered: June 2005
Member
On Jan 5, 5:26 am, Neil <swapneil.v...@gmail.com> wrote:
> Dear all,
>
> I have this .h5 data format files and those are so many,
>
> i have to extract a particular data from these files,
> for that i have to go to the browser every time and extract the data
> for each individual file,
>
> how can i extract the data from each .h5 data file at one go ?

Neil, try this:

result = h5_parse(file, /read_data)
help, result, /structure

Liam.
Practical IDL Programming
http://www.gumley.com/
Re: opening .h5 data files [message #74308 is a reply to message #74237] Thu, 06 January 2011 08:39 Go to previous message
Mark Piper is currently offline  Mark Piper
Messages: 198
Registered: December 2009
Senior Member
On Jan 5, 9:55 am, David Fanning <n...@dfanning.com> wrote:
>
> OK, I've looked this over and I know you didn't
> learn how to read HDF5 files from the IDL documentation. :-)
>
> May I ask what you referred to when you were figuring
> all this out? Thanks.
>

I've found helpful the docs directly from The HDF Group:

http://www.hdfgroup.org/HDF5/doc/index.html

since IDL presents just a thin layer over the HDF5 C API.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL output directed to STDERR-- can't seem to work around...
Next Topic: Book Editors Needed. Apply Within

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

Current Time: Wed Oct 08 15:39:29 PDT 2025

Total time taken to generate the page: 0.00728 seconds