spaemis.config

Configuration

The configuration is stored as YAML files and can be loaded and validated using load_config().

ExcludeScaleMethod

class ExcludeScaleMethod[source]

Bases: object

Config for ExcludeScaler

See also

spaemis.scaling.ExcludeScaler

ConstantScaleMethod

class ConstantScaleMethod(scale_factor=1.0)[source]

Bases: object

Config for ConstantScaler

See also

spaemis.scaling.ConstantScaler

RelativeChangeMethod

class RelativeChangeMethod(source_id, variable_id, sector)[source]

Bases: object

Config for RelativeChangeScaler

See also

spaemis.scaling.RelativeChangeScaler

ProxyMethod

class ProxyMethod(source_id, variable_id, sector, proxy)[source]

Bases: object

Config for ProxyScaler

See also

spaemis.scaling.ProxyScaler

TimeseriesMethod

class TimeseriesMethod(proxy, source_timeseries, source_filters, proxy_region=None)[source]

Bases: object

Config for TimeseriesScaler

See also

spaemis.scaling.TimeseriesScaler

PointSourceMethod

class PointSourceMethod(point_sources, source_timeseries, source_filters)[source]

Bases: object

Config for PointSourceScaler

See also

spaemis.scaling.PointSourceScaler

VariableScalerConfig

class VariableScalerConfig(variable, sector, method, allow_missing=False)[source]

Bases: object

Represents a mapping between a variable/sector and a scaler

In some cases, the target data may not exist in an inventory. In that case the scaler should be configured correctly to be able to handle that situation.

variable

Name of the target variable in the inventory

sector

Name of the target sector in the inventory

allow_missing

If True, the data may not be present in an inventory

InputTimeseries

class InputTimeseries(name, path, filters)[source]

Bases: object

Timeseries declaration

PointSource

class PointSource(variable, sector, location, quantity, unit='kg')[source]

Bases: object

Configuration for a single point source

PointSourceDefinition

class PointSourceDefinition(sources=_Nothing.NOTHING, source_files=None)[source]

Bases: object

Set of point sources to apply

Loads other point sources from file if specified

ScalerDefinition

class ScalerDefinition(default_scaler=ExcludeScaleMethod(), scalers=_Nothing.NOTHING, source_files=None)[source]

Bases: object

Set of scalers to apply

Loads other scalers from file if specified

Inventory

class Inventory(name, year)[source]

Bases: object

Define the inventory used for this scenario

DownscalingScenarioConfig

class DownscalingScenarioConfig(name, inventory, timeslices, scalers, input_timeseries=None, point_sources=None)[source]

Bases: object

Configuration for downscaling a scenario

load_config

load_config(config_file)[source]

Load and parse configuration from a file

Any filenames referenced in the configuration are relative to the configuration file not the current directory.

Parameters:

config_file (str) – File to read

Returns:

spaemis.config.DownscalingScenarioConfig – Validated configuration

get_path

get_path(output_dir, rel_path=None)[source]

Get a path from the directory

If the directory doesn’t already exist, it is created

Parameters:
  • output_dir (str | PathLike[str]) – target directory

  • rel_path (str | PathLike[str] | None) – Path within output_dir

Returns:

str – Path of the output file

get_default_results_dir

get_default_results_dir(config_path)[source]

Get the default output path for a given configuration file

Defaults to data/runs/{OUTPUT_VERSION}/{CONFIG_FILE_NAME}. This function does not create that directory if it doesn’t already exist.

Parameters:

config_path (str) –

Raises:

FileNotFoundError – If config_path doesn’t exist

Returns:

strOutput directory for results