diff --git a/.github/workflows/default-tests.yml b/.github/workflows/default-tests.yml index ff039fe9..08ee54c6 100644 --- a/.github/workflows/default-tests.yml +++ b/.github/workflows/default-tests.yml @@ -9,13 +9,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] os: [windows-latest, ubuntu-latest, macos-latest] - experimental: [false] - include: - - python-version: "3.12" - os: "ubuntu-latest" - experimental: true fail-fast: false defaults: run: @@ -35,11 +30,6 @@ jobs: --file test_requirements.txt --channel conda-forge - - name: Install unstable dependencies - if: matrix.experimental == true - run: | - micromamba install conda-forge/label/numpy_dev::numpy - - name: Install compliance-checker run: | python -m pip install -e . --no-deps --force-reinstall diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7cbe1199..3a3ecd05 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,7 +31,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.6 + rev: v0.5.0 hooks: - id: ruff diff --git a/compliance_checker/cf/cf_1_6.py b/compliance_checker/cf/cf_1_6.py index d7fa6906..2bf0f74a 100644 --- a/compliance_checker/cf/cf_1_6.py +++ b/compliance_checker/cf/cf_1_6.py @@ -925,7 +925,7 @@ def _check_valid_standard_units(self, ds, variable_name): # IMPLEMENTATION CONFORMANCE 4.4 REQUIRED 1/2 elif standard_name == "time": valid_standard_units.assert_true( - util.units_convertible(units, "seconds since 1970-01-01"), + cfutil.units_convertible(units, "seconds since 1970-01-01"), "time must be in a valid units format since " f"not {units}", ) @@ -1694,7 +1694,7 @@ def check_dimensional_vertical_coordinate( "there is no default", ) - if not util.units_convertible("bar", units): + if not cfutil.units_convertible("bar", units): valid_vertical_coord.assert_true( positive in ("up", "down"), f"{name}: vertical coordinates not defining pressure must include " diff --git a/compliance_checker/cf/util.py b/compliance_checker/cf/util.py index 591a7b3e..9443eb33 100644 --- a/compliance_checker/cf/util.py +++ b/compliance_checker/cf/util.py @@ -9,6 +9,8 @@ from lxml import etree from netCDF4 import Dataset +from compliance_checker.cfutil import units_convertible + # copied from paegan # paegan may depend on these later _possiblet = { @@ -325,17 +327,6 @@ def units_known(units): return True -def units_convertible(units1, units2, reftimeistime=True): - """Return True if a Unit representing the string units1 can be converted - to a Unit representing the string units2, else False.""" - try: - u1 = Unit(units1) - u2 = Unit(units2) - except ValueError: - return False - return u1.is_convertible(u2) - - def units_temporal(units): try: u = Unit(units) diff --git a/compliance_checker/tests/test_cf.py b/compliance_checker/tests/test_cf.py index 5e13bb7b..3db25d2d 100644 --- a/compliance_checker/tests/test_cf.py +++ b/compliance_checker/tests/test_cf.py @@ -29,7 +29,6 @@ download_cf_standard_name_table, is_time_variable, is_vertical_coordinate, - units_convertible, units_temporal, ) from compliance_checker.suite import CheckSuite @@ -1903,8 +1902,8 @@ def test_check_cell_methods(self): # -------------------------------------------------------------------------------- def test_temporal_unit_conversion(self): - self.assertTrue(units_convertible("hours", "seconds")) - self.assertFalse(units_convertible("hours", "hours since 2000-01-01")) + self.assertTrue(cfutil.units_convertible("hours", "seconds")) + self.assertFalse(cfutil.units_convertible("hours", "hours since 2000-01-01")) def test_units_temporal(self): self.assertTrue(units_temporal("hours since 2000-01-01")) diff --git a/pyproject.toml b/pyproject.toml index 94920af3..9bb30233 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,7 @@ entry-points."compliance_checker.suites"."acdd-1.3" = "compliance_checker.acdd:A entry-points."compliance_checker.suites"."cf-1.6" = "compliance_checker.cf.cf:CF1_6Check" entry-points."compliance_checker.suites"."cf-1.7" = "compliance_checker.cf.cf:CF1_7Check" entry-points."compliance_checker.suites"."cf-1.8" = "compliance_checker.cf.cf:CF1_8Check" +entry-points."compliance_checker.suites"."cf-1.9" = "compliance_checker.cf.cf:CF1_9Check" entry-points."compliance_checker.suites"."ioos-0.1" = "compliance_checker.ioos:IOOS0_1Check" entry-points."compliance_checker.suites"."ioos-1.1" = "compliance_checker.ioos:IOOS1_1Check" entry-points."compliance_checker.suites"."ioos-1.2" = "compliance_checker.ioos:IOOS1_2Check"