MISO2 Checks
Collection of value checks.
@author: bgrammer
- preprocessing.checks.MISO2_checks.check_buffer_year(parameter_dict)
Check that last year of input data is an all-zero buffer year.
To correctly calculate mass-balances, we need to have a buffer year at the end of our input time series. This is usually achieved by simply setting the model runtime in ODYM’s master classification to
include an additional year.
- Parameters:
parameter_dict (dict) – Dictionary of ODYM parameters
- Raises:
ValueError – If no buffer year is provided.
- preprocessing.checks.MISO2_checks.check_enduse_values(enduses, enduse_selectors, non_enduse_selectors, error_tolerance=None)
Checks validity of MISO2 Enduse parameter.
Enduses must sum up to exactly 1 for non-aggregate materials and must be zero for aggregates.
- Parameters:
enduses (msc.Parameter) – ODYM-parameter of enduses
enduse_selectors (list) – Indices of materials for which enduses need to sum up to 1.
non_enduse_selectors (list) – Indices of materials that need to sum up to 0.
error_tolerance (float) – Value by which enduse sums may diverge from 1. This defaults to machine epsilon (float) times the number of enduses.
- Raises:
EnduseSummationError – When validity of enduses is violated.
- preprocessing.checks.MISO2_checks.check_exclusive_values(parameter_dict, exclusive_parameters)
Checks for two parameters files if their values are mutually exclusive.
When an array has a value set greater than zero, it must be zero in the other array and vice versa.
- Parameters:
parameter_dict (dict) – Dict of ODYM parameters.
exclusive_parameters (list) – List of tuples that give the name of the exclusive parameters.
- preprocessing.checks.MISO2_checks.check_limits(parameter_dict, uncertainty_settings)
Checks if all parameter values are within the specified hard limits.
- Parameters:
parameter_dict (dict) – A dictionary of ODYM Parameters containing src WasteRates.
uncertainty_settings (dict) – A dictionary with parameter names as keys, containing dictionaries of Min,Max and Type with their respective values.
- Raises:
InputLimitError – When any parameter value is below the given minimum or above the given maximum limit.
- preprocessing.checks.MISO2_checks.check_mutually_exclusive_arrays(values, mode='normal')
Given values, check that their value holding (> 0) indices are mutually exclusive. In normal mode, this compares the list in successive order. In other modes, a dict with specified keywords is expected.
- Parameters:
values (list/dict) – List of tuples holding array name and np.array
dict ((normal mode) or)
mode (str) – Mode for comparison. One of “normal” (values may not overlap) or “downcycling”
- Raises:
ValueOverlapError – If mutually exclusive values are found.
- preprocessing.checks.MISO2_checks.check_waste_ratios(parameter_dict)
Checks MISO2 waste rate ratios of recovered and unrecovered and throws a WasteRateException when they exceed 100%. This likely happens in the context of Monte-Carlo randomization.
- Parameters:
parameter_dict (dict) – A dictionary of ODYM Parameters containing src WasteRates.
- Raises:
WasteRateError – When the sum of recov and unrecov values of a process exceed 1.