Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions climada/trajectories/calc_risk_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,12 @@ def calc_eai_gdf(self) -> pd.DataFrame:

"""

metric_df = pd.DataFrame(self.per_date_eai, index=self._date_idx)
metric_df = pd.DataFrame(
self.per_date_eai,
index=self._date_idx,
columns=self.snapshots[0].exposure.gdf.index,
Comment on lines +260 to +261

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh, i don't quite understand the idea behind having both, self._date_idx and self.date_idx, especially in the combination with the @data_idx.setter - nevertheless: why not index=self.date_idx?,

@emanuel-schmid emanuel-schmid Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the only relevant difference to the develop branch seems to be the explicit setting of columns. however, there is no hint to the rationale in the PR description.

)

metric_df = metric_df.reset_index().melt(
id_vars=DATE_COL_NAME, var_name=COORD_ID_COL_NAME, value_name=RISK_COL_NAME
)
Expand Down Expand Up @@ -868,7 +873,11 @@ def calc_eai_gdf(self) -> pd.DataFrame:
(notably for `value` and `group_id`).

"""
metric_df = pd.DataFrame(self.per_date_eai, index=self.date_idx)
metric_df = pd.DataFrame(
self.per_date_eai,
index=self._date_idx,
columns=self.snapshot_start.exposure.gdf.index,
)
metric_df = metric_df.reset_index().melt(
id_vars=DEFAULT_PERIOD_INDEX_NAME,
var_name=COORD_ID_COL_NAME,
Expand Down
Loading