Skip to content

Commit

Permalink
restored some old gedi parameter names for backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jpswinski committed Oct 22, 2024
1 parent e3e8c33 commit e06dd34
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 17 deletions.
2 changes: 1 addition & 1 deletion clients/python/tests/test_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def test_parms(self, init):
assert len(d["core"]["samples"]) == 0, f'core has invalid samples parameters: {d["core"]["samples"]}'
assert d["core"]["cluster_size_hint"] == 0, f'core has invalid cluster size hint: {d["core"]["cluster_size_hint"]}'
assert d["icesat2"]["srt"] == "land_ice", f'icesat2 has invalid surface reference type: {d["icesat2"]["srt"]}'
assert d["gedi"]["projection"] == "auto", f'gedi has invalid projection: {d["gedi"]["projection"]}'
assert d["gedi"]["proj"] == "auto", f'gedi has invalid projection: {d["gedi"]["proj"]}'
2 changes: 1 addition & 1 deletion clients/python/tests/test_subsetting.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_180_edge_plate_carree(self, init):
{ "lat": -73.0, "lon": -180.00 } ]
parms = {
"poly": poly,
"projection": "plate_carree",
"proj": "plate_carree",
"srt": icesat2.SRT_LAND,
"cnf": icesat2.CNF_SURFACE_LOW,
"ats": 20.0,
Expand Down
33 changes: 26 additions & 7 deletions datasets/gedi/package/GediFields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,19 @@ int GediFields::luaCreate (lua_State* L)
*----------------------------------------------------------------------------*/
GediFields::GediFields(lua_State* L , uint64_t key_space, const char* default_asset_name, const char* default_resource):
RequestFields (L, key_space,
{ {"asset", &asset},
{"resource", &resource},
{"beams", &beams},
{"degrade_filter", &degrade_filter},
{"l2_quality_filter", &l2_quality_filter},
{"l4_quality_filter", &l4_quality_filter},
{"surface_filter", &surface_filter} }),
{ {"asset", &asset},
{"resource", &resource},
{"beams", &beams},
{"degrade_filter", &degrade_filter},
{"l2_quality_filter", &l2_quality_filter},
{"l4_quality_filter", &l4_quality_filter},
{"surface_filter", &surface_filter},
// backwards compatibility
{"beam", &beams},
{"degrade_flag", &degrade_flag},
{"l2_quality_flag", &l2_quality_flag},
{"l4_quality_flag", &l4_quality_flag},
{"surface_flag", &surface_flag} }),
asset(default_asset_name)
{
if(default_resource)
Expand All @@ -88,6 +94,19 @@ GediFields::GediFields(lua_State* L , uint64_t key_space, const char* default_as
}
}

/*----------------------------------------------------------------------------
* fromLua
*----------------------------------------------------------------------------*/
void GediFields::fromLua (lua_State* L, int index)
{
RequestFields::fromLua(L, index);

if(degrade_flag == 1) degrade_filter = true;
if(l2_quality_flag == 1) l2_quality_filter = true;
if(l4_quality_flag == 1) l4_quality_filter = true;
if(surface_flag == 1) surface_filter = true;
}

/******************************************************************************
* FUNCTIONS
******************************************************************************/
Expand Down
9 changes: 8 additions & 1 deletion datasets/gedi/package/GediFields.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,21 @@ class GediFields: public RequestFields
FieldElement<bool> l4_quality_filter {false};
FieldElement<bool> surface_filter {false};

// backwards compatibility
FieldElement<int> degrade_flag {0};
FieldElement<int> l2_quality_flag {0};
FieldElement<int> l4_quality_flag {0};
FieldElement<int> surface_flag {0};

private:

/*--------------------------------------------------------------------
* Methods
*--------------------------------------------------------------------*/

GediFields (lua_State* L, uint64_t key_space, const char* default_asset_name, const char* default_resource);
GediFields (lua_State* L, uint64_t key_space, const char* default_asset_name, const char* default_resource);
virtual ~GediFields (void) override = default;
void fromLua (lua_State* L, int index) override;
};

/******************************************************************************
Expand Down
6 changes: 2 additions & 4 deletions docs/rtd/source/release_notes/release-v4-8-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ Bathy Version #5.

## General Changes

* GEDI parameters updated to be more accurate an intuitive.
* 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).

* Subsetting requests that use a rasterized geojson to perform the subsetting have been changed so that the geojson string is passed via a parameter named `region_mask` instead of `raster`. The original name was confusing with our increasing support for raster sampling. THe new name makes it clearer that the parameter is used as a mask for the region of interest.

* The `proj` field has changed to `projection` for clarity.
* Subsetting requests that use a rasterized geojson to perform the subsetting have been changed so that the geojson string is passed via a parameter named `region_mask` instead of `raster`. The original name was confusing with our increasing support for raster sampling. The new name makes it clearer that the parameter is used as a mask for the region of interest.

## Getting This Release

Expand Down
4 changes: 2 additions & 2 deletions docs/rtd/source/user_guide/SlideRule.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Parameters are passed to the SlideRule endpoints as JSON data structures (or as
All polygons provided to SlideRule must be provided as a list of dictionaries containing longitudes and latitudes in counter-clockwise order with the first and last point matching.

* ``"poly"``: polygon of region of interest
* ``"projection"``: projection used when subsetting data ("north_polar", "south_polar", "plate_carree"). In most cases, do not specify and code will do the right thing.
* ``"proj"``: projection used when subsetting data ("north_polar", "south_polar", "plate_carree"). In most cases, do not specify and code will do the right thing.
* ``"ignore_poly_for_cmr"``: boolean for whether to use the polygon as a part of the request to CMR for obtaining the list of resources to process. By default the polygon is used and this is only here for unusual cases where SlideRule is able to handle a polygon for subsetting that CMR cannot, and the list of resources to process is obtained some other way.

For example:
Expand Down Expand Up @@ -303,7 +303,7 @@ The default set of parameters used by SlideRule are set to match anticipated use
* - ``"poly"``
- String, JSON
-
* - ``"projection"``
* - ``"proj"``
- String
-
* - ``"ignore_poly_for_cmr"``
Expand Down
2 changes: 1 addition & 1 deletion packages/core/RequestFields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ RequestFields::RequestFields(lua_State* L, uint64_t key_space, const std::initia
LuaObject (L, OBJECT_TYPE, LUA_META_NAME, LUA_META_TABLE),
FieldDictionary ({
{"poly", &polygon},
{"projection", &projection},
{"proj", &projection},
{"points_in_polygon", &pointsInPolygon},
{"timeout", &timeout},
{"rqst_timeout", &rqstTimeout},
Expand Down

0 comments on commit e06dd34

Please sign in to comment.