Skip to content

Commit

Permalink
Pin pandas to avoid broken round function (#2305)
Browse files Browse the repository at this point in the history
Co-authored-by: Valeriu Predoi <[email protected]>
  • Loading branch information
schlunma and valeriupredoi authored Jan 22, 2024
1 parent d6008f3 commit b72da76
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies:
- netcdf4
- numpy !=1.24.3
- packaging
- pandas
- pandas !=2.2.0 # github.com/ESMValGroup/ESMValCore/pull/2305
- pillow
- pip !=21.3
- prov
Expand Down
5 changes: 2 additions & 3 deletions esmvalcore/cmor/_fixes/icon/icon.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,8 @@ def _fix_invalid_time_units(time_coord):
# it to correct units. Note: we also round to next second, otherwise
# this results in times that are off by 1s (e.g., 13:59:59 instead of
# 14:00:00).
new_datetimes = (year_month_day + day_float).round(
'S'
).dt.to_pydatetime()
rounded_datetimes = (year_month_day + day_float).round('s')
new_datetimes = np.array(rounded_datetimes.dt.to_pydatetime())
new_dt_points = date2num(np.array(new_datetimes), new_t_units)

# Modify time coordinate in place
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
'netCDF4',
'numpy!=1.24.3',
'packaging',
'pandas',
'pandas!=2.2.0', # github.com/ESMValGroup/ESMValCore/pull/2305
'pillow',
'prov',
'psutil',
Expand Down

0 comments on commit b72da76

Please sign in to comment.