Dear GEDI team,
I am a PhD student working in Australia and would like to use GEDI data as environmental covariates in my occupancy models for long-term monitoring of specific aboreal mammal. I have downloaded the GEDI L2B version 2 for my region using Earthdata search following this video tutorial (https://lpdaac.usgs.gov/resources/e-lea ... n-studies/). The data was successfully downloaded (see attached screenshot earthdatasearch.jpg).
And then I would like to convert the granules to GeoJSON files so that I can retrieve the attribute tables. I followed this tutorial and python script (https://git.earthdata.nasa.gov/projects ... ter/browse), but at keep getting this error when executing the script (see attached screenshot OutOfIndexError.jpg).
Processing file: processed_GEDI02_B_2019108185228_O01971_01_T00922_02_003_01_V002.h5 (1/160)
Traceback (most recent call last):
File "GEDI_Subsetter.py", line 157, in <module>
lat = [l for l in beamSDS if sdsSubset[0] in l][0]
IndexError: list index out of range
I tried with both GeoJSON and bounding box as an argument of --roi but neither of them works. Could you please advise me where goes wrong?
Thank you in advance!
---------
Attached also the downloaded folder structure and the h5 files in the input directory (GEDI_files.png).
The codes I am using in the command prompt are as below:
conda create -n gedi -c conda-forge --yes python=3.7.9 h5py shapely geopandas pandas
cd C:\Users\jc745612\Desktop\GEDI\gedi-subsetter
activate gedi
python GEDI_Subsetter.py --dir "C:\Users\jc745612\Desktop\GEDI\gediwt_2" --roi map.geojson
python GEDI_Subsetter.py --dir "C:\Users\jc745612\Desktop\GEDI\gediwt_2" --roi '-16.8,144.1,-19.7,147.8'
Converting GEDI h5 to GeoJSON
Converting GEDI h5 to GeoJSON
- Attachments
-
- GEDI files
- GEDI_files.png (339.91 KiB) Not viewed yet
-
- Python executing error
- OutOfIndexError.jpg (224.6 KiB) Not viewed yet
-
- Earthdata Search GEDI L2B v2
- earthdatasearch.jpg (95.4 KiB) Not viewed yet
Tags:
-
- User Services
- Posts: 109
- Joined: Mon Sep 30, 2019 12:39 pm America/New_York
Re: Converting GEDI h5 to GeoJSON
We have forwarded your inquiry to our Subject Matter Expert for further assistance.
-
- Subject Matter Expert
- Posts: 22
- Joined: Tue Nov 12, 2019 4:02 pm America/New_York
Re: Converting GEDI h5 to GeoJSON
@erynchang ,
I haven’t been able to replicate the issue you are experiencing. Here is what I’ve tried.
First, I cloned the repository (https://git.earthdata.nasa.gov/projects ... ter/browse) to a local directory, and I ran the Python Environment setup instructions (i.e., conda create -n gedi -c conda-forge --yes python=3.7 h5py shapely geopandas pandas).
Next, I replicated you’re geojson file using the coordinates from your previous post (i.e., '-16.8,144.1,-19.7,147.8').
I used the same coordinates to identify GEDI L2B granules in Earthdata Search. I downloaded two GEDI granule is two ways. The first way was to download the granules as-is, with no spatial subsetting. The second was to download the files that had been spatially subset using Earthdata Search’s Customize > Spatial Subset option.
I also found the granule you mentioned in your post (i.e., processed_GEDI02_B_2019108185228_O01971_01_T00922_02_003_01_V002.h5) in Earthdata Search and, again, downloaded the entire granule and a spatially subset version of the data.
I ran the GEDI_Subsetter.py script against all the files and experienced no fatal error. For each file a valid geojson file was created. I tried both --roi options, specifying both the geojson file I created ( --roi map.geojson) and the corner coordinates ( --roi '-16.8,144.1,-19.7,147.8'), which both ran successfully.
Unless you have any additional details I didn’t’ consider, I recommend re-downloading/cloning the repo (https://git.earthdata.nasa.gov/projects ... ter/browse) and creating a new Python environment to execute the code. If your issue persists, please contact the LP DAAC User Services (LPDAAC@usgs.gov) and we can set up a time to discuss/troubleshoot.
I haven’t been able to replicate the issue you are experiencing. Here is what I’ve tried.
First, I cloned the repository (https://git.earthdata.nasa.gov/projects ... ter/browse) to a local directory, and I ran the Python Environment setup instructions (i.e., conda create -n gedi -c conda-forge --yes python=3.7 h5py shapely geopandas pandas).
Next, I replicated you’re geojson file using the coordinates from your previous post (i.e., '-16.8,144.1,-19.7,147.8').
I used the same coordinates to identify GEDI L2B granules in Earthdata Search. I downloaded two GEDI granule is two ways. The first way was to download the granules as-is, with no spatial subsetting. The second was to download the files that had been spatially subset using Earthdata Search’s Customize > Spatial Subset option.
I also found the granule you mentioned in your post (i.e., processed_GEDI02_B_2019108185228_O01971_01_T00922_02_003_01_V002.h5) in Earthdata Search and, again, downloaded the entire granule and a spatially subset version of the data.
I ran the GEDI_Subsetter.py script against all the files and experienced no fatal error. For each file a valid geojson file was created. I tried both --roi options, specifying both the geojson file I created ( --roi map.geojson) and the corner coordinates ( --roi '-16.8,144.1,-19.7,147.8'), which both ran successfully.
Unless you have any additional details I didn’t’ consider, I recommend re-downloading/cloning the repo (https://git.earthdata.nasa.gov/projects ... ter/browse) and creating a new Python environment to execute the code. If your issue persists, please contact the LP DAAC User Services (LPDAAC@usgs.gov) and we can set up a time to discuss/troubleshoot.
Re: Converting GEDI h5 to GeoJSON
Hi Afriesz,
Thank you so much for testing the data. Indeed I subset the layers on earthdata search and that's probably why the script failed. I re-downloaded the whole set without subsetting and it worked!
Thank you so much for testing the data. Indeed I subset the layers on earthdata search and that's probably why the script failed. I re-downloaded the whole set without subsetting and it worked!