Skip to content

Commit 5d33fc7

Browse files
Merge branch 'master' into timeconverter_precision
2 parents c2780f3 + 70e26eb commit 5d33fc7

24 files changed

+510
-529
lines changed

.github/release.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
changelog:
2+
exclude:
3+
authors:
4+
- dependabot
5+
- pre-commit-ci

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
coverage run -m pytest -v -s --html=${{ matrix.os }}_${{ matrix.python-version }}_unit_test_report.html --self-contained-html tests
4646
coverage xml
4747
- name: Codecov
48-
uses: codecov/codecov-action@v5.0.7
48+
uses: codecov/codecov-action@v5.1.2
4949
env:
5050
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5151
if: matrix.python-version == '3.13'
@@ -80,7 +80,7 @@ jobs:
8080
coverage run -m pytest -v -s --nbval-lax -k "not documentation" --html="${{ matrix.os }}_${{ matrix.python-version }}_integration_test_report.html" --self-contained-html docs/examples
8181
coverage xml
8282
- name: Codecov
83-
uses: codecov/codecov-action@v5.0.7
83+
uses: codecov/codecov-action@v5.1.2
8484
env:
8585
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
8686
with:
@@ -117,7 +117,7 @@ jobs:
117117
run: |
118118
mypy --install-types --non-interactive parcels --cobertura-xml-report mypy_report
119119
- name: Upload mypy coverage to Codecov
120-
uses: codecov/codecov-action@v5.0.7
120+
uses: codecov/codecov-action@v5.1.2
121121
if: ${{ always() }} # Upload even on error of mypy
122122
env:
123123
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/pypi-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
7373
- name: Publish package to TestPyPI
7474
if: github.event_name == 'push'
75-
uses: pypa/[email protected].2
75+
uses: pypa/[email protected].3
7676
with:
7777
user: __token__
7878
password: ${{ secrets.PARCELS_PYPI_TEST_TOKEN }}
@@ -89,7 +89,7 @@ jobs:
8989
name: releases
9090
path: dist
9191
- name: Publish package to PyPI
92-
uses: pypa/[email protected].2
92+
uses: pypa/[email protected].3
9393
with:
9494
user: __token__
9595
password: ${{ secrets.PARCELS_PYPI_PROD_TOKEN }}

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
types: [text]
1111
files: \.(json|ipynb)$
1212
- repo: https://github.com/astral-sh/ruff-pre-commit
13-
rev: v0.8.3
13+
rev: v0.8.6
1414
hooks:
1515
- id: ruff
1616
name: ruff lint (.py)

docs/examples/tutorial_periodic_boundaries.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"cell_type": "markdown",
4343
"metadata": {},
4444
"source": [
45-
"In case of 'simple' models on an A-grid, the idea in Parcels is to do two things:\n",
45+
"If you have a 'simple' `Rectilinear` A-grid, you can create periodic boundaries in Parcels in two steps:\n",
4646
"\n",
4747
"1. Extend the fieldset with a small 'halo'\n",
4848
"2. Add a periodic boundary kernel to the `.execute`\n"

parcels/application_kernels/advection.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ def AdvectionAnalytical(particle, fieldset, time):
184184
time_i = np.linspace(0, fieldset.U.grid.time[ti + 1] - fieldset.U.grid.time[ti], I_s)
185185
ds_t = min(ds_t, time_i[np.where(time - fieldset.U.grid.time[ti] < time_i)[0][0]])
186186

187-
xsi, eta, zeta, xi, yi, zi = fieldset.U._search_indices(
188-
particle.lon, particle.lat, particle.depth, particle=particle
187+
zeta, eta, xsi, zi, yi, xi = fieldset.U._search_indices(
188+
-1, particle.depth, particle.lat, particle.lon, particle=particle
189189
)
190190
if withW:
191191
if abs(xsi - 1) < tol:
@@ -232,14 +232,14 @@ def AdvectionAnalytical(particle, fieldset, time):
232232
else:
233233
dz = 1.0
234234

235-
c1 = fieldset.UV.dist(px[0], px[1], py[0], py[1], grid.mesh, np.dot(i_u.phi2D_lin(xsi, 0.0), py))
236-
c2 = fieldset.UV.dist(px[1], px[2], py[1], py[2], grid.mesh, np.dot(i_u.phi2D_lin(1.0, eta), py))
237-
c3 = fieldset.UV.dist(px[2], px[3], py[2], py[3], grid.mesh, np.dot(i_u.phi2D_lin(xsi, 1.0), py))
238-
c4 = fieldset.UV.dist(px[3], px[0], py[3], py[0], grid.mesh, np.dot(i_u.phi2D_lin(0.0, eta), py))
235+
c1 = fieldset.UV.dist(py[0], py[1], px[0], px[1], grid.mesh, np.dot(i_u.phi2D_lin(0.0, xsi), py))
236+
c2 = fieldset.UV.dist(py[1], py[2], px[1], px[2], grid.mesh, np.dot(i_u.phi2D_lin(eta, 1.0), py))
237+
c3 = fieldset.UV.dist(py[2], py[3], px[2], px[3], grid.mesh, np.dot(i_u.phi2D_lin(1.0, xsi), py))
238+
c4 = fieldset.UV.dist(py[3], py[0], px[3], px[0], grid.mesh, np.dot(i_u.phi2D_lin(eta, 0.0), py))
239239
rad = np.pi / 180.0
240240
deg2m = 1852 * 60.0
241241
meshJac = (deg2m * deg2m * math.cos(rad * particle.lat)) if grid.mesh == "spherical" else 1
242-
dxdy = fieldset.UV.jacobian(xsi, eta, px, py) * meshJac
242+
dxdy = fieldset.UV.jacobian(py, px, eta, xsi) * meshJac
243243

244244
if withW:
245245
U0 = direction * fieldset.U.data[ti, zi + 1, yi + 1, xi] * c4 * dz

parcels/compilation/codegenerator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ def visit_FieldEvalNode(self, node):
834834
statements_croco = [
835835
c.Statement(f"float cs_w[] = {*Cs_w, }".replace("(", "{").replace(")", "}")),
836836
c.Statement(
837-
f"{node.var} = croco_from_z_to_sigma(U, H, Zeta, {args[3]}, {args[2]}, {args[1]}, time, &particles->xi[pnum*ngrid], &particles->yi[pnum*ngrid], &particles->zi[pnum*ngrid], &particles->ti[pnum*ngrid], hc, &cs_w)"
837+
f"{node.var} = croco_from_z_to_sigma(time, {args[1]}, {args[2]}, {args[3]}, U, H, Zeta, &particles->ti[pnum*ngrid], &particles->zi[pnum*ngrid], &particles->yi[pnum*ngrid], &particles->xi[pnum*ngrid], hc, &cs_w)"
838838
),
839839
]
840840
args = (args[0], node.var, args[2], args[3])
@@ -863,7 +863,7 @@ def visit_VectorFieldEvalNode(self, node):
863863
statements_croco = [
864864
c.Statement(f"float cs_w[] = {*Cs_w, }".replace("(", "{").replace(")", "}")),
865865
c.Statement(
866-
f"{node.var4} = croco_from_z_to_sigma(U, H, Zeta, {args[3]}, {args[2]}, {args[1]}, time, &particles->xi[pnum*ngrid], &particles->yi[pnum*ngrid], &particles->zi[pnum*ngrid], &particles->ti[pnum*ngrid], hc, &cs_w)"
866+
f"{node.var4} = croco_from_z_to_sigma(time, {args[1]}, {args[2]}, {args[3]}, U, H, Zeta, &particles->ti[pnum*ngrid], &particles->zi[pnum*ngrid], &particles->yi[pnum*ngrid], &particles->xi[pnum*ngrid], hc, &cs_w)"
867867
),
868868
]
869869
args = (args[0], node.var4, args[2], args[3])

0 commit comments

Comments
 (0)