RasterSource#
- class RasterSource[source]#
Bases:
ABC
A source of raster data.
This should be subclassed when adding a new source of raster data such as a set of files, an API, a TMS URI schema, etc.
Attributes
Bounding box applied to the source imagery.
Associated
CRSTransformer
.numpy.dtype
of the chips read from this source.Extent of the
RasterSource
.Number of channels in the chips read from this source.
Shape of the raster as a (height, width, num_channels) tuple.
- __init__(channel_order: Optional[List[int]], num_channels_raw: int, bbox: Box, raster_transformers: List[RasterTransformer] = [])[source]#
Constructor.
- Parameters
channel_order (Optional[List[int]]) – list of channel indices to use when extracting chip from raw imagery.
num_channels_raw (int) – Number of channels in the raw imagery before applying channel_order.
bbox (Box) – Extent or a crop of the extent.
raster_transformers (List[RasterTransformer]) –
RasterTransformers
for transforming chips whenever they are retrieved. Defaults to[]
.
Methods
__init__
(channel_order, num_channels_raw, bbox)Constructor.
get_chip
(window[, out_shape])Return the transformed chip in the window.
get_chip_by_map_window
(window_map_coords[, ...])Same as get_chip(), but input is a window in map coords.
get_raw_chip
(window[, out_shape])Return raw chip without applying channel_order or transforms.
resize
(chip[, out_shape])set_bbox
(bbox)Set self.bbox to the given value.
- __init__(channel_order: Optional[List[int]], num_channels_raw: int, bbox: Box, raster_transformers: List[RasterTransformer] = [])[source]#
Constructor.
- Parameters
channel_order (Optional[List[int]]) – list of channel indices to use when extracting chip from raw imagery.
num_channels_raw (int) – Number of channels in the raw imagery before applying channel_order.
bbox (Box) – Extent or a crop of the extent.
raster_transformers (List[RasterTransformer]) –
RasterTransformers
for transforming chips whenever they are retrieved. Defaults to[]
.
- get_chip(window: Box, out_shape: Optional[Tuple[int, int]] = None) ndarray [source]#
Return the transformed chip in the window.
Get a raw chip, extract subset of channels using channel_order, and then apply transformations.
- get_chip_by_map_window(window_map_coords: Box, out_shape: Optional[Tuple[int, int]] = None) ndarray [source]#
Same as get_chip(), but input is a window in map coords.
- get_raw_chip(window: Box, out_shape: Optional[Tuple[int, int]] = None) ndarray [source]#
Return raw chip without applying channel_order or transforms.
- set_bbox(bbox: Box) None [source]#
Set self.bbox to the given value.
Note
This method is idempotent.
- Parameters
bbox (Box) – User-specified bbox in pixel coordinates.
- Return type
None
- abstract property crs_transformer: CRSTransformer#
Associated
CRSTransformer
.