RasterSupport#

class hydromodpy.spatial.RasterSupport(crs=None, dx=None, dy=None, xmin=None, xmax=None, ymin=None, ymax=None, nrows=None, ncols=None, nodata=None)[source]#

Bases: object

Minimal spatial support for one raster-like 2D array.

This object stores the spatial metadata independently from the raster values themselves. It is intentionally limited to the metadata already available in HydroModPy’s current geographic workflow.

Attributes#

crsstr | None

Coordinate reference system identifier (for example "EPSG:2154").

dx, dyfloat | None

Cell size along the x and y directions. Keeping two distinct values avoids assuming square cells.

xmin, xmax, ymin, ymaxfloat | None

Spatial extent of the raster support.

nrows, ncolsint | None

Raster shape, when known.

nodatafloat | None

Sentinel value used to mark invalid or absent cells in the raster.

param crs:

type crs:

str | None

param dx:

type dx:

float | None

param dy:

type dy:

float | None

param xmin:

type xmin:

float | None

param xmax:

type xmax:

float | None

param ymin:

type ymin:

float | None

param ymax:

type ymax:

float | None

param nrows:

type nrows:

int | None

param ncols:

type ncols:

int | None

param nodata:

type nodata:

float | None

classmethod from_georeferencing(georeferencing, *, shape=None, nodata=None)[source]#

Build one raster support from an explicit georeferencing mapping.

Return type:

RasterSupport

Parameters:

Expected input#

The expected keys match the historical Domain.georeferencing payload: crs, dx, dy, xmin, xmax, ymin, ymax.

Optional extra metadata can be injected through: - shape, to populate nrows and ncols, - nodata, to store the raster nodata sentinel.

param georeferencing:

type georeferencing:

Mapping[str, object] | None

param shape:

type shape:

tuple[int, int] | None

param nodata:

type nodata:

float | None

as_georeferencing_dict()[source]#

Return the historical Domain.georeferencing view of this support.

Only the keys already used by Domain are exported here: crs, dx, dy, xmin, xmax, ymin, ymax.

Return type:

dict[str, object]

assert_complete_domain()[source]#

Validate that this support has all metadata required to compare domains.

A complete domain definition requires: - CRS, - extent (xmin, xmax, ymin, ymax), - raster shape (nrows, ncols).

Return type:

None

assert_same_geographic_domain(other, *, atol=1e-09)[source]#

Ensure two raster supports represent exactly the same geographic domain.

This comparison checks: - CRS equality (string-normalized), - extent equality (xmin, xmax, ymin, ymax) within atol.

Parameters:
Return type:

None

Parameters: