rubem.configuration.output_raster_base.OutputRasterBase

class OutputRasterBase(base_raster_path=None, georeference_path=None, must_match=(), allow_rotation=True, **data)[source]

Bases: BaseModel

Geometry and coordinate reference system of the output raster series.

The geometry (size and affine transform) comes from the DEM, which every other raster of the simulation must share. A separate georeference raster may supply the coordinate reference system, and its geometry must equal the DEM’s in every one of the six affine components; when both carry a CRS, they must describe the same one.

Build it with from_file() (or the equivalent positional call OutputRasterBase(dem_path, ...)).

Parameters:
  • cols – Number of columns.

  • rows – Number of rows.

  • transformation – The six affine components (GDAL order).

  • projection – CRS as WKT, empty when unknown.

  • base_raster – Path of the DEM the geometry was read from.

  • georeference – Path of the georeference raster, if any.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Methods

from_file

Read the geometry from the DEM and check the related rasters.

Attributes

is_rotated

Whether the affine transform has rotation or shear terms.

cols

rows

transformation

projection

base_raster

georeference

classmethod from_file(base_raster_path, georeference_path=None, must_match=(), allow_rotation=True)[source]

Read the geometry from the DEM and check the related rasters.

Parameters:
  • base_raster_path (str | PathLike[str] | bytes) – The DEM.

  • georeference_path (str | PathLike[str] | bytes | None) – Optional raster whose CRS is written to the output GeoTIFFs. Defaults to None: the DEM’s own CRS, if any.

  • must_match (Iterable[tuple[str, str | PathLike[str] | bytes]]) – (label, path) pairs of rasters that must share the DEM geometry (the clone, for instance).

  • allow_rotation (bool) – Whether a rotated or sheared affine transform is acceptable. PCRaster maps are north-up only, so a run that writes them must refuse rotation.

Raises:

ValueError – On a geometry, CRS or rotation mismatch.

Return type:

OutputRasterBase

property is_rotated: bool

Whether the affine transform has rotation or shear terms.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].