pommes.tests.test_year_coverage
Coverage of the model’s years by the year-indexed parameters (#118).
Inside a dataset every variable shares the year coordinates, so a parameter
given for only some years is nan over the whole slice of the others.
check_inputs refuses it when nan has no meaning for the parameter
(finite schema default), and lets it through when nan reads as “no limit”
or “no profile”.
Functions
|
|
|
An investment ceiling for 2040 only: nan reads as no ceiling. |
|
One technology without a fixed cost in 2040 is not a missing year. |
A nan in the flexibility profiles reads as "no flexible demand". |
|
The model does not read the parameters of a module that is off. |
Module Contents
- pommes.tests.test_year_coverage._given_on(p, name, year, kept)
pwithnamegiven on the yearskeptofyearonly.The parameter is broadcast over
yearfirst, so that the test does not depend on whether the fixture carries the dimension, then assigned back with fewer years: xarray aligns it on the dataset’s index, leaving the other yearsnan– exactly what a CSV or anassignthat stops short produces.
- pommes.tests.test_year_coverage.test_a_parameter_covering_one_year_of_two_is_refused(parameters_simple_conversion, name, year, kept, missing)
- pommes.tests.test_year_coverage.test_a_parameter_with_a_nan_default_may_cover_some_years(parameters_simple_conversion)
An investment ceiling for 2040 only: nan reads as no ceiling.
- pommes.tests.test_year_coverage.test_a_nan_on_some_cells_of_a_year_is_not_a_coverage_gap(parameters_conversion)
One technology without a fixed cost in 2040 is not a missing year.
Such a gap is the modules’ business, as before: the coverage check only looks at whole years.
- pommes.tests.test_year_coverage.test_a_flexible_demand_may_start_in_a_later_year(parameters_simple_conversion)
A nan in the flexibility profiles reads as “no flexible demand”.
Their default is 0, yet add_flexibility masks them with
isfinite: a flexibility given from 2040 on only is a dataset main accepted, and the coverage check must not refuse it.
- pommes.tests.test_year_coverage.test_a_disabled_module_is_not_checked(parameters_simple_storage, enabled)
The model does not read the parameters of a module that is off.