From 7a82c8c6e9c044e801d835ff5ee3ec6496511f04 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Thu, 7 Nov 2024 13:24:06 +0100 Subject: [PATCH] remove compare_unit_types --- compliance_checker/cf/util.py | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/compliance_checker/cf/util.py b/compliance_checker/cf/util.py index 9443eb33..1b592829 100644 --- a/compliance_checker/cf/util.py +++ b/compliance_checker/cf/util.py @@ -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[:]