I downloaded GEDI LiDAR data in hdf5
format. How can I open this file or convert it to the standard LAS format (point cloud)?
When I tried opening the hdf
file with QGIS
and I got the following error:
Invalid Layer: Raster layer Provider is not valid (provider: gdal, URL:filename)
I also tried opening it with Python
:
import pandas as pd
pandas.read_hdf('filename')
I got this error
ValueError: No dataset in HDF5 file
Best Answer
It's not possible to convert GEDI
.h5
file to LAS file as including all data. Because.h5
file includes a lot of information about a point (actually it is a window in GEDI.h5
format, not a point). Also, since LAS file has certain attributes for a point not matching attributes/values in.h5
file, you cannot add all information to LAS file. For example, which value in.h5
file does matchZ
value in LAS file,elevation_bin0
orelevation_lastbin
? Etc.There is no one way/method to convert any
.h5
file to another format. It depends on data structure included in.h5
file. It varies from.h5
to.h5
. Therefore you should decide the attributes you would like to use.Using
h5py
package, you can easily readh5
file. Firstly, let's examine GEDI .h5 file structure.There are 8
BEAMXXXX
groups and 1METADATA
group. Now, let's see all datasets in all groups.NOTE: I will use datasets in 'BEAM0000' as an example. For other BEAMXXXX group, you should change
group
variable.Let's find the keys which have 249810 (
n
) records. We'll form a DataFrame using these keys. Since there are two nested levels, twofor
loops are sufficient.surface_type
,rxwaveform
andtxwaveform
are missing. As far as I understand,rxwaveform
andtxwaveform
are the most important keys in data.Let's add
surface_type
,rxwaveform
andtxwaveform
todf
. Please note that each is not a single value, but a list about one point. (See the last 3 columns)I don't know what these values mean, therefore, how to use
df
is up to you.All necessary script:
If you prefer, you can save
df
as shapefile.