rasterinlay.distribute¶
- class CombineTypes(value)[source]¶
Bases:
enum.IntEnum
Specifies how the constraints should act on the raster data.
For land-coverage the combine type can be
fill
orcoverage
.- coverage = 2¶
Indicates the fraction of cells within the bounding box that should be covered. Using this combine type only bounding boxes in which all cells have the same value are processed.
- fill = 1¶
A cell value indicates the fraction within this cell. With this combine type an inlay will first compute the total amount of land coverage within a bounding box and then try to redistribute the amount within the cells.
- class InvalidCellsIn(value)[source]¶
Bases:
enum.IntEnum
Used to indicate where invalid (or outside) cells should be detected.
- constraints = 2¶
Check for invalid cells in the constraints block.
- none = 0¶
Indicates that there are no invalid (or outside) cells.
- raster = 1¶
Check for invalid cells in the raster block.
- exclude_invalid(inlay_form: Union[Tuple[slice, slice], numpy.ndarray], raster: numpy.ndarray, constraints: numpy.ndarray, invalid_in: rasterinlay.distribute.InvalidCellsIn, invalid_value: Union[int, float], inplace: bool = True)[source]¶
Get raster and constraints data in inlay_form excluding invalid cells
Warning
Incomplete and unused function.
- fraction_inlay(raster_block: numpy.ndarray, const_block: numpy.ndarray, cell_unit: Union[int, float] = 1, cell_max: int = 100, invalid_in: rasterinlay.distribute.InvalidCellsIn = InvalidCellsIn.none, invalid_value: int = 254) Tuple[numpy.ndarray, Optional[int]] [source]¶
Redistribute the values in
raster_block
to avoid collision with the values inconst_block
- Returns
- np.ndarray:
The inlayed raster block.
- Union[int, None]:
The capacity remaining in the raster block.
Note
A value below zero indicates a jammed block. The actual amount gives the excess data from the
raster_block
that could no longer be fitted in.
- Return type
- imprint_constraints(raster, constraints, bblocks, inlay_callback_kwargs: dict, data_type: rasterinlay.distribute.CombineTypes = CombineTypes.fill) Tuple[dict, dict] [source]¶
Warning
Function in under construction.
- inlay(raster: numpy.ndarray, constraints: numpy.ndarray, inlay_bbox: Tuple[slice, slice], set_inlay: Callable[[numpy.ndarray, numpy.ndarray], Tuple[numpy.ndarray, numpy.ndarray]], set_inlay_kwargs: dict) Union[float, bool] [source]¶
Todo
Exclude values in the raster for invalid cells defined in constraints.
- Parameters
invalid_value – Cells with this value are considered as masked and completely excluded
- Returns
The remaining capacity within the form. A negative value indicates that the inlay_form could not accommodate the data from raster completely.
- Return type