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 rasterFunctions¶
sample¶
sliderule.raster.sample(asset, coordinates, parms={}, crs='EPSG:4326')Sample a raster dataset at the coordinates provided
Parameters
asset (str) data source asset
coordinates (list) list of coordinates as [longitude, latitude]
parms (dict) dictionary of sampling parameters
crs (str) coordinate reference system to use in GeoDataFrame
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
asset (str) data source asset
extents (list) list of extent coordinates as [minimum longitude, minimum latitude, maximum longitude, maximum latitude]
parms (dict) dictionary of sampling parameters
crs (str) coordinate reference system to use in GeoDataFrame
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"]})