Replies: 5 comments 9 replies
-
Comments from @chahank from the PR (and responses to):
This is non-trivial, and using
Indeed,
The
I thought it could be too long, but was also in favour.
I thought of a case where it can go wrong, but I realize now that it shouldn't be a problem. |
Beta Was this translation helpful? Give feedback.
-
(ping @emanuel-schmid) Regarding the Instead of merging them in Furthermore, I am only raising an error, if there is a "really conflicting" impact function (i.e., one that is strictly different for the exact same hazard and id) |
Beta Was this translation helpful? Give feedback.
-
Notes (for myself mostly):
As such, we cannot compute the "risk components" (Change in risk due to change in Hazard, change in Exposure and the interaction term (change in both), but only the change due to Exposure and change due to Hazard (With interaction). |
Beta Was this translation helpful? Give feedback.
-
Would it make more sense to linearly interpolate the log of the impact matrices, and then power it back when we assume the exposure to grow exponentially? |
Beta Was this translation helpful? Give feedback.
-
Beta-testing feedback (first test)This is based only on running the climada_trajectories.ipynb tutorial, and not yet a testing with my own data or an analysis of the code from the module.First off, it runs through smoothly for me and I really like the Class structure with Snapshots being combined into RiskTrajectories :) I have two main questions.
And two small comments regarding plots:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This discussion relates to PR #1037 which aims at implementing
RiskTrajectory
objects to ease the evaluation of risk / impact in between two points in time.Overview of the new functionalities, decisions taken, and remarks
The following goes deeper in the technical aspects than the notebook.
Snapshot
classIts purpose is to hold
Exposures
,Hazard
andImpactFuncSet
objects for a specificdatetime.date
.It is intended as a data holding class.
It may also be useful as a "container" class in the future?
There are almost no advanced functionalities at the moment. If you have ideas feel free to list them!
Applying measures
Snapshot.apply(meas)
can be used to apply aMeasure
object, thus creating a newSnapshot
object with relevant changes inExposures
,Hazard
andImpactFuncSet
, as well as setting itsmeasure
attribute tomeas
.Note that this is functional only with the updated
Measures
objects withinfeature/cb_refactoring
.RiskPeriod
classIts purpose is to compute the impact in between two given snapshots. It is intended as an internal computing class, and might even be made private.
Given two snapshots
present
andfuture
, and a time frequencyfreq
(say a year) we compute the impacts at afreq
interval betweenpresent
andfuture
. This is done by computing fourImpact
objects corresponding to the four possible combination ofExposures
andHazard
betweenpresent
andfuture
(Each time using the impact functions associated with theExposures
used). To these four impacts possible risk transfer is applied (not tested yet).Then from these four impacts, two lists of impacts matrices are computed using linear interpolation (for each year for instance):
Exposures
to futureExposures
with presentHazard
.Exposures
to futureExposures
with futureHazard
.These two lists are used by
RiskTrajectory
to compute risk metrics (explained further ahead)ImpactFuncSet
handlingTo allow different impact functions between
present
andfuture
, thefuture
Exposures
can be assigned to different impact functions. TheImpactFuncSet
however, needs to be the same for both, and basically contain all the impact functions. For user-friendliness (but that can be argued against), if differentImpactFuncSet
are used, they are merged together, using the functions fromfuture
when conflicting functions (and warning the user).Interpolation efficiency
interpolate_imp_mat
should a priori be the main source for computation requirement, if you have ideas on how to improve its efficiency these are most welcomed!RiskTrajectory
classIt is the main class for this module, and builds on the previous two. It is instantiated with at least a list of
Snapshot
, from which it generates a list ofRiskPeriod
by iterating it pairwise, and possibly:DiscRate
) object to be applied to compute net present (discounted) risk value at the different dates.Exposures
objects)How are metrics computed
Basically all the "magic" is in the
impact_mixer()
: we compute the different metrics for each of the impact matrix from the two interpolation lists, and compute the linear interpolation of the metric from this. (I can go in more details if wanted).The results are saved in a private tidy DataFrame (where one row == one value), which is only recomputed if relevant.
What is accessible
Most attribute are private, or read-only to avoid having an inconsistent object.
Mostly the metrics (either on a per date or per risk period basis) are accessible, via
per_date_risk_metrics
andtotal_risk_metrics
. Note that these two apply the discount rate if it is notNone
, but that the underlying private methods accept a boolean argument for that.Beta Was this translation helpful? Give feedback.
All reactions