diff --git a/climada_petals/hazard/river_flood.py b/climada_petals/hazard/river_flood.py index fda43718f..35f7e5587 100644 --- a/climada_petals/hazard/river_flood.py +++ b/climada_petals/hazard/river_flood.py @@ -235,9 +235,11 @@ def from_nc(cls, dph_path=None, frc_path=None, origin=False, with xr.open_dataset(dph_path) as flood_dph: haz.date = np.array([ - dt.datetime(flood_dph.time[i].dt.year, - flood_dph.time[i].dt.month, - flood_dph.time[i].dt.day).toordinal() + dt.datetime( + flood_dph.time.dt.year.values[i], + flood_dph.time.dt.month.values[i], + flood_dph.time.dt.day.values[i], + ).toordinal() for i in event_index ]) diff --git a/climada_petals/hazard/tc_rainfield.py b/climada_petals/hazard/tc_rainfield.py index a2774a247..35446330b 100644 --- a/climada_petals/hazard/tc_rainfield.py +++ b/climada_petals/hazard/tc_rainfield.py @@ -151,8 +151,10 @@ def _from_track(track, centroids, dist_degree=3, intensity_thres=0.1): new_haz.fraction.data.fill(1) # store date of start new_haz.date = np.array([dt.datetime( - track.time.dt.year[0], track.time.dt.month[0], - track.time.dt.day[0]).toordinal()]) + track.time.dt.year.values[0], + track.time.dt.month.values[0], + track.time.dt.day.values[0], + ).toordinal()]) new_haz.orig = np.array([track.orig_event_flag]) new_haz.category = np.array([track.category]) new_haz.basin = [str(track.basin.values[0])]