diff --git a/docs/input_requirement.md b/docs/input_requirement.md index d59d18b..f73a135 100644 --- a/docs/input_requirement.md +++ b/docs/input_requirement.md @@ -100,7 +100,7 @@ Each variable declares the following properties: | `max_nan` | `int` | both | The model's **tolerance**: max NaNs it can cope with in the series (must be >= 0). **SAP3 enforces this as a pre-`predict` gate** — if exceeded, the model is not called and the station is failed (`DATA_AVAILABILITY`); within tolerance, residual NaNs are delivered **as-is** for the model to handle (decision 1.13). | | `ensemble_mode`| `EnsembleMode` | future_known | Whether ensemble or single traces are needed (`single` or `ensemble`, default: `single`) | | `unit` | `Unit` | both | **Required.** The physical unit the model expects this variable in (e.g. `Unit.MM_PER_DAY`). The delivered series is tagged with its unit and delivered **in the declared unit, or rejected loudly at integration** — no data without units. (Automatic unit conversion is a future adapter feature.) | -| `aggregation` | `AggregationMethod \| None` | both | **Optional.** `SUM` or `MEAN`, used when the declared resolution is coarser than the delivered data. Defaults to the per-parameter convention (precipitation / reference_et = `SUM`; state variables = `MEAN`); declare only to override. | +| `aggregation` | `AggregationMethod \| None` | both | **Optional.** `SUM`, `MEAN` or `MAX`, used when the declared resolution is coarser than the delivered data. Defaults to the per-parameter convention (precipitation / reference_et = `SUM`; state variables = `MEAN`); declare only to override. | --- @@ -112,7 +112,7 @@ These three are a single coherent concern (mirroring SAP3's `ParameterDefinition **Units.** Every input variable declares the `unit` it expects (see properties table); outputs declare units via `TargetSpec` / `VariableMetadata`. The `Unit` enum must cover every parameter's unit and is a **sync contract with SAP3's `ParameterDefinition` units** — extended as needed (current additions for forcing: `PERCENT`, `M_PER_S`, `DEGREE`, `W_PER_M2`, `MM_PER_HOUR`). -**Aggregation.** When a model declares a variable at a resolution coarser than the delivered data, SAP3 aggregates with `SUM` or `MEAN`. Default follows the per-parameter convention (precipitation / reference_et = `SUM`; temperature, discharge, SWE and other state variables = `MEAN`); override via the optional `aggregation` property only for a non-default rule. +**Aggregation.** When a model declares a variable at a resolution coarser than the delivered data, SAP3 aggregates with `SUM`, `MEAN` or `MAX` (`MAX` for peak channels, e.g. a window-max discharge a flood threshold is set on). Default follows the per-parameter convention (precipitation / reference_et = `SUM`; temperature, discharge, SWE and other state variables = `MEAN`); override via the optional `aggregation` property only for a non-default rule. ## Static Inputs diff --git a/forecast_interface/__init__.py b/forecast_interface/__init__.py index ba93093..ccd7284 100644 --- a/forecast_interface/__init__.py +++ b/forecast_interface/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.1.18" +__version__ = "0.1.19" from .common import AggregationMethod from .input import ( diff --git a/forecast_interface/common/aggregation.py b/forecast_interface/common/aggregation.py index dc6df68..6e6f3f1 100644 --- a/forecast_interface/common/aggregation.py +++ b/forecast_interface/common/aggregation.py @@ -4,3 +4,4 @@ class AggregationMethod(Enum): SUM = "sum" MEAN = "mean" + MAX = "max" diff --git a/pyproject.toml b/pyproject.toml index 51edc08..864eba6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "forecastinterface" -version = "0.1.18" +version = "0.1.19" description = "Add your description here" readme = "README.md" requires-python = ">=3.11" @@ -25,7 +25,7 @@ init_typed = true warn_required_dynamic_aliases = true [tool.bumpversion] -current_version = "0.1.18" +current_version = "0.1.19" commit = false tag = false allow_dirty = true diff --git a/tests/test_output.py b/tests/test_output.py index 26df01c..f658eba 100644 --- a/tests/test_output.py +++ b/tests/test_output.py @@ -72,9 +72,10 @@ class TestAggregationMethod: def test_members_exist(self) -> None: assert AggregationMethod.SUM.value == "sum" assert AggregationMethod.MEAN.value == "mean" + assert AggregationMethod.MAX.value == "max" def test_member_count(self) -> None: - assert len(AggregationMethod) == 2 + assert len(AggregationMethod) == 3 class TestVariableStatus: diff --git a/uv.lock b/uv.lock index 03ddebc..39aee7b 100644 --- a/uv.lock +++ b/uv.lock @@ -129,7 +129,7 @@ wheels = [ [[package]] name = "forecastinterface" -version = "0.1.18" +version = "0.1.19" source = { virtual = "." } dependencies = [ { name = "polars" },