Skip to content

Commit

Permalink
converge on cf-units to reduce code change
Browse files Browse the repository at this point in the history
  • Loading branch information
ocefpaf committed Nov 14, 2024
1 parent 59dcc36 commit 9991912
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions compliance_checker/cf/cf_1_6.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ def _check_valid_cf_units(self, ds, variable_name):
# being expressed as "s"/seconds
if standard_name not in {"time", "forecast_reference_time"}:
valid_units.assert_true(
units_conv.is_convertible_to(cfutil._units(reference)),
units_conv.is_convertible(cfutil._units(reference)),
f'Units "{units}" for variable '
f"{variable_name} must be convertible to "
f'canonical units "{reference}"',
Expand Down Expand Up @@ -2849,7 +2849,7 @@ def _cell_measures_core(self, ds, var, external_set, variable_template):
valid = False
reasoning.append(conversion_failure_msg)
else:
if not cell_measure_units.is_convertible_to(
if not cell_measure_units.is_convertible(
cfutil._units(f"m{exponent}"),
):
valid = False
Expand Down
3 changes: 0 additions & 3 deletions compliance_checker/cfunits.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
class CFUnitMixin:
"""Standardize the methods from cf-untis and pyudunits2 used in compliance-checker."""

def is_convertible_to(self, other):
return self.is_convertible(other)

def expand_definition(self):
return self.definition

Expand Down
2 changes: 1 addition & 1 deletion compliance_checker/cfutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -2044,4 +2044,4 @@ def units_convertible(units1, units2):
u2 = _units(units2)
except ValueError:
return False
return u1.is_convertible_to(u2)
return u1.is_convertible(u2)

0 comments on commit 9991912

Please sign in to comment.