From 631ed066a055f681c4163e7a7e574494790b5327 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 20:47:52 +0000 Subject: [PATCH 1/5] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.6 → v0.4.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.6...v0.4.7) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7cbe1199..64ae8fbe 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.4.7 hooks: - id: ruff From 5870e4d5c3cfda0a9c23cf580dcd8f8e037fd3c7 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Tue, 18 Jun 2024 08:54:57 +0200 Subject: [PATCH 2/5] We no longer need this part, np2 was released. --- .github/workflows/default-tests.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) 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 From e86d8865abffb4d9f5a7662947bd437be9aebc33 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Thu, 20 Jun 2024 18:33:06 +0200 Subject: [PATCH 3/5] remove duplicated function --- compliance_checker/cf/cf_1_6.py | 4 ++-- compliance_checker/cf/util.py | 13 ++----------- compliance_checker/tests/test_cf.py | 5 ++--- 3 files changed, 6 insertions(+), 16 deletions(-) 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")) From 69fe8ab301dee8e69b6fbc5714d509082b4a73b1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 21:53:19 +0000 Subject: [PATCH 4/5] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.7 → v0.5.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.7...v0.5.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 64ae8fbe..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.7 + rev: v0.5.0 hooks: - id: ruff From c46b541dbff9ce7f6680b2bad3c0223f94323c02 Mon Sep 17 00:00:00 2001 From: Benjamin Adams Date: Thu, 11 Jul 2024 11:54:31 -0400 Subject: [PATCH 5/5] Add missing CF 1.9 checker to pyproject.toml --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) 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"