Skip to content

Commit 8c5d253

Browse files
authored
Add support for freshly downloaded ERA5 hourly data (#3087)
1 parent 6d4aa72 commit 8c5d253

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

esmvalcore/cmor/_fixes/native6/era5.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ def fix_hourly_time_coordinate(cube, frequency):
3333
# variables from ERA5 may lead to some differences.
3434
if frequency.startswith("1hr"):
3535
time = cube.coord(axis="T")
36-
if str(time.units).startswith("hours since"):
36+
if str(time.units).startswith("seconds since"):
37+
shift = 1800.0
38+
elif str(time.units).startswith("hours since"):
3739
shift = 0.5
3840
elif str(time.units).startswith("days since"):
3941
shift = 1.0 / 48.0

tests/integration/cmor/_fixes/native6/test_era5.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,8 @@ def evspsbl_era5_hourly():
408408
(_era5_longitude(), 2),
409409
],
410410
)
411+
# Test time units of newly downloaded ERA5 data (2026-05-20)
412+
cube.coord("time").convert_units("seconds since 1970-01-01")
411413
return CubeList([cube])
412414

413415

0 commit comments

Comments
 (0)