Conversation
|
Small detail, the referenced issue above, @chahank, does not match the |
| at_event : np.array | ||
| impact for each hazard event | ||
| """ | ||
| return np.squeeze(np.asarray(np.sum(imp_mat, axis=1))) |
There was a problem hiding this comment.
So currently the at_event is calculated from an impact variable (line 1033) which considers potential deductibles, covers etc. The imp_mat does not previously account for those, right? Aka the at_event would have to be modified afterwards, if such conditions exist?
There was a problem hiding this comment.
(similary for eai_exp, etc.)
There was a problem hiding this comment.
Yes, this is then to be added in this method, good point! My issue with the current implementation is that the at_event and eai_exp are computed in a very obscure manner inside of the .calc method.
There was a problem hiding this comment.
Best would probably be to have a class method calc_impact and calc_residual_impact (if with insurance stuff).
There was a problem hiding this comment.
If I am not mistaken, the deductible all act on the impact matrix as implemented right now? Thus, the imp_mat is actually not the risk matrix, but the residual risk matrix after insurance deductibles have been applied.
My suggestion would thus be to disentangle that as it is unclear at the moment.
|
I find this way of defining the attributes very neat and clear, in general. |
|
I missed some of these conversations: what risk are we mitigating here? Are there parts of an Impact object that get out of sync? That is, is there a risk that If that's the case we should consider other options:
Skimming the code for the class, I think the only method that breaks this rule is |
Currently, the |
Yes and no. The problem is not with the modification of the Making the |
|
Thanks @ChrisFairless and @Evelyn-M for the great comments! This is still a very early stage of development, so all your input is very much appreciated. |
|
It's nice these are all static methods as well - it means if you're doing something really janky with impacts you can do it outside of the class |
|
Thanks for the explanation @chahank. These make sense then. Is the idea that |
Not sure yet. Probably not. I would like a generic |
|
Thanks for the discussion! The main points were included in a larger refactoring of the |
|
This pull request was addressed in PR #436 |
This is a first step in an attempt to attack the problem of methods that modify CLIMADA objects in place which can lead to inconsistencies (such as e.g. discussed for the
metaparameter in #348 ). This would also be a step towards better__init__methods as discussed e.g. in #342.Here we add methods that compute the
impactattributesat_event,eai_expandaai_aggdirectly from theimp_matand thefrequency(no testing).These methods are so far not embedded in the rest of the method from the class
impact, but can in a future iteration if this pull request is deemed useful. Furthermore, these methods come in handy for instance in the handling of line and polygons exposures c.f. https://github.com/CLIMADA-project/climada_python/tree/feature/lines_polygons_exp or multi impact yearsets c.f. https://github.com/CLIMADA-project/climada_python/tree/feature/sets .Feedback on the proposed methods would be appreciated.