resolve_n_habitats

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

resolve_n_habitats(habitats_map_folder: str | Path, n_habitats: int | None) → int[source]

Resolve the habitat count for column alignment across the cohort.

Prefers an explicit n_habitats. Otherwise reads habitats.parquet / habitats.csv from the habitat output folder (same source as v0.1).

Parameters:
  • habitats_map_folder – Directory that may contain a habitats results table.

  • n_habitats – Explicit count from config, or None to auto-detect.

Returns:

Positive habitat count.

Raises:

ValueError – If the count cannot be determined.