reV.config.curtailment.Curtailment

class Curtailment(curtailment_parameters)[source]

Bases: BaseConfig

Config for generation curtailment.

Parameters:

curtailment_parameters (str | dict) – Configuration json file (with path) containing curtailment information. Could also be a pre-extracted curtailment config dictionary (the contents of the curtailment json).

Methods

check_files(flist)

Make sure all files in the input file list exist.

check_overwrite_keys(primary_key, ...)

Check for overwrite keys and raise a ConfigError if present

clear()

copy()

fromkeys([value])

Create a new dictionary with keys from iterable and values set to value.

get(key[, default])

Return the value for key if key is in the dictionary, else default.

items()

keys()

pop(k[,d])

If key is not found, d is returned if given, otherwise KeyError is raised

popitem()

Remove and return a (key, value) pair as a 2-tuple.

resolve_path(path)

Resolve a file path represented by the input string.

set_self_dict(dictlike)

Save a dict-like variable as object instance dictionary items.

setdefault(key[, default])

Insert key with a value of default if key is not in the dictionary.

str_replace_and_resolve(d, str_rep)

Perform a deep string replacement and path resolve in d.

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

Attributes

REQUIREMENTS

Required keys for config

STR_REP

Mapping of config inputs (keys) to desired replacements (values) in addition to relative file paths as demarcated by ./ and ../

config_dir

Get the directory that the config file is in.

config_keys

List of valid config keys

date_range

Get the date range tuple (start, end) over which curtailment is possible (inclusive, exclusive) ("MMDD", "MMDD").

dawn_dusk

Get the solar zenith angle that signifies dawn and dusk.

equation

Get an equation-based curtailment scenario.

log_level

Get user-specified "log_level" (DEBUG, INFO, WARNING, etc...).

months

Get the months during which curtailment is possible (inclusive).

name

Get the job name, defaults to 'rev'.

precipitation

Get the precip rate (mm/hour) under which curtailment is possible.

probability

Get the probability that curtailment is in-effect if all other screening criteria are met.

random_seed

Random seed to use for curtailment probability

temperature

Get the temperature (C) over which curtailment is possible.

wind_speed

Get the wind speed threshold below which curtailment is possible.

property wind_speed

Get the wind speed threshold below which curtailment is possible.

Returns:

_wind_speed (float | None) – Wind speed threshold below which curtailment is possible.

property dawn_dusk

Get the solar zenith angle that signifies dawn and dusk.

Returns:

_dawn_dusk (float) – Solar zenith angle at dawn and dusk. Default is nautical, 12 degrees below the horizon (sza=102).

property months

Get the months during which curtailment is possible (inclusive). This can be overridden by the date_range input.

Returns:

months (tuple | None) – Tuple of month integers. These are the months during which curtailment could be in effect. Default is None.

property date_range

Get the date range tuple (start, end) over which curtailment is possible (inclusive, exclusive) (“MMDD”, “MMDD”). This overrides the months input.

Returns:

date_range (tuple) – Two-entry tuple of the starting date (inclusive) and ending date (exclusive) over which curtailment is possible. Input format is a zero-padded string: “MMDD”.

property temperature

Get the temperature (C) over which curtailment is possible.

Returns:

temperature (float | NoneType) – Temperature over which curtailment is possible. Defaults to None.

property precipitation

Get the precip rate (mm/hour) under which curtailment is possible.

Returns:

precipitation (float | NoneType) – Precipitation rate under which curtailment is possible. This is compared to the WTK resource dataset “precipitationrate_0m” in mm/hour. Defaults to None.

property equation

Get an equation-based curtailment scenario.

Returns:

equation (str) – A python equation based on other curtailment variables (wind_speed, temperature, precipitation_rate, solar_zenith_angle) that returns a True or False output to signal curtailment.

property probability

Get the probability that curtailment is in-effect if all other screening criteria are met.

Returns:

probability (float) – Fractional probability that curtailment is in-effect if all other screening criteria are met. Defaults to 1 (curtailment is always in effect if all other criteria are met).

property random_seed

Random seed to use for curtailment probability

Returns:

int

REQUIREMENTS = ()

Required keys for config

STR_REP = {'REVDIR': '/home/runner/work/reV/reV/reV', 'TESTDATADIR': '/home/runner/work/reV/reV/tests/data'}

Mapping of config inputs (keys) to desired replacements (values) in addition to relative file paths as demarcated by ./ and ../

static check_files(flist)

Make sure all files in the input file list exist.

Parameters:

flist (list) – List of files (with paths) to check existance of.

check_overwrite_keys(primary_key, *overwrite_keys)

Check for overwrite keys and raise a ConfigError if present

Parameters:
  • primary_key (str) – Primary key that overwrites overwrite_keys, used for error message

  • overwrite_keys (str) – Key(s) to overwrite

clear() None.  Remove all items from D.
property config_dir

Get the directory that the config file is in.

Returns:

config_dir (str) – Directory path that the config file is in.

property config_keys

List of valid config keys

Returns:

list

copy() a shallow copy of D
fromkeys(value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)

Return the value for key if key is in the dictionary, else default.

items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
property log_level

Get user-specified “log_level” (DEBUG, INFO, WARNING, etc…).

Returns:

log_level (int) – Python logging module level (integer format) corresponding to the config-specified log level string.

property name

Get the job name, defaults to ‘rev’.

Returns:

name (str) – reV job name.

pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

resolve_path(path)

Resolve a file path represented by the input string.

This function resolves the input string if it resembles a path. Specifically, the string will be resolved if it starts with “./” or “..”, or it if it contains either “./” or “..” somewhere in the string body. Otherwise, the string is returned unchanged, so this function is safe to call on any string, even ones that do not resemble a path.

This method delegates the “resolving” logic to pathlib.Path.resolve(). This means the path is made absolute, symlinks are resolved, and “..” components are eliminated. If the path input starts with “./” or “..”, it is assumed to be w.r.t the config directory, not the run directory.

Parameters:

path (str) – Input file path.

Returns:

str – The resolved path.

set_self_dict(dictlike)

Save a dict-like variable as object instance dictionary items.

Parameters:

dictlike (dict) – Python namespace object to set to this dictionary-emulating class.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

str_replace_and_resolve(d, str_rep)

Perform a deep string replacement and path resolve in d.

Parameters:
  • d (dict) – Config dictionary potentially containing strings to replace and/or paths to resolve.

  • str_rep (dict) – Replacement mapping where keys are strings to search for and values are the new values.

Returns:

d (dict) – Config dictionary with updated strings.

update([E, ]**F) None.  Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() an object providing a view on D's values