climada.trajectories.snapshot module#

class climada.trajectories.snapshot.Snapshot(*, exposure: Exposures, hazard: Hazard, impfset: ImpactFuncSet, date: date | str | Timestamp, measure: Measure | None = None, ref_only: bool = False)[source]#

Bases: object

A snapshot of exposure, hazard, and impact function at a specific date.

Parameters:
  • exposure (Exposures)

  • hazard (Hazard)

  • impfset (ImpactFuncSet)

  • date (datetime.date | str | pd.Timestamp) – The date of the Snapshot, it can be an string representing a year, a datetime object or a string representation of a datetime object.

  • measure (Measure | None, default None.) – Measure associated with the Snapshot. The measure object is not applied to the other parameters of the object (Exposure, Hazard, Impfset). To create a Snapshot with a measure use apply_measure() instead (see notes). The use of anything but None should be reserved for advanced users.

  • ref_only (bool, default False) – Should the Snapshot contain deep copies of the Exposures, Hazard and Impfset (False) or references only (True).

date#

Date of the snapshot.

Type:

datetime

measure#

A possible measure associated with the snapshot.

Type:

Measure | None

Notes

Providing a measure to the init assumes that the (Exposure, Hazard, Impfset) triplet already corresponds to the triplet once the measure is applied. Measure objects contain “the changes to apply”. Creating a consistent Snapshot with a measure should be done by first creating a Snapshot with the “baseline” (Exposure, Hazard, Impfset) triplet and calling <Snapshot>.apply_measure(<measure>), which returns a new Snapshot object with the measure applied.

Instantiating a Snapshot with a measure directly does not garantee the consistency between the triplet and the measure, and should be avoided.

If ref_only is True (default) the object creates deep copies of the exposure, hazard, and impact function set.

Also note that exposure, hazard and impfset are read-only properties. Consider snapshots as immutable objects.

__init__(*, exposure: Exposures, hazard: Hazard, impfset: ImpactFuncSet, date: date | str | Timestamp, measure: Measure | None = None, ref_only: bool = False) None[source]#
property exposure: Exposures#

Exposure data for the snapshot.

property hazard: Hazard#

Hazard data for the snapshot.

property impfset: ImpactFuncSet#

Impact function set data for the snapshot.

property measure: Measure | None#

(Adaptation) Measure data for the snapshot.

property date: Timestamp#

Date of the snapshot.

property impact_calc_kwargs: dict#

Convenience function for ImpactCalc class.

apply_measure(measure: Measure) Snapshot[source]#

Create a new snapshot by applying a Measure object.

This method creates a new Snapshot object by applying a measure on the current one.

Parameters:

measure (Measure) – The measure to be applied to the snapshot.

Return type:

The Snapshot with the measure applied.