Skip to content

Commit eae214e

Browse files
committed
Manual fixes
1 parent 7e41997 commit eae214e

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

esmvalcore/cmor/_fixes/fix.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -854,25 +854,21 @@ def _fix_time_units(self, cube: Cube, cube_coord: Coord) -> None:
854854

855855
branch_parent = "branch_time_in_parent"
856856
if branch_parent in attrs:
857-
try:
857+
# Overflow happens when the time is very large.
858+
with contextlib.suppress(OverflowError):
858859
attrs[branch_parent] = parent_units.convert(
859860
attrs[branch_parent],
860861
cube_coord.units,
861862
)
862-
except OverflowError:
863-
# This happens when the time is very large.
864-
pass
865863

866864
branch_child = "branch_time_in_child"
867865
if branch_child in attrs:
868-
try:
866+
# Overflow happens when the time is very large.
867+
with contextlib.suppress(OverflowError):
869868
attrs[branch_child] = old_units.convert(
870869
attrs[branch_child],
871870
cube_coord.units,
872871
)
873-
except OverflowError:
874-
# This happens when the time is very large.
875-
pass
876872

877873
def _fix_time_bounds(self, cube: Cube, cube_coord: Coord) -> None:
878874
"""Fix time bounds."""

esmvalcore/cmor/_fixes/native6/era5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ def fix_metadata(self, cubes):
535535
class AllVars(Fix):
536536
"""Fixes for all variables."""
537537

538-
def _fix_coordinates(self, cube):
538+
def _fix_coordinates(self, cube): # noqa: C901
539539
"""Fix coordinates."""
540540
# Add scalar height coordinates
541541
if "height2m" in self.vardef.dimensions:

esmvalcore/cmor/fix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
logger = logging.getLogger(__name__)
2626

2727

28-
def fix_file(
28+
def fix_file( # noqa: PLR0913
2929
file: Path,
3030
short_name: str,
3131
project: str,

0 commit comments

Comments
 (0)