Skip to content

Commit 4a53a45

Browse files
[DOCS] Update documentation of tutorial_write_in_kernel (#2657)
* Update tutorial_write_in_kernel * Add tutorial_write_in_kernel to user guide list * Add write_in_kernel to migration guide * Separate output cell
1 parent 1dc5462 commit 4a53a45

3 files changed

Lines changed: 23 additions & 5 deletions

File tree

docs/user_guide/examples/tutorial_write_in_kernel.ipynb

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@
111111
"cell_type": "code",
112112
"execution_count": null,
113113
"id": "9",
114-
"metadata": {},
114+
"metadata": {
115+
"tags": [
116+
"hide-output"
117+
]
118+
},
115119
"outputs": [],
116120
"source": [
117121
"# Load the CopernicusMarine data in the Agulhas region from the example_datasets\n",
@@ -187,7 +191,11 @@
187191
"cell_type": "code",
188192
"execution_count": null,
189193
"id": "14",
190-
"metadata": {},
194+
"metadata": {
195+
"tags": [
196+
"hide-output"
197+
]
198+
},
191199
"outputs": [],
192200
"source": [
193201
"output_file_both = parcels.ParticleFile(\n",
@@ -217,16 +225,24 @@
217225
" runtime=np.timedelta64(4, \"h\"),\n",
218226
" dt=np.timedelta64(15, \"m\"),\n",
219227
" output_file=output_file_both, # the file that writes at regular intervals\n",
220-
")\n",
221-
"\n",
228+
")"
229+
]
230+
},
231+
{
232+
"cell_type": "code",
233+
"execution_count": null,
234+
"id": "15",
235+
"metadata": {},
236+
"outputs": [],
237+
"source": [
222238
"df = parcels.read_particlefile(output_file_both.path)\n",
223239
"assert len(df) == 6 # 2 particles * 3 time steps (0h, 2h, 2h15m)\n",
224240
"df"
225241
]
226242
},
227243
{
228244
"cell_type": "markdown",
229-
"id": "15",
245+
"id": "16",
230246
"metadata": {},
231247
"source": [
232248
"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",

docs/user_guide/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ examples/tutorial_delaystart.ipynb
5151
examples/explanation_kernelloop.md
5252
examples/tutorial_sampling.ipynb
5353
examples/tutorial_statuscodes.ipynb
54+
examples/tutorial_write_in_kernel.ipynb
5455
```
5556

5657
```{toctree}

docs/user_guide/v4-migration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Version 4 of Parcels is unreleased at the moment. The information in this migrat
4444
- The `name` argument in `ParticleFile` has been replaced by `path` and can now be a string or a Path.
4545
- The `chunks` argument in `ParticleFile` has been removed.
4646
- 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.
47+
- 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.
4748

4849
## Field
4950

0 commit comments

Comments
 (0)