Skip to content

Commit

Permalink
added parameter to bypass cmr when providing a polygon
Browse files Browse the repository at this point in the history
  • Loading branch information
jpswinski committed Nov 15, 2023
1 parent b9fec20 commit 81ffae6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
9 changes: 5 additions & 4 deletions clients/python/sliderule/earthdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,10 +790,11 @@ def search(parm, resources=None):
cmr_kwargs = {}

# Pull Out Polygon
if "clusters" in parm and parm["clusters"] and len(parm["clusters"]) > 0:
cmr_kwargs['polygon'] = parm["clusters"]
elif "poly" in parm and parm["poly"] and len(parm["poly"]) > 0:
cmr_kwargs['polygon'] = parm["poly"]
if "use_poly_for_cmr" not in parm or parm["use_poly_for_cmr"]:
if "clusters" in parm and parm["clusters"] and len(parm["clusters"]) > 0:
cmr_kwargs['polygon'] = parm["clusters"]
elif "poly" in parm and parm["poly"] and len(parm["poly"]) > 0:
cmr_kwargs['polygon'] = parm["poly"]

# Pull Out Time Period
if "t0" in parm:
Expand Down
4 changes: 3 additions & 1 deletion docs/rtd/source/user_guide/ICESat-2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,16 @@ The ancillary field parameters allow the user to request additional fields from

* ``"atl03_geo_fields"``: fields in the "geolocation" and "geophys_corr" groups of the ATL03 granule
* ``"atl03_ph_fields"``: fields in the "heights" group of the ATL03 granule
* ``"atl06_fields"``: fields in the "land_ice_segments" group of the ATL06 granule

For example:

.. code-block:: python
parms = {
"atl03_geo_fields": ["solar_elevation"],
"atl03_ph_fields": ["pce_mframe_cnt"]
"atl03_ph_fields": ["pce_mframe_cnt"],
"atl06_fields": ["ground_track/ref_azimuth"]
}
2.6 PhoREAL parameters
Expand Down
15 changes: 15 additions & 0 deletions docs/rtd/source/user_guide/SlideRule.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ 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
* ``"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.
* ``"use_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:

.. code-block:: python
Expand All @@ -137,6 +141,9 @@ For example:
{"lon": -107.7818591266989, "lat": 39.26613714985466},
{"lon": -108.3605610678553, "lat": 39.25086131372244},
{"lon": -108.3435200747503, "lat": 38.89102961045247} ]
parms = {
"poly": region['poly']
}
In order to facilitate other formats, the ``sliderule.toregion`` function can be used to convert polygons from the GeoJSON and Shapefile formats into this format accepted by `SlideRule`.

Expand All @@ -147,6 +154,8 @@ There is no limit to the number of points in the polygon, but note that as the n

One of the outputs of the ``sliderule.toregion`` function is a GeoJSON object that describes the region of interest. It is available under the ``"raster"`` element of the returned dictionary.

* ``"raster"``: geojson describing region of interest, enables use of rasterized region for subsetting

When supplied in the parameters sent in the request, the server side software forgoes using the polygon for subsetting operations, and instead builds a raster of the GeoJSON object using the specified cellsize, and then uses that raster image as a mask to determine which points in the source datasets are included in the region of interest.

For regions of interest that are complex and include many holes where a single track may have multiple intesecting and non-intersecting segments, the rasterized subsetting function is much more performant at the cost of the resolution of the subsetting operation.
Expand Down Expand Up @@ -292,6 +301,12 @@ The default set of parameters used by SlideRule are set to match anticipated use
* - ``"poly"``
- String, JSON
-
* - ``"proj"``
- String
-
* - ``"use_poly_for_cmr"``
- Boolean
- True
* - ``"raster"``
- String, JSON
-
Expand Down

0 comments on commit 81ffae6

Please sign in to comment.