5.2. pypfilt.config

The pypfilt.config module allows users to define forecast scenarios in plain-text TOML files.

5.2.1. Reading forecast scenarios

You can use either of the following functions to read forecast scenarios.

pypfilt.config.from_file(toml_path: str) → pypfilt.config.Config

Read a forecast configuration from a TOML file.

pypfilt.config.from_string(toml_string: str) → pypfilt.config.Config

Read a forecast configuration from a string.

Note

You should never need to directly interact with Config values returned by these two functions. The pypfilt and pypfilt.sweep modules provide convenience functions for using them.

5.2.2. Forecast scenario data types

class pypfilt.config.Config

A configuration.

Parameters:
  • scenarios (Dict[str, Scenario]) – Scenario-specific settings.
  • config_string (str) – The configuration file contents.
  • config_toml (dict) – The parsed configuration file contents.
scenarios

Alias for field number 0

config_string

Alias for field number 1

config_toml

Alias for field number 2

class pypfilt.config.Scenario

Scenario-specific settings.

Parameters:
  • name (str) – The scenario name.
  • params_fn (ParamsFn) – A function that returns the simulation parameters.
  • summary_fn (SummaryFn) – A function that defines the summary statistics.
  • summary_args (Dict[str, Any]) – Arguments for the summary statistic function.
  • observation_models (Dict[str, pypfilt.config.ObsModel]) – The observation model settings.
name

Alias for field number 0

params_fn

Alias for field number 1

summary_fn

Alias for field number 2

summary_args

Alias for field number 3

observation_models

Alias for field number 4

class pypfilt.config.ObsModel

Observation model settings.

Parameters:
  • obs_model (obs.Obs) – The observation model.
  • obs_file (str) – The name of the file that contains the observations.
  • file_args (Dict[str, Any]) – Keyword arguments for the observation model’s from_file() method.
  • parameters (Dict[str, float]) – The observation model parameter values.
  • names (Dict[str, str]) – The name to use for each parameter in output file names.
  • formats (Dict[str, str]) – The format specifier to use for each parameter value in output file names.
  • plot_settings (dict) – Settings for interactive forecast plots.
obs_model

Alias for field number 0

obs_file

Alias for field number 1

file_args

Alias for field number 2

parameters

Alias for field number 3

names

Alias for field number 4

formats

Alias for field number 5

plot_settings

Alias for field number 6

pypfilt.config.ParamsFn = typing.Callable[[], dict]

Functions that return simulation parameters.

pypfilt.config.SummaryFn = typing.Callable[..., pypfilt.summary.HDF5]

Functions that define summary statistics.