riverarchitect.maxlifespan

Best-feature and maximum-lifespan mapping.

The open-source replacement for the ArcGIS MaxLifespan module. Lifespan mapping answers “how long does this feature last here?”. Given the lifespan rasters of several candidate features, this answers the planner’s question instead: which feature belongs here, and how long will it last?

The rule is the one the original used:

  • max_lf is the cell-wise maximum across the feature lifespan rasters;

  • a feature wins a cell where its own lifespan equals that maximum;

  • each winner is written as a mask raster and polygonised, so the result can be drawn as action areas on a map.

Ties are kept rather than broken: a cell where two features both reach the maximum appears in both layers. That is deliberate - it tells the planner the choice is theirs, and it is what the original did.

class riverarchitect.maxlifespan.MaxLifespan(lifespan_dir, features=None, unit='us')[source]

Bases: object

Combine per-feature lifespan rasters into a best-feature assessment.

Parameters:
  • lifespan_dir (str) – directory holding lf_<feature>.tif rasters, normally the output of riverarchitect.lifespan.LifespanDesign.

  • features (list) – feature ids to consider. Defaults to every lf_*.tif present.

  • unit (str) – "us" or "si", for the area unit in the summary.

Variables:

error (bool) – True when at least one feature could not be processed.

property feature_ids

Feature ids that will take part in the assessment.

run(output_dir=None, write_polygons=True)[source]

Compute the maximum-lifespan raster and one best-feature mask per feature.

Returns:

max_lifespan_raster, features (per-feature area and share) and the paths written.

Return type:

dict