Open mncosta opened 1 month ago
Thanks for reporting this. The simplest is to always use integers for impact function ids. We might update this in the future and require integers for the impact function ids.
We are also in the process of revising the measure class and will for sure fix this in the process.
In many cases, using a string as ID might work, but we generally assume that the IDs are integers. Therefore, I suggest we continue not enforcing a type, but update the docs of ImpactFunc
such that id
is expected to be int
.
Describe the bug When applying a measure that aims to map from one impact function to another, error is thrown if impact functions
id
are not of typeint
. Yet from the docs,id
could be of typeint | str
.To Reproduce Steps to reproduce the behavior/error:
imp_fun_map
set to change a impact function with a strid
, i.e., "HZtoHZ1"Why doesn't the param
imp_fun_map
receive atuple(int | str, int |str)
, just like the other params:hazard_inten_imp
:tuple(float, float)
mdd_impact
:tuple(float, float)
paa_impact
:tuple(float, float)
This would enable having either int or str as types of impact functions
id
, and one would bypass the need to parse the stringimp_fun_map
as well?Code example (following the first example on the docs)
Expected behavior Impact function
id
on the new exposure objecto should be mapped to newid
even ifid
s are strings.Screenshots
Climada Version: 4.1.0
System Information (please complete the following information):
Additional context None