Unifying
unify_raster_grids(base_raster, rasters_to_unify, resampling_method='nearest', same_extent=False)
Unifies (reprojects, resamples, aligns and optionally clips) given rasters relative to base raster.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_raster |
DatasetReader
|
The base raster to determine target raster grid properties. |
required |
rasters_to_unify |
Sequence[DatasetReader]
|
Rasters to be unified with the base raster. |
required |
resampling_method |
Literal[nearest, bilinear, cubic, average, gauss, max, min]
|
Resampling method. Most suitable method depends on the dataset and context. Nearest, bilinear and cubic are some common choices. This parameter defaults to nearest. |
'nearest'
|
same_extent |
bool
|
If the unified rasters will be forced to have the same extent/bounds as the base raster. Expands smaller rasters with nodata cells. Defaults to False. |
False
|
Returns:
Type | Description |
---|---|
List[Tuple[ndarray, dict]]
|
List of unified rasters' data and metadata. First element is the base raster. |
Raises:
Type | Description |
---|---|
InvalidParameterValueException
|
Rasters to unify is empty. |
Source code in eis_toolkit/raster_processing/unifying.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|