From 0cb9412984a7a2b26f76710d909b886f51371994 Mon Sep 17 00:00:00 2001 From: Erik van Sebille Date: Fri, 12 Jun 2026 13:02:47 +0200 Subject: [PATCH 1/4] Update tutorial_write_in_kernel --- .../examples/tutorial_write_in_kernel.ipynb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/user_guide/examples/tutorial_write_in_kernel.ipynb b/docs/user_guide/examples/tutorial_write_in_kernel.ipynb index 17409c018..9e635c2ae 100644 --- a/docs/user_guide/examples/tutorial_write_in_kernel.ipynb +++ b/docs/user_guide/examples/tutorial_write_in_kernel.ipynb @@ -111,7 +111,11 @@ "cell_type": "code", "execution_count": null, "id": "9", - "metadata": {}, + "metadata": { + "tags": [ + "hide-output" + ] + }, "outputs": [], "source": [ "# Load the CopernicusMarine data in the Agulhas region from the example_datasets\n", @@ -187,7 +191,11 @@ "cell_type": "code", "execution_count": null, "id": "14", - "metadata": {}, + "metadata": { + "tags": [ + "hide-output" + ] + }, "outputs": [], "source": [ "output_file_both = parcels.ParticleFile(\n", From 51be78aa3da23448df94007ff8b778bd3090d164 Mon Sep 17 00:00:00 2001 From: Erik van Sebille Date: Fri, 12 Jun 2026 13:03:02 +0200 Subject: [PATCH 2/4] Add tutorial_write_in_kernel to user guide list --- docs/user_guide/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/user_guide/index.md b/docs/user_guide/index.md index 9e22f1236..f29512a69 100644 --- a/docs/user_guide/index.md +++ b/docs/user_guide/index.md @@ -50,6 +50,7 @@ examples/tutorial_delaystart.ipynb examples/explanation_kernelloop.md examples/tutorial_sampling.ipynb examples/tutorial_statuscodes.ipynb +examples/tutorial_write_in_kernel.ipynb ``` ```{toctree} From 7af000751c5c21ae42cb6c78e710f2579ee37fee Mon Sep 17 00:00:00 2001 From: Erik van Sebille Date: Fri, 12 Jun 2026 13:04:31 +0200 Subject: [PATCH 3/4] Add write_in_kernel to migration guide --- docs/user_guide/v4-migration.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/user_guide/v4-migration.md b/docs/user_guide/v4-migration.md index 53a974821..cd6fd01ac 100644 --- a/docs/user_guide/v4-migration.md +++ b/docs/user_guide/v4-migration.md @@ -43,6 +43,7 @@ Version 4 of Parcels is unreleased at the moment. The information in this migrat - The `name` argument in `ParticleFile` has been replaced by `path` and can now be a string or a Path. - The `chunks` argument in `ParticleFile` has been removed. - The `to_write="once"`option has been removed. A variable can now only be either written at every output time step, or not written at all. +- Particles are not written when they are deleted. You can use the functionality to call `ParticleFile.write()` inside a kernel to write out deleted particles if you want to keep track of them. ## Field From 82f0accb9add6ee3e8395bd4ef3f1fa9bc4968c6 Mon Sep 17 00:00:00 2001 From: Erik van Sebille Date: Fri, 12 Jun 2026 13:23:13 +0200 Subject: [PATCH 4/4] Separate output cell --- .../examples/tutorial_write_in_kernel.ipynb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/user_guide/examples/tutorial_write_in_kernel.ipynb b/docs/user_guide/examples/tutorial_write_in_kernel.ipynb index 9e635c2ae..f548dedb1 100644 --- a/docs/user_guide/examples/tutorial_write_in_kernel.ipynb +++ b/docs/user_guide/examples/tutorial_write_in_kernel.ipynb @@ -225,8 +225,16 @@ " runtime=np.timedelta64(4, \"h\"),\n", " dt=np.timedelta64(15, \"m\"),\n", " output_file=output_file_both, # the file that writes at regular intervals\n", - ")\n", - "\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "15", + "metadata": {}, + "outputs": [], + "source": [ "df = parcels.read_particlefile(output_file_both.path)\n", "assert len(df) == 6 # 2 particles * 3 time steps (0h, 2h, 2h15m)\n", "df" @@ -234,7 +242,7 @@ }, { "cell_type": "markdown", - "id": "15", + "id": "16", "metadata": {}, "source": [ "As you can see in the output above, each particle is now written three times, at 0h, at 2h, and at 2h15m when the particle is deleted.\n",