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 in l]
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
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'
- 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
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.
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!