Skip to content

Commit

Permalink
Fix for esmpy (SciTools#353)
Browse files Browse the repository at this point in the history
* fix node/element indexing to work with latest esmpy

* fix for codecov

* add coverage code back to nox

* add coverage code back to nox

* add coverage code back to nox don't test 3.9

* remove python 3.9

* remove codecov from nox again

* remove python 3.9 references
  • Loading branch information
stephenworsley authored Apr 23, 2024
1 parent 922669e commit 94f3e05
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 286 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11"]
include:
- python-version: "3.10"
coverage: true
Expand Down Expand Up @@ -97,3 +97,9 @@ jobs:
COVERAGE: ${{ matrix.coverage }}
run: |
nox --session tests -- --verbose
- name: Upload coverage report
uses: codecov/codecov-action@v4
if: ${{ matrix.coverage }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/ci-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10"]
python-version: ["3.10"]
session: ["wheel"]

steps:
Expand Down
8 changes: 3 additions & 5 deletions esmf_regrid/experimental/unstructured_regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,17 @@ def __init__(
if location == "face":
field_kwargs = {"meshloc": esmpy.MeshLoc.ELEMENT}
shape = (len(face_node_connectivity),)
index_offset = self.esi
elif location == "node":
field_kwargs = {"meshloc": esmpy.MeshLoc.NODE}
shape = (len(node_coords),)
index_offset = self.nsi
else:
raise ValueError(
f"The mesh location '{location}' is not supported, only "
f"'face' and 'node' are supported."
)
super().__init__(
shape=shape,
index_offset=index_offset,
index_offset=1,
field_kwargs=field_kwargs,
mask=mask,
)
Expand All @@ -97,10 +95,10 @@ def _as_esmf_info(self):
# the data must be translated into a form ESMF understands
num_node = self.node_coords.shape[0]
num_elem = self.fnc.shape[0]
nodeId = np.array(range(self.nsi, self.nsi + num_node))
nodeId = np.arange(1, num_node + 1)
nodeCoord = self.node_coords.flatten()
nodeOwner = np.zeros([num_node]) # regridding currently serial
elemId = np.array(range(self.esi, self.esi + num_elem))
elemId = np.arange(1, num_elem + 1)
elemType = self.fnc.count(axis=1)
# Experiments seem to indicate that ESMF is using 0 indexing here
elemConn = self.fnc.compressed() - self.nsi
Expand Down
3 changes: 1 addition & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
PACKAGE = "esmf_regrid"

#: GHA-CI environment variable hook.
PY_VER = os.environ.get("PY_VER", ["3.9", "3.10", "3.11"])
PY_VER = os.environ.get("PY_VER", ["3.10", "3.11"])

#: GHA-CI environment variable hook.
COVERAGE = os.environ.get("COVERAGE", False)
Expand Down Expand Up @@ -308,7 +308,6 @@ def tests(session: nox.sessions.Session):
if COVERAGE:
# Execute the tests with code coverage.
session.run("pytest", "--cov-report=xml", "--cov")
session.run("codecov", "--required")
else:
# Execute the tests.
session.run("pytest")
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ classifiers = [
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Atmospheric Science",
Expand All @@ -36,7 +35,7 @@ keywords = [
]
license = {text = "BSD-3-Clause"}
name = "esmf_regrid"
requires-python = ">=3.8"
requires-python = ">=3.10"

[project.urls]
Code = "https://github.com/SciTools-incubator/iris-esmf-regrid"
Expand All @@ -45,7 +44,7 @@ Issues = "https://github.com/SciTools-incubator/iris-esmf-regrid/issues"

[tool.black]
line-length = 88
target-version = ['py39', 'py310', 'py311']
target-version = ['py310', 'py311']
include = '\.pyi?$'

[tool.pytest.ini_options]
Expand Down
Loading

0 comments on commit 94f3e05

Please sign in to comment.