Skip to content

Commit

Permalink
Merge branch 'main' of github.com:SlideRuleEarth/sliderule
Browse files Browse the repository at this point in the history
  • Loading branch information
elidwa committed Oct 23, 2024
2 parents 91209f5 + 93fc823 commit 2f7c245
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion clients/nodejs/sliderule/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@sliderule/sliderule",
"type": "module",
"description": "client for the SlideRule on-demand science data processing service",
"version": "4.8.1",
"version": "4.8.3",
"keywords": [
"sliderule"
],
Expand Down
4 changes: 2 additions & 2 deletions clients/python/sliderule/sliderule.py
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ def toregion(source, tolerance=0.0, cellsize=0.01, n_clusters=1):
"poly": [{"lat": <lat1>, "lon": <lon1> }, ...],
"region_mask": {"data": <geojson file as string>,
"raster": {"data": <geojson file as string>,
"clusters": [[{"lat": <lat1>, "lon": <lon1>}, ...], [{"lat": <lat1>, "lon": <lon1>}, ...]] }
Expand Down Expand Up @@ -1564,7 +1564,7 @@ def toregion(source, tolerance=0.0, cellsize=0.01, n_clusters=1):
"gdf": gdf,
"poly": polygon, # convex hull of polygons
"clusters": clusters, # list of polygon clusters for cmr request
"region_mask": {
"raster": {
"geojson": datafile, # geojson file
"length": len(datafile), # geojson file length
"cellsize": cellsize # units are in crs/projection
Expand Down
2 changes: 1 addition & 1 deletion clients/python/tests/test_geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_atl03(self, init):
region = sliderule.toregion(os.path.join(TESTDIR, testfile))
parms = {
"poly": region["poly"],
"region_mask": region["region_mask"],
"region_mask": region["raster"],
"srt": icesat2.SRT_LAND,
"cnf": icesat2.CNF_SURFACE_HIGH,
"ats": 10.0,
Expand Down
2 changes: 1 addition & 1 deletion clients/python/tests/test_subsetting.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_rasterize(self, init):
region = sliderule.toregion(os.path.join(TESTDIR, "data/grandmesa.geojson"))
parms = {
"poly": region['poly'],
"region_mask": region['region_mask'],
"region_mask": region['raster'],
"srt": icesat2.SRT_LAND,
"cnf": icesat2.CNF_SURFACE_LOW,
"ats": 20.0,
Expand Down
2 changes: 1 addition & 1 deletion clients/python/utils/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def atl06_no_sample_arcticdem():
def atl03_rasterized_subset():
parms = {
"poly": region['poly'],
"region_mask": region['region_mask'],
"region_mask": region['raster'],
"srt": icesat2.SRT_LAND,
"cnf": icesat2.CNF_SURFACE_LOW,
"ats": 20.0,
Expand Down
2 changes: 1 addition & 1 deletion clients/python/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def initialize_client(args):
region = sliderule.toregion(cfg["region"])
parms["poly"] = region['poly']
if cfg["region_mask"]:
parms["region_mask"] = region['region_mask']
parms["region_mask"] = region['raster']

# Add Ancillary Fields
if len(cfg['atl03_geo_fields']) > 0:
Expand Down
2 changes: 1 addition & 1 deletion clients/python/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v4.8.1
v4.8.3
2 changes: 0 additions & 2 deletions datasets/bathy/package/BathyCoastnetClassifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
* INCLUDES
******************************************************************************/

#include <ATL24_coastnet/precompiled.h>
#include <ATL24_coastnet/utils.h>
#include <ATL24_coastnet/coastnet.h>

#include "ContainerRunner.h"
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 @@ -156,7 +156,7 @@ 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 ``"region_mask"`` element of the returned dictionary.

* ``"region_mask"``: geojson describing region of interest, enables use of rasterized region for subsetting
* ``"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.

Expand All @@ -169,7 +169,7 @@ The example code below shows how this option can be enabled and used (note, the
region = sliderule.toregion('examples/grandmesa.geojson', cellsize=0.02)
parms = {
"poly": region['poly'],
"region_mask": region['region_mask']
"region_mask": region['raster']
}
5.3 Time
Expand Down
2 changes: 2 additions & 0 deletions packages/core/RequestFields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ RequestFields::RequestFields(lua_State* L, uint64_t key_space, const std::initia
#ifdef __geo__
{GeoFields::PARMS, &samplers},
#endif
// deprecated
{"raster", &regionMask},
})
{
// set key space
Expand Down
24 changes: 12 additions & 12 deletions scripts/extensions/proxy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ local function proxy(resources, parms_tbl, endpoint, rec)
end
end

-- Populate Resources via CMR Request --
if not resources then
local rc, rsps = earthdata.cmr(parms_tbl)
if rc == earthdata.SUCCESS then
resources = rsps
userlog:alert(core.INFO, core.RTE_INFO, string.format("request <%s> retrieved %d resources from CMR", rspq, #resources))
else
userlog:alert(core.CRITICAL, core.RTE_SIMPLIFY, string.format("request <%s> failed to make CMR request <%d>: %s", rspq, rc, rsps))
return
end
end

-- Create Request Parameters --
local parms = core.parms(parms_tbl)

Expand Down Expand Up @@ -73,18 +85,6 @@ local function proxy(resources, parms_tbl, endpoint, rec)
-- Determine Locks per Node --
local locks_per_node = (parms["poly"] and not parms["ignore_poly_for_cmr"]) and 1 or core.MAX_LOCKS_PER_NODE

-- Populate Resources via CMR Request --
if not resources then
local rc, rsps = earthdata.cmr(parms)
if rc == earthdata.SUCCESS then
resources = rsps
userlog:alert(core.INFO, core.RTE_INFO, string.format("request <%s> retrieved %d resources from CMR", rspq, #resources))
else
userlog:alert(core.CRITICAL, core.RTE_SIMPLIFY, string.format("request <%s> failed to make CMR request <%d>: %s", rspq, rc, rsps))
return
end
end

-- Proxy Request --
local endpoint_proxy = core.proxy(endpoint, resources, json.encode(parms_tbl), node_timeout, locks_per_node, rsps_from_nodes, terminate_proxy_stream, cluster_size_hint)

Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v4.8.1
v4.8.3

0 comments on commit 2f7c245

Please sign in to comment.