Engine
This module manages interactions between other raster modules.
It serves as the core dispatch mechanism for raster processing.
AggregationType
Bases: Enum
Strategies for combining results from chunked processing.
Source code in src/phytospatial/raster/engine.py
DispatchConfig
Configuration object for the execution engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
Union[ProcessingMode, str]
|
ProcessingMode to enforce ('in_memory', 'tiled', 'blocked', 'auto'). |
'auto'
|
tile_size
|
int
|
Size of tiles/windows for streaming (in pixels). Default=512. |
512
|
overlap
|
int
|
Overlap between tiles/windows (in pixels). Default=0. |
0
|
output_path
|
Optional[Union[str, Path]]
|
Optional path to save output raster (required for STITCH). |
None
|
aggregation
|
AggregationType
|
AggregationType for combining results. Default=STITCH. |
STITCH
|
reducer
|
Optional[Callable[[Any, Any], Any]]
|
Optional function for REDUCE aggregation. |
None
|
Source code in src/phytospatial/raster/engine.py
dispatch(func, input_map, static_args=(), static_kwargs=None, config=None)
Execute a function over raster inputs using the optimal strategy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable
|
The function to execute. Must accept raster objects as arguments. |
required |
input_map
|
Dict[str, Union[str, Path, Raster]]
|
Dictionary mapping argument names to raster sources. {'raster_a': 'file1.tif', 'raster_b': 'file2.tif'} |
required |
static_args
|
Tuple
|
Positional arguments to pass to func (passed through). |
()
|
static_kwargs
|
Dict
|
Keyword arguments to pass to func (passed through). |
None
|
config
|
DispatchConfig
|
Execution configuration (Mode, Tiling, Aggregation). |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The result of the processing (Path, List, or Value). |