Read the data in a group in a HDF5 file

Hi,
I have a PROBA-V imagery (HDF5)
<HDF5 group "/LEVEL3" (5 members)>
I know that I have 5 members in a group in my file HDF5 but I can't open them.
Could you please help me to read this 5 members ?

Thank you,
Natacha

Hi Natacha,
  Are you using h5py? It should be as simple as:

f = h5py.File("myfile.h5", "r")
mygroup = f["group_name"]

John

···

From: volto natacha <natvolto@yahoo.fr<mailto:natvolto@yahoo.fr>>
Reply-To: volto natacha <natvolto@yahoo.fr<mailto:natvolto@yahoo.fr>>, "hdf-forum@lists.hdfgroup.org<mailto:hdf-forum@lists.hdfgroup.org>" <hdf-forum@lists.hdfgroup.org<mailto:hdf-forum@lists.hdfgroup.org>>
Date: Thursday, February 26, 2015 at 11:43 AM
To: "hdf-forum@lists.hdfgroup.org<mailto:hdf-forum@lists.hdfgroup.org>" <hdf-forum@lists.hdfgroup.org<mailto:hdf-forum@lists.hdfgroup.org>>
Subject: [Hdf-forum] Read the data in a group in a HDF5 file

  Hi,

I have a PROBA-V imagery (HDF5)

<HDF5 group "/LEVEL3" (5 members)>

I know that I have 5 members in a group in my file HDF5 but I can't open them.

Could you please help me to read this 5 members ?

Thank you,

Natacha

Hi John,
Thank you for your answer.
I have found :
#Import h5py library Import h5py #Open HDF5 file with h5py, read-write mode f=h5py.File ('PROBAV_S1_TOA_X11Y07_20140607_300 m_V001.hdf5','r+') #Use Python dictionary syntax to explore the HDF5 structure f.keys() #Get dimensions f[‘/LEVEL3/RADIOMETRY/BLUE/TOA’].shape #Get data type f[‘/LEVEL3/RADIOMETRY/BLUE/TOA’].dtype #Get value array f[‘/LEVEL3/RADIOMETRY/BLUE/TOA’].value
Natacha

···

Le Vendredi 27 février 2015 20h11, John Readey <jreadey@hdfgroup.org> a écrit :
   
Hi Natacha, Are you using h5py? It should be as simple as:
f = h5py.File(“myfile.h5”, “r”) mygroup = f[“group_name”]

John
From: volto natacha <natvolto@yahoo.fr>
Reply-To: volto natacha <natvolto@yahoo.fr>, "hdf-forum@lists.hdfgroup.org" <hdf-forum@lists.hdfgroup.org>
Date: Thursday, February 26, 2015 at 11:43 AM
To: "hdf-forum@lists.hdfgroup.org" <hdf-forum@lists.hdfgroup.org>
Subject: [Hdf-forum] Read the data in a group in a HDF5 file

Hi,
I have a PROBA-V imagery (HDF5)
<HDF5 group "/LEVEL3" (5 members)>
I know that I have 5 members in a group in my file HDF5 but I can't open them.
Could you please help me to read this 5 members ?

Thank you,
Natacha

Hello,
With Python, I would like to recover 2 elements (cf. attach file) but I can't find the code.
I know that this information is on the member : "GEOMETRY".
I tried to enter, I have 4 members in the group : [u'SAA', u'SWIR', u'SZA', u'VNIR']
But I can't recover the information about latitude and longitude
Thank you for help
Natacha

···

Le Samedi 28 février 2015 10h00, volto natacha <natvolto@yahoo.fr> a écrit :
   
Hi John,
Thank you for your answer.
I have found :
#Import h5py library Import h5py #Open HDF5 file with h5py, read-write mode f=h5py.File ('PROBAV_S1_TOA_X11Y07_20140607_300 m_V001.hdf5','r+') #Use Python dictionary syntax to explore the HDF5 structure f.keys() #Get dimensions f[‘/LEVEL3/RADIOMETRY/BLUE/TOA’].shape #Get data type f[‘/LEVEL3/RADIOMETRY/BLUE/TOA’].dtype #Get value array f[‘/LEVEL3/RADIOMETRY/BLUE/TOA’].value
Natacha

     Le Vendredi 27 février 2015 20h11, John Readey <jreadey@hdfgroup.org> a écrit :
   
Hi Natacha, Are you using h5py? It should be as simple as:
f = h5py.File(“myfile.h5”, “r”) mygroup = f[“group_name”]

John
From: volto natacha <natvolto@yahoo.fr>
Reply-To: volto natacha <natvolto@yahoo.fr>, "hdf-forum@lists.hdfgroup.org" <hdf-forum@lists.hdfgroup.org>
Date: Thursday, February 26, 2015 at 11:43 AM
To: "hdf-forum@lists.hdfgroup.org" <hdf-forum@lists.hdfgroup.org>
Subject: [Hdf-forum] Read the data in a group in a HDF5 file

Hi,
I have a PROBA-V imagery (HDF5)
<HDF5 group "/LEVEL3" (5 members)>
I know that I have 5 members in a group in my file HDF5 but I can't open them.
Could you please help me to read this 5 members ?

Thank you,
Natacha

Hello,
With Python, I would like to recover 2 elements (cf. attach file) but I
can't find the code.
I know that this information is on the member : "GEOMETRY".
I tried to enter, I have 4 members in the group : [u'SAA', u'SWIR',
u'SZA', u'VNIR']

f['LEVEL3/GEOMETRY'].attrs.keys()

'.attrs' is a dictionary with the attributes.

f['LEVEL3/GEOMETRY'].attrs['TOP_LEFT_LONGITUDE']

should give you one of your examples.

···

On Sun, Mar 01, 2015 at 11:58:27PM +0000, volto natacha wrote:

But I can't recover the information about latitude and longitude
Thank you for help
Natacha
Le Samedi 28 février 2015 10h00, volto natacha <natvolto@yahoo.fr> a
écrit :
Hi John,
Thank you for your answer.
I have found :
#Import h5py library
Import h5py
#Open HDF5 file with h5py, read-write mode
f=h5py.File ('PROBAV_S1_TOA_X11Y07_20140607_300 m_V001.hdf5','r+')
#Use Python dictionary syntax to explore the HDF5 structure
f.keys()
#Get dimensions
f[‘/LEVEL3/RADIOMETRY/BLUE/TOA’].shape
#Get data type
f[‘/LEVEL3/RADIOMETRY/BLUE/TOA’].dtype
#Get value array
f[‘/LEVEL3/RADIOMETRY/BLUE/TOA’].value
Natacha
Le Vendredi 27 février 2015 20h11, John Readey <jreadey@hdfgroup.org> a
écrit :
Hi Natacha,
  Are you using h5py? It should be as simple as:
f = h5py.File(“myfile.h5”, “r”)
mygroup = f[“group_name”]
John
From: volto natacha <natvolto@yahoo.fr>
Reply-To: volto natacha <natvolto@yahoo.fr>,
"hdf-forum@lists.hdfgroup.org" <hdf-forum@lists.hdfgroup.org>
Date: Thursday, February 26, 2015 at 11:43 AM
To: "hdf-forum@lists.hdfgroup.org" <hdf-forum@lists.hdfgroup.org>
Subject: [Hdf-forum] Read the data in a group in a HDF5 file

  Hi,
I have a PROBA-V imagery (HDF5)
<HDF5 group "/LEVEL3" (5 members)>
I know that I have 5 members in a group in my file HDF5 but I can't
open them.
Could you please help me to read this 5 members ?
Thank you,
Natacha

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

--
-----------------------------------------------------------
Pierre de Buyl
KU Leuven - Institute for Theoretical Physics
T +32 16 3 27355
W http://pdebuyl.be/
-----------------------------------------------------------

Hi,
I have found my solution with dataset = f["/LEVEL3/GEOMETRY"]for key, value in dataset.attrs.iteritems():
print "%s: %s" % (key, value)

TOP_LEFT_LONGITUDE: [ 70.]
TOP_LEFT_LATITUDE: [ 65.]
TOP_RIGHT_LONGITUDE: [ 79.99702454]
TOP_RIGHT_LATITUDE: [ 65.]
BOTTOM_LEFT_LONGITUDE: [ 70.]
BOTTOM_LEFT_LATITUDE: [ 55.00297546]
BOTTOM_RIGHT_LONGITUDE: [ 79.99702454]
BOTTOM_RIGHT_LATITUDE: [ 55.00297546]
CENTER_LONGITUDE: [ 74.99851227]
CENTER_LATITUDE: [ 60.00148773]
TOP_LEFT_X: [ 23520.]
TOP_LEFT_Y: [ 21840.]
TOP_RIGHT_X: [ 26879.]
TOP_RIGHT_Y: [ 21840.]
BOTTOM_LEFT_X: [ 23520.]
BOTTOM_LEFT_Y: [ 18481.]
BOTTOM_RIGHT_X: [ 26879.]
BOTTOM_RIGHT_Y: [ 18481.]
CENTER_X: [ 25199.5]
CENTER_Y: [ 20160.5]
Natacha

···

Le Lundi 2 mars 2015 0h58, volto natacha <natvolto@yahoo.fr> a écrit :
   
Hello,
With Python, I would like to recover 2 elements (cf. attach file) but I can't find the code.
I know that this information is on the member : "GEOMETRY".
I tried to enter, I have 4 members in the group : [u'SAA', u'SWIR', u'SZA', u'VNIR']
But I can't recover the information about latitude and longitude
Thank you for help
Natacha

     Le Samedi 28 février 2015 10h00, volto natacha <natvolto@yahoo.fr> a écrit :
   
Hi John,
Thank you for your answer.
I have found :
#Import h5py library Import h5py #Open HDF5 file with h5py, read-write mode f=h5py.File ('PROBAV_S1_TOA_X11Y07_20140607_300 m_V001.hdf5','r+') #Use Python dictionary syntax to explore the HDF5 structure f.keys() #Get dimensions f[‘/LEVEL3/RADIOMETRY/BLUE/TOA’].shape #Get data type f[‘/LEVEL3/RADIOMETRY/BLUE/TOA’].dtype #Get value array f[‘/LEVEL3/RADIOMETRY/BLUE/TOA’].value
Natacha

     Le Vendredi 27 février 2015 20h11, John Readey <jreadey@hdfgroup.org> a écrit :
   
Hi Natacha, Are you using h5py? It should be as simple as:
f = h5py.File(“myfile.h5”, “r”) mygroup = f[“group_name”]

John
From: volto natacha <natvolto@yahoo.fr>
Reply-To: volto natacha <natvolto@yahoo.fr>, "hdf-forum@lists.hdfgroup.org" <hdf-forum@lists.hdfgroup.org>
Date: Thursday, February 26, 2015 at 11:43 AM
To: "hdf-forum@lists.hdfgroup.org" <hdf-forum@lists.hdfgroup.org>
Subject: [Hdf-forum] Read the data in a group in a HDF5 file

Hi,
I have a PROBA-V imagery (HDF5)
<HDF5 group "/LEVEL3" (5 members)>
I know that I have 5 members in a group in my file HDF5 but I can't open them.
Could you please help me to read this 5 members ?

Thank you,
Natacha