Skip to content

Commit

Permalink
ensure list of event names is flat
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah-hlsn committed Nov 17, 2023
1 parent 30464ee commit c6d83bc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion climada/hazard/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ def maybe_repeat(values: np.ndarray, times: int) -> np.ndarray:
None,
np.ones(num_events),
np.array(range(num_events), dtype=int) + 1,
list(data[coords["event"]].dt.strftime("%Y-%m-%d")),
data[coords["event"]].dt.strftime("%Y-%m-%d").values.flatten().tolist(),
np.array(u_dt.datetime64_to_ordinal(data[coords["event"]].values)),
],
# The accessor for the data in the Dataset
Expand Down
1 change: 1 addition & 0 deletions climada/hazard/test/test_base_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ def test_2D_time(self):
np.testing.assert_array_equal(
hazard.date, [val.toordinal() for val in time.flat]
)
np.testing.assert_array_equal(hazard.event_name, ["1999-01-01", "1999-02-01", "2000-01-01", "2000-02-01"])

def test_errors(self):
"""Check if expected errors are thrown"""
Expand Down

0 comments on commit c6d83bc

Please sign in to comment.