Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt tc_forecast to climada_python improved hdf5 IO #83

Merged
merged 2 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions climada_petals/hazard/tc_tracks_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,8 @@ def _subset_to_track(msg, index, provider, timestamp_origin, name, id_no):

# can only make latlon coords after dropna
track = track.set_coords(['lat', 'lon'])
track['time_step'] = track.ts_int - \
track.ts_int.shift({'time': 1}, fill_value=0)
track['time_step'] = (track.ts_int - \
track.ts_int.shift({'time': 1}, fill_value=0)).astype(float)

track = track.drop_vars(['ts_int'])

Expand Down
2 changes: 2 additions & 0 deletions climada_petals/hazard/test/test_tc_tracks_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def test_fetch_ecmwf(self):
self.assertEqual(forecast.data[1].lat[2], -27.)
self.assertEqual(forecast.data[0].lon[2], 73.5)
self.assertEqual(forecast.data[1].time_step[2], 6)
self.assertEqual(forecast.data[1].time_step.dtype, np.float64)
self.assertEqual(forecast.data[1].max_sustained_wind[2], 14.9)
self.assertEqual(forecast.data[0].central_pressure[1], 1000.)
self.assertEqual(forecast.data[0]['time.year'][1], 2020)
Expand Down Expand Up @@ -177,6 +178,7 @@ def test_default_xsl(self):
forecast.data[2].run_datetime,
pd.Timestamp('2022-03-02 12:00:00+0000', tz='UTC'),
)
self.assertEqual(forecast.data[1].time_step.dtype, np.float64)
self.assertTrue(forecast.data[4].is_ensemble)

def test_custom_xsl(self):
Expand Down