Skip to content

Commit 5d24a59

Browse files
Merge branch 'v4-dev' into feature/from_fesom2
2 parents 27a1288 + 254090a commit 5d24a59

File tree

85 files changed

+1095
-1242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1095
-1242
lines changed

.github/workflows/additional.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
shell: bash -l {0}
1414

1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717
- name: Setup micromamba
1818
uses: mamba-org/setup-micromamba@v2
1919
with:
@@ -36,7 +36,7 @@ jobs:
3636
shell: bash -l {0}
3737

3838
steps:
39-
- uses: actions/checkout@v4
40-
- uses: actions/checkout@v4
39+
- uses: actions/checkout@v5
40+
- uses: actions/checkout@v5
4141
- uses: prefix-dev/[email protected]
4242
- run: pixi run docs-linkcheck

.github/workflows/cache-pixi-lock.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Generate and cache Pixi lockfile
22

33
on:
44
workflow_call:
5+
inputs:
6+
pixi-version:
7+
type: string
58
outputs:
69
cache-id:
710
description: "The lock file contents"
@@ -17,6 +20,7 @@ jobs:
1720
- uses: actions/checkout@v5
1821
with:
1922
fetch-depth: 0
23+
submodules: recursive
2024
- name: Get current date
2125
id: date
2226
run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
@@ -25,11 +29,11 @@ jobs:
2529
with:
2630
path: |
2731
pixi.lock
28-
key: ${{ steps.date.outputs.date }}_${{hashFiles('pixi.toml')}}
32+
key: ${{ steps.date.outputs.date }}_${{inputs.pixi-version}}_${{hashFiles('pixi.toml')}}
2933
- uses: prefix-dev/[email protected]
3034
if: ${{ !steps.restore.outputs.cache-hit }}
3135
with:
32-
pixi-version: v0.56.0
36+
pixi-version: ${{ inputs.pixi-version }}
3337
run-install: false
3438
- name: Run pixi lock
3539
if: ${{ !steps.restore.outputs.cache-hit }}
@@ -42,7 +46,7 @@ jobs:
4246
pixi.lock
4347
key: ${{ steps.restore.outputs.cache-primary-key }}
4448
- name: Upload pixi.lock
45-
uses: actions/upload-artifact@v4
49+
uses: actions/upload-artifact@v5
4650
with:
4751
name: pixi-lock
4852
path: pixi.lock

.github/workflows/ci.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,22 @@ jobs:
2828
strategy:
2929
fail-fast: false
3030
matrix:
31-
os: [ubuntu] #, mac, windows] # TODO v4: Re-enable windows and mac
31+
os: [ubuntu, mac, windows]
3232
pixi-environment: [test-latest]
3333
include:
3434
- os: ubuntu
3535
pixi-environment: "test-py311"
36+
- os: ubuntu
37+
pixi-environment: "test-py313"
3638
- os: ubuntu
3739
pixi-environment: "test-minimum"
3840
steps:
39-
- uses: actions/checkout@v4
41+
- uses: actions/checkout@v5
4042
- name: Restore cached pixi lockfile
4143
uses: actions/cache/restore@v4
4244
id: restore-pixi-lock
4345
with:
46+
enableCrossOsArchive: true
4447
path: |
4548
pixi.lock
4649
key: ${{ needs.cache-pixi-lock.outputs.cache-id }}
@@ -52,14 +55,14 @@ jobs:
5255
run: |
5356
pixi run -e ${{ matrix.pixi-environment }} tests -v -s --cov=parcels --cov-report=xml --html="${{ env.COVERAGE_REPORT }}" --self-contained-html
5457
- name: Codecov
55-
uses: codecov/codecov-action@v5.3.1
58+
uses: codecov/codecov-action@v5.5.1
5659
env:
5760
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
5861
with:
5962
flags: unit-tests
6063
- name: Upload test results
6164
if: ${{ always() }} # Always run this step, even if tests fail
62-
uses: actions/upload-artifact@v4
65+
uses: actions/upload-artifact@v5
6366
with:
6467
name: Unittest report ${{ matrix.os }}-${{ matrix.pixi-environment }}
6568
path: ${{ env.COVERAGE_REPORT }}
@@ -80,11 +83,12 @@ jobs:
8083
- os: ubuntu
8184
python-version: "3.11"
8285
steps:
83-
- uses: actions/checkout@v4
86+
- uses: actions/checkout@v5
8487
- name: Restore cached pixi lockfile
8588
uses: actions/cache/restore@v4
8689
id: restore-pixi-lock
8790
with:
91+
enableCrossOsArchive: true
8892
path: |
8993
pixi.lock
9094
key: ${{ needs.cache-pixi-lock.outputs.cache-id }}
@@ -96,14 +100,14 @@ jobs:
96100
run: |
97101
pixi run test-notebooks -v -s --html="${{ env.COVERAGE_REPORT }}" --self-contained-html --cov=parcels --cov-report=xml
98102
- name: Codecov
99-
uses: codecov/codecov-action@v5.3.1
103+
uses: codecov/codecov-action@v5.5.1
100104
env:
101105
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
102106
with:
103107
flags: integration-tests
104108
- name: Upload test results
105109
if: ${{ always() }} # Always run this step, even if tests fail
106-
uses: actions/upload-artifact@v4
110+
uses: actions/upload-artifact@v5
107111
with:
108112
name: Integration test report ${{ matrix.os }}-${{ matrix.pixi-environment }}
109113
path: ${{ env.COVERAGE_REPORT }}
@@ -115,7 +119,7 @@ jobs:
115119
- typechecking
116120
steps:
117121
- name: Merge Artifacts
118-
uses: actions/upload-artifact/merge@v4
122+
uses: actions/upload-artifact/merge@v5
119123
with:
120124
name: Testing reports
121125
pattern: "* report *"
@@ -127,7 +131,7 @@ jobs:
127131
needs: [cache-pixi-lock]
128132
steps:
129133
- name: Checkout
130-
uses: actions/checkout@v4
134+
uses: actions/checkout@v5
131135
- name: Restore cached pixi lockfile
132136
uses: actions/cache/restore@v4
133137
id: restore-pixi-lock
@@ -144,7 +148,7 @@ jobs:
144148
pixi run typing --non-interactive --html-report mypy-report
145149
- name: Upload test results
146150
if: ${{ always() }} # Upload even on mypy error
147-
uses: actions/upload-artifact@v4
151+
uses: actions/upload-artifact@v5
148152
with:
149153
name: Mypy report
150154
path: mypy-report

.github/workflows/nightly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v5
1515
- name: Build conda package
16-
uses: prefix-dev/[email protected].19
16+
uses: prefix-dev/[email protected].34
1717
with:
1818
recipe-path: .github/ci/recipe.yaml
1919

.github/workflows/pypi-release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
runs-on: ubuntu-latest
1414
if: github.repository == 'Parcels-code/parcels'
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717
with:
1818
fetch-depth: 0
19-
- uses: actions/setup-python@v5
19+
- uses: actions/setup-python@v6
2020
name: Install Python
2121
with:
2222
python-version: "3.11"
@@ -42,7 +42,7 @@ jobs:
4242
else
4343
echo "✅ Looks good"
4444
fi
45-
- uses: actions/upload-artifact@v4
45+
- uses: actions/upload-artifact@v5
4646
with:
4747
name: releases
4848
path: dist
@@ -51,11 +51,11 @@ jobs:
5151
needs: build-artifacts
5252
runs-on: ubuntu-latest
5353
steps:
54-
- uses: actions/setup-python@v5
54+
- uses: actions/setup-python@v6
5555
name: Install Python
5656
with:
5757
python-version: "3.11"
58-
- uses: actions/download-artifact@v4
58+
- uses: actions/download-artifact@v6
5959
with:
6060
name: releases
6161
path: dist
@@ -84,7 +84,7 @@ jobs:
8484
if: github.event_name == 'release'
8585
runs-on: ubuntu-latest
8686
steps:
87-
- uses: actions/download-artifact@v4
87+
- uses: actions/download-artifact@v6
8888
with:
8989
name: releases
9090
path: dist

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v5.0.0
3+
rev: v6.0.0
44
hooks:
55
- id: trailing-whitespace
66
- id: end-of-file-fixer
@@ -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.12.5
13+
rev: v0.14.2
1414
hooks:
1515
- id: ruff
1616
name: ruff lint (.py)

docs/community/v4-migration.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,12 @@ Version 4 of Parcels is unreleased at the moment. The information in this migrat
3434

3535
- Particlefiles should be created by `ParticleFile(...)` instead of `pset.ParticleFile(...)`
3636
- The `name` argument in `ParticleFile` has been replaced by `store` and can now be a string, a Path or a zarr store.
37+
38+
## Field
39+
40+
- `Field.eval()` returns an array of floats instead of a single float (related to the vectorization)
41+
- `Field.eval()` does not throw OutOfBounds or other errors
42+
43+
## GridSet
44+
45+
- `GridSet` is now a list, so change `fieldset.gridset.grids[0]` to `fieldset.gridset[0]`.

docs/documentation/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The tutorials written for Parcels v3 are currently being updated for Parcels v4.
4242
:name: tutorial-kernels
4343
4444
<!-- ../examples/tutorial_diffusion.ipynb -->
45-
<!-- ../examples/tutorial_sampling.ipynb -->
45+
../examples/tutorial_sampling.ipynb
4646
<!-- ../examples/tutorial_particle_field_interaction.ipynb -->
4747
<!-- ../examples/tutorial_interaction.ipynb -->
4848
<!-- ../examples/tutorial_analyticaladvection.ipynb -->

docs/examples/tutorial_Argofloats.ipynb

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,9 @@
4141
"\n",
4242
" def SinkingPhase(p):\n",
4343
" \"\"\"Phase 0: Sinking with vertical_speed until depth is driftdepth\"\"\"\n",
44-
" p.ddepth += vertical_speed * dt\n",
45-
" p.cycle_phase = np.where(p.depth + p.ddepth >= driftdepth, 1, p.cycle_phase)\n",
46-
" p.ddepth = np.where(\n",
47-
" p.depth + p.ddepth >= driftdepth, driftdepth - p.depth, p.ddepth\n",
48-
" )\n",
44+
" p.dz += vertical_speed * dt\n",
45+
" p.cycle_phase = np.where(p.z + p.dz >= driftdepth, 1, p.cycle_phase)\n",
46+
" p.dz = np.where(p.z + p.dz >= driftdepth, driftdepth - p.z, p.dz)\n",
4947
"\n",
5048
" SinkingPhase(particles[particles.cycle_phase == 0])\n",
5149
"\n",
@@ -67,11 +65,9 @@
6765
"\n",
6866
" def SecondSinkingPhase(p):\n",
6967
" \"\"\"Phase 2: Sinking further to maxdepth\"\"\"\n",
70-
" p.ddepth += vertical_speed * dt\n",
71-
" p.cycle_phase = np.where(p.depth + p.ddepth >= maxdepth, 3, p.cycle_phase)\n",
72-
" p.ddepth = np.where(\n",
73-
" p.depth + p.ddepth >= maxdepth, maxdepth - p.depth, p.ddepth\n",
74-
" )\n",
68+
" p.dz += vertical_speed * dt\n",
69+
" p.cycle_phase = np.where(p.z + p.dz >= maxdepth, 3, p.cycle_phase)\n",
70+
" p.dz = np.where(p.z + p.dz >= maxdepth, maxdepth - p.z, p.dz)\n",
7571
"\n",
7672
" SecondSinkingPhase(particles[particles.cycle_phase == 2])\n",
7773
"\n",
@@ -81,15 +77,13 @@
8177
"\n",
8278
" def RisingPhase(p):\n",
8379
" \"\"\"Phase 3: Rising with vertical_speed until at surface\"\"\"\n",
84-
" p.ddepth -= vertical_speed * dt\n",
85-
" p.temp = fieldset.thetao[p.time, p.depth, p.lat, p.lon]\n",
86-
" p.cycle_phase = np.where(\n",
87-
" p.depth + p.ddepth <= fieldset.mindepth, 4, p.cycle_phase\n",
88-
" )\n",
89-
" p.ddepth = np.where(\n",
90-
" p.depth + p.ddepth <= fieldset.mindepth,\n",
91-
" fieldset.mindepth - p.depth,\n",
92-
" p.ddepth,\n",
80+
" p.dz -= vertical_speed * dt\n",
81+
" p.temp = fieldset.thetao[p.time, p.z, p.lat, p.lon]\n",
82+
" p.cycle_phase = np.where(p.z + p.dz <= fieldset.mindepth, 4, p.cycle_phase)\n",
83+
" p.dz = np.where(\n",
84+
" p.z + p.dz <= fieldset.mindepth,\n",
85+
" fieldset.mindepth - p.z,\n",
86+
" p.dz,\n",
9387
" )\n",
9488
"\n",
9589
" RisingPhase(particles[particles.cycle_phase == 3])\n",
@@ -163,7 +157,7 @@
163157
" pclass=ArgoParticle,\n",
164158
" lon=[32],\n",
165159
" lat=[-31],\n",
166-
" depth=[fieldset.mindepth],\n",
160+
" z=[fieldset.mindepth],\n",
167161
")\n",
168162
"\n",
169163
"# combine Argo vertical movement kernel with built-in Advection kernel\n",
@@ -174,7 +168,7 @@
174168
" ArgoPhase4,\n",
175169
" ArgoPhase5,\n",
176170
" ArgoPhase6,\n",
177-
" parcels.AdvectionRK4,\n",
171+
" parcels.kernels.AdvectionRK4,\n",
178172
"]\n",
179173
"\n",
180174
"# Create a ParticleFile object to store the output\n",
@@ -209,9 +203,7 @@
209203
"metadata": {},
210204
"outputs": [],
211205
"source": [
212-
"ds_out = xr.open_zarr(\n",
213-
" output_file.store, decode_times=False\n",
214-
") # TODO fix without using decode_times=False\n",
206+
"ds_out = xr.open_zarr(output_file.store)\n",
215207
"x = ds_out[\"lon\"][:].squeeze()\n",
216208
"y = ds_out[\"lat\"][:].squeeze()\n",
217209
"z = ds_out[\"z\"][:].squeeze()\n",
@@ -268,7 +260,7 @@
268260
],
269261
"metadata": {
270262
"kernelspec": {
271-
"display_name": "parcels-v4",
263+
"display_name": "test-notebooks",
272264
"language": "python",
273265
"name": "python3"
274266
},

0 commit comments

Comments
 (0)