Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

raster

The SlideRule Python API raster.py is used to sample and (in the future) subset raster datasets registered with SlideRule. See Raster Sampling for more details. From Python, the module can be imported via:

from sliderule import raster

Functions

sample

sliderule.raster.sample(asset, coordinates, parms={}, crs='EPSG:4326')

Sample a raster dataset at the coordinates provided

Parameters

Returns

GeoDataFrame

geolocated sampled values along with metadata

Examples

>>> import sliderule
>>> gdf = sliderule.sample("arctidcem-mosaic", [[-178.0,51.7]])

subset

sliderule.raster.subset(asset, extents, parms={}, crs='EPSG:4326')

Subset a raster dataset at the extent coordinates provided

Parameters

Returns

list

list of 2D numpy arrays containing the values of the subsetted raster

Examples

>>> import sliderule
>>> gdf = sliderule.subset("landsat-hls", [[-179.87, 50.45, -178.77, 50.75]], {"bands": ["B02"]})