windisch.array
fill_xarray_from_input_parameters creates an xarray and fills it with sampled input parameter values if a distribution is defined.
Functions
|
Create an xarray labeled array from the sampled input parameters. |
|
Print a warning message in case of misisng parameters for a distribution. |
Override default parameters values in xarray based on values provided by the user. |
- windisch.array.fill_xarray_from_input_parameters(tip: TurbinesInputParameters, sensitivity: bool = False, scope: dict | None = None) Tuple[Tuple, DataArray]
Create an xarray labeled array from the sampled input parameters.
This function extracts the parameters’ names and values contained in the parameters attribute of the
TurbinesInputParametersclass inturbines_input_parametersand insert them into a multi-dimensional numpy-like array from the xarray package (http://xarray.pydata.org/en/stable/).- Parameters:
sensitivity –
tip – Instance of the
TurbinesInputParametersclass inturbines_input_parameters.scope – a dictionary to narrow down the scope of vehicles to consider
- Returns:
tuple, xarray.DataArray
tuple (size_dict, application_dict, parameter_dict, year_dict)
array
Dimensions of array:
Turbine size (in kW), e.g. “100”, “500”. str.
Application, e.g. “onshore”, “offshore”. str.
Year. int.
Samples.
- windisch.array.missing_param_for_distribution(param: str, dist_type: str, year: int)
Print a warning message in case of misisng parameters for a distribution. :param param: input parameter for which the distribution parameter is missing, str. :param dist_type: distribution type, str. :param year: year, int :return: nothing.
- windisch.array.modify_xarray_from_custom_parameters(filepath: str | dict, array: DataArray) DataArray
Override default parameters values in xarray based on values provided by the user.
This function allows to override one or several default parameter values by providing either:
a file path to an Excel workbook that contains the new values
or a dictionary
The dictionary must be of the following format:
{ (parameter category, application, size, parameter name, uncertainty type): { (year, 'loc'): value, (year, 'scale'): value, (year, 'shape'): value, (year, 'minimum'): value, (year, 'maximum'): value } }
For example:
{ ('Operation', 'all', 'all', 'lifetime', 'none'): { (2018, 'loc'): 15, (2040, 'loc'): 25 } }
- Parameters:
array – the array to modify
filepath (str or dict) – File path of workbook with new values or dictionary.
- Returns:
the original array, but modified