diff --git a/climada/hazard/test/test_base_xarray.py b/climada/hazard/test/test_base_xarray.py index f6d600435..53e8217e6 100644 --- a/climada/hazard/test/test_base_xarray.py +++ b/climada/hazard/test/test_base_xarray.py @@ -72,7 +72,7 @@ def _assert_default_values(self, hazard): self.assertEqual(hazard.units, "") np.testing.assert_array_equal(hazard.event_id, [1, 2]) np.testing.assert_array_equal( - hazard.event_name, [np.datetime64(val) for val in self.time] + hazard.event_name, [str(x) for x in hazard.event_id] ) np.testing.assert_array_equal( hazard.date, [val.toordinal() for val in self.time] @@ -342,9 +342,7 @@ def test_missing_dims(self): ds = ds.isel(time=0).squeeze() hazard = Hazard.from_xarray_raster(ds, "", "") self._assert_default_types(hazard) - np.testing.assert_array_equal( - hazard.event_name, [np.datetime64(self.time[0])] - ) + np.testing.assert_array_equal(hazard.date, [self.time[0].toordinal()]) np.testing.assert_array_equal(hazard.centroids.lat, [0, 0, 0, 1, 1, 1]) np.testing.assert_array_equal(hazard.centroids.lon, [0, 1, 2, 0, 1, 2]) @@ -369,9 +367,6 @@ def test_missing_dims(self): ds = ds.expand_dims(time=[np.datetime64("2022-01-01")]) hazard = Hazard.from_xarray_raster(ds, "", "") self._assert_default_types(hazard) - np.testing.assert_array_equal( - hazard.event_name, [np.datetime64("2022-01-01")] - ) np.testing.assert_array_equal( hazard.date, [dt.datetime(2022, 1, 1).toordinal()] )