5.3. pypfilt.sweep

The pypfilt.sweep module iterates over forecast scenarios defined in any number of scenario files.

5.3.1. Forecast scenarios

pypfilt.sweep.forecasts(configs, load_obs=True)

Iterate over the forecast settings for each scenario.

Parameters:
Return type:

Iterator[Forecasts]

class pypfilt.sweep.Forecasts

Forecast settings.

Parameters:
  • scenario_id (str) – The scenario identifier.
  • scenario_name (str) – A descriptive name for the scenario.
  • params (dict) – The simulation parameters.
  • all_observations (List[dict]) – All of the available observations.
  • List[Sequence[dict]] – observation_streams: The observations, separated into streams for each observation model.
  • file_descriptor (str) – A descriptor to identify files associated with these forecasts.
  • config_strings (List[str]) – The contents of the configuration files in the forecasting sweep.
scenario_id

Alias for field number 0

scenario_name

Alias for field number 1

params

Alias for field number 2

observation_models

Alias for field number 3

all_observations

Alias for field number 4

observation_streams

Alias for field number 5

file_descriptor

Alias for field number 6

config_strings

Alias for field number 7

5.3.2. Forecasting in parallel

The pypfilt.sweep module also provides support for running forecasts across multiple Python processes:

pypfilt.sweep.forecasts_mp(configs)

Iterate over the forecast settings for each scenario, yielding tuples that can be serialised and sent to other Python processes. Each process can then retrieve the associated Forecasts value by calling get_forecasts_mp().

Parameters:configs (Union[pypfilt.config.Config, Sequence[pypfilt.config.Config]]) – The forecasting configuration(s).
pypfilt.sweep.get_forecasts_mp(mp_tuple, load_obs=True)

Return the forecast settings for a tuple yielded by forecasts_mp().

Parameters:
  • mp_tuple – A value returned by forecasts_mp().
  • load_obs (bool) – Whether to load observations from disk.
Return type:

Forecasts