RasterCollection¶
- class geodesic.raster.RasterCollection(items, dataset=None, download_files=False, delete_when_complete=True)[source]¶
Bases:
object
For operations on a list of rasters (as Items)
A RasterCollection, as the name would suggest, is a collection of raster data. This can be used for working with small raster datasets locally to create temporal stacks and reproject imagery.
- Parameters
items (Sequence[Item]) – a list of STAC items pointing to the imagery
dataset – the Dataset they belong to, if any
download_files – rather than referencing remote files, this will download them locally before processing.
delete_when_complete – if the files were locally downloaded, this will deleted them when computation is done.
- export_rasters(bbox=None, bands=['red', 'green', 'blue'], image_shape=None, pixel_size=None, output_extent_srs='EPSG:4326', output_srs='EPSG:3857', resample='nearest', input_nodata=0, output_nodata=0, output_dtype=<class 'numpy.float32'>, mosaic_threshold=None, time_bins=None, progress_func=<class 'tqdm.std.tqdm'>)[source]¶
prepare a stack of rasters as numpy arrays
This method will locally reproject, resample, and mosaic a list of images
- Parameters
bbox (Optional[Sequence]) – a bounding box for the output imagery, assumed to be in the output_extent_srs
bands (Sequence) – a list of band names or indicies to use from the STAC item
image_shape (Optional[Sequence]) – the shape of the resulting image. Specifiy this or the pixel_size, but not both
pixel_size (Optional[Union[float, Sequence[float]]]) – the size of the output pixels in the output_srs
output_extent_srs (str) – the output extent’s spatial reference
output_srs (str) – the output image’s spatial reference
resample (str) – how to resample the resulting output
input_nodata (Union[int, float]) – values that will be treated as nodata in the input images
output_nodata (Union[int, float]) – values that will be set as nodata on the output
output_dtype (Union[np.dtype, str]) – the dtype of the output numpy array
mosaic_threshold (timedelta) – If images are broken into multiple time bins, this defines how close they must be in time.
time_bins (Optional[Sequence]) – a list of time bins to use when generating the stack
progress_func – something to print the progress of this function (tqdm is default)