raster

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

from sliderule import raster

sample

sliderule.raster.sample(asset, coordinates, parms={})[source]

Sample a raster dataset at the coordinates provided

Parameters:
  • asset (str) – data source asset (see Assets)

  • coordinates (list) – list of coordinates as [longitude, latitude]

  • parms (dict) – dictionary of sampling parameters

Returns:

geolocated sampled values along with metadata

Return type:

GeoDataFrame

Examples

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

subset

sliderule.raster.subset(asset, extents, parms={})[source]

Subset a raster dataset at the extent coordinates provided

Parameters:
  • asset (str) –

    data source asset (see Assets)

  • extents (list) – list of extent coordinates as [minimum longitude, minimum latitude, maximum longitude, maximum latitude]

  • parms (dict) – dictionary of sampling parameters

Returns:

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

Return type:

list

Examples

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