Re: opening .h5 data files [message #74236] |
Wed, 05 January 2011 09:10  |
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   |
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   |
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   |
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   |
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   |
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  |
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.
|
|
|