SlideRuleEarth / sliderule

Server and client framework for on-demand science data processing in the cloud
https://slideruleearth.io
Other
27 stars 12 forks source link

Put querying the catalog for raster datasets inside the API functions in the client #300

Closed jpswinski closed 1 year ago

jpswinski commented 1 year ago

In order to get a sampling request to work, the user must first query the appropriate stac server or tnm api to get a catalog of available data to pass along to sliderule.

This process needs to be automatically handled by the client so that the user does not need to do it.

For example the code below:

region = sliderule.toregion("bbox_utqiagvik.geojson")["poly"]
geojson = earthdata.tnm(short_name='Digital Elevation Model (DEM) 1 meter', polygon=region)
parms = {
    "poly": region,
    "cnf": -2,
    "ats": 5.0,
    "cnt": 3,
    "len": 10.0,
    "res": 10.0,    
    "samples" : {
            "dem_stats": {"asset": "usgs3dep-1meter-dem", "catalog": geojson}
        }
}
atl06_sr = icesat2.atl06p(parms, "icesat2")

Could be changed so that the call to earthdata.tnm is performed automatically inside the icesat2.atl06p call.

dshean commented 1 year ago

Suggest adding a quick visualization of the returned tiles and the region in the notebook...

tnm_gdf = gpd.read_file(geojson)
f, ax = plt.subplots()
tnm_gdf.plot(ax=ax, alpha=0.5)
region['gdf'].plot(ax=ax, facecolor='none')
3dep_gedi_sa… (5) - JupyterLab 2023-08-10 17-14-02
jpswinski commented 1 year ago

This has been implemented for the icesat2 and gedi APIs. The added earthdata.search function is used to automatically populate catalogs for rasters that want to be sampled.