Skip to content

Commit 741698c

Browse files
Merge branch 'v4-dev' into implementing_field_interpolation_api
2 parents 0c9b1f1 + 3e484c5 commit 741698c

File tree

59 files changed

+439
-301
lines changed

Some content is hidden

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

59 files changed

+439
-301
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
- uses: actions/checkout@v5
1818
with:
1919
fetch-depth: 0
20+
submodules: recursive
2021
- name: Get current date
2122
id: date
2223
run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"

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)