Skip to content

Commit

Permalink
Merge pull request #1119 from ocefpaf/break_the_code
Browse files Browse the repository at this point in the history
is this covered by the tests?
  • Loading branch information
ocefpaf authored Nov 14, 2024
2 parents cf12cf4 + 7a82c8c commit aa4ea81
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions compliance_checker/cf/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,36 +392,6 @@ def is_vertical_coordinate(var_name, var):
return satisfied


def compare_unit_types(specified, reference):
"""
Compares two unit strings via UDUnits
:param str specified: The specified unit
:param str reference: The reference unit which to compare against
"""
msgs = []
err_flag = False
try:
specified_unit = Unit(specified)
except ValueError:
msgs.append(f"Specified conversion unit f{specified} may not be valid UDUnits")
err_flag = True

try:
reference_unit = Unit(reference)
except ValueError:
msgs.append(f"Specified conversion unit f{reference} may not be valid UDUnits")
err_flag = True

if err_flag:
return msgs

unit_convertible = specified_unit.is_convertible(reference_unit)
fail_msg = [f'Units "{specified}" are not convertible to "{reference}"']
return msgs if unit_convertible else fail_msg


def string_from_var_type(variable):
if isinstance(variable, str):
return variable[:]
Expand Down

0 comments on commit aa4ea81

Please sign in to comment.