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

_given_on(p, name, year, kept)

p with name given on the years kept of year only.

test_a_parameter_covering_one_year_of_two_is_refused(...)

test_a_parameter_with_a_nan_default_may_cover_some_years(...)

An investment ceiling for 2040 only: nan reads as no ceiling.

test_a_nan_on_some_cells_of_a_year_is_not_a_coverage_gap(...)

One technology without a fixed cost in 2040 is not a missing year.

test_a_flexible_demand_may_start_in_a_later_year(...)

A nan in the flexibility profiles reads as "no flexible demand".

test_a_disabled_module_is_not_checked(...)

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)

p with name given on the years kept of year only.

The parameter is broadcast over year first, 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 years nan – exactly what a CSV or an assign that 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.