Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEDI L2A no effect of degrade flags #446

Closed
ayush12gupta opened this issue Nov 13, 2024 · 9 comments
Closed

GEDI L2A no effect of degrade flags #446

ayush12gupta opened this issue Nov 13, 2024 · 9 comments

Comments

@ayush12gupta
Copy link

When using gedi.gedi02ap it has no effect when changing degrade flags. I also tried comparing the no. of GEDI points when read using the raw file and what sliderule returns, there is a difference in ones from sliderule and raw file with both degrade flag and without it. I have shown this issue in the notebook shared below.

https://notebooksharing.space/view/5b8da8ac5595d8d982df18174dc21b347ce23b2fb8d2659e0581a57f0d0b2cf0#displayOptions=
mt_baker_area.zip

@scottyhq
Copy link
Contributor

@ayush12gupta I see in your notebook you're setting degrade_flag=70. As far as I know it is a boolean value see this discussion https://github.com/orgs/SlideRuleEarth/discussions/442

But in short, degrade_flag=0=False -> "not degraded" , degrade_flag=1=True -> "degraded quality"

@ayush12gupta
Copy link
Author

@scottyhq Thanks for clarifying that, so when degrade filtering is used it is removing all non zero degrade flag values right ?

However I am still wondering why the total no. of GEDI points are the same with and without degrade filter. And why there is difference in the total no. of GEDI points when read using raw files vs what sliderule returns.

@scottyhq
Copy link
Contributor

degrade filtering is used it is removing all non zero degrade flag values right ?

Yes, all degrade=1 values in theory. Maybe there is a bug though. In order to reproduce your examples, we'd need your polygon (/home/ayushg12/Desktop/UW_study/notebook/shapefiles/mt_baker_area.shp). So you can either print it out as text if it's simple, or just commit it to github (preferably as GeoJSON)!

@ayush12gupta
Copy link
Author

ayush12gupta commented Nov 15, 2024

Ok got it! For reproducing the bug here is the mt_baker_area shapefile in GeoJSON attached.

mt_baker_area.geo.json

@dshean
Copy link
Member

dshean commented Nov 15, 2024

Thanks @ayush12gupta for this example. The last 3 cells are telling.

Yes, this is potentially a bug. We should revisit GEDI flags and how we're handling these on the server vs. client side. Perhaps allowing users more granularity to specify filters if desired. Definitely need to improve the doc around these topics.

@ayush12gupta:

  • As scottyhq suggests, let's avoid shapefiles and stick with geojson whenever possible (though remember geojson spec only supports EPSG:4326, not projected CRS).
  • Please use the sliderule toregion function (https://slideruleearth.io/web/rtd/api_reference/sliderule.html#toregion) to create polygons for your requests. There is logic there to check and prepare polygons in expected format (e.g., winding order)
  • You shouldn't need to add new columns for Longitude and Latitude - we intentionally strip these when creating the geometry column to reduce data volume. Though I understand you may be using these for plotting outside of geopandas.

@dshean
Copy link
Member

dshean commented Nov 15, 2024

github doesn't supports geojson file type

Hmm. Not sure I understand. This is a text file, and Github should support natively (with preview). For example: https://github.com/johan/world.geo.json/blob/master/countries.geo.json

For simple polygons (like a square bbox), you can also just copy and paste the geojson text into a notebook cell (or github issue thread)

@ayush12gupta
Copy link
Author

Hmm. Not sure I understand. This is a text file, and Github should support natively (with preview). For example: https://github.com/johan/world.geo.json/blob/master/countries.geo.json

Got it!, GitHub was not supporting the .geojson extension. I changed it and updated the previous comment.

@scottyhq
Copy link
Contributor

Thanks @ayush12gupta

I spoke too soon about my interpretation of degrade_flag. From sliderule's point of view degrade_flag=1 -> "degraded" for any reason, which according to LPDAAC Data Dictionary can be due to many things.

Looks like these flag parameters were all updated recently in v4.8.0:

* GEDI parameters updated to be more accurate an intuitive (the old parameter names are still functional but have been DEPRECATED, please switch to using the new ones in your code).
- `degrade_flag` changed to `degrade_filter` and instead of having to know what the flag values were; the user now just needs to set to True to filter out all degraded footprints.
- `l2_quality_flag` changed to `l2_quality_filter` and instead of having to know what the flag values were; the user now just needs to set to True to filter out anything that does not meet the L2 quality criteria.
- `l4_quality_flag` changed to `l4_quality_filter` and instead of having to know what the flag values were; the user now just needs to set to True to filter out anything that does not meet the L4 quality criteria.
- `surface_flag` changed to `surface_filter` and instead of having to know what the flag values were; the user now just needs to set to True to filter out anything that isn't a surface footprint.
- `beam` changed to `beams` to reflect that it is primarily a list of beams to process and not just a single beam (even though if the user only provides a single beam, the server side code will automatically promote it to a list of beams with only one element).

So I suggest changing your code to the following:

# Note: .geojson instead of .geo.json :) 
aoi = gpd.read_file('mt_baker_area.geojson')


params ={
    "poly":sliderule.toregion(aoi)['poly'],
    "degrade_filter": True, # no degraded samples, 2547 points in aoi -> 232 points
}

gf = gedi.gedi02ap(params, resources=granules)

@ayush12gupta
Copy link
Author

Ok got it, just need to change the flag parameters. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants