|
21 | 21 | "cell_type": "markdown", |
22 | 22 | "metadata": {}, |
23 | 23 | "source": [ |
24 | | - "In this tutorial, we will first cover how to run a set of particles [from a very simple idealised field](#Running-particles-in-an-idealised-field). We will show how easy it is to run particles in [time-backward mode](#Running-particles-in-backward-time). Then, we will show how to [add custom behaviour](#Adding-a-custom-behaviour-kernel) to the particles. Then we will show how to [run particles in a set of NetCDF files from external data](#Reading-in-data-from-arbritrary-NetCDF-files). Then we will show how to use particles to [sample a field](#Sampling-a-Field-with-Particles) such as temperature or sea surface height. And finally, we will show how to [write a kernel that tracks the distance travelled by the particles](#calculating-distance-travelled).\n" |
| 24 | + "In this tutorial, we will first cover how to run a set of particles [from a very simple idealised field](#Running-particles-in-an-idealised-field). We will show how easy it is to run particles in [time-backward mode](#Running-particles-in-backward-time). Then, we will show how to [add custom behaviour](#Adding-a-custom-behaviour-kernel) to the particles. Then, we will show how to [run particles in a set of NetCDF files from external data](#Reading-in-data-from-arbritrary-NetCDF-files). Then, we will show how to use particles to [sample a field](#Sampling-a-Field-with-Particles) such as temperature or sea surface height. And finally, we will show how to [write a kernel that tracks the distance travelled by the particles](#calculating-distance-travelled).\n" |
25 | 25 | ] |
26 | 26 | }, |
27 | 27 | { |
|
147 | 147 | "cell_type": "markdown", |
148 | 148 | "metadata": {}, |
149 | 149 | "source": [ |
150 | | - "Print the `ParticleSet` to see where they start\n" |
| 150 | + "Print the `ParticleSet` to see where they start.\n" |
151 | 151 | ] |
152 | 152 | }, |
153 | 153 | { |
|
181 | 181 | "cell_type": "markdown", |
182 | 182 | "metadata": {}, |
183 | 183 | "source": [ |
184 | | - "To plot the positions of these particles on the zonal velocity, use the following command\n" |
| 184 | + "To plot the positions of these particles on the zonal velocity, use the following command.\n" |
185 | 185 | ] |
186 | 186 | }, |
187 | 187 | { |
|
250 | 250 | "cell_type": "markdown", |
251 | 251 | "metadata": {}, |
252 | 252 | "source": [ |
253 | | - "The code should have run, which can be confirmed by printing and plotting the `ParticleSet` again\n" |
| 253 | + "The code should have run, which can be confirmed by printing and plotting the `ParticleSet` again.\n" |
254 | 254 | ] |
255 | 255 | }, |
256 | 256 | { |
|
13223 | 13223 | "cell_type": "markdown", |
13224 | 13224 | "metadata": {}, |
13225 | 13225 | "source": [ |
13226 | | - "Now print the particles again, and see that they (except for some round-off errors) returned to their original position\n" |
| 13226 | + "Now print the particles again, and see that they (except for some round-off errors) returned to their original position.\n" |
13227 | 13227 | ] |
13228 | 13228 | }, |
13229 | 13229 | { |
|
13348 | 13348 | "cell_type": "markdown", |
13349 | 13349 | "metadata": {}, |
13350 | 13350 | "source": [ |
13351 | | - "And now plot this new trajectory file\n" |
| 13351 | + "And now plot this new trajectory file.\n" |
13352 | 13352 | ] |
13353 | 13353 | }, |
13354 | 13354 | { |
|
13407 | 13407 | "cell_type": "markdown", |
13408 | 13408 | "metadata": {}, |
13409 | 13409 | "source": [ |
13410 | | - "First, define the names of the files containing the zonal (U) and meridional (V) velocities. You can use wildcards (`*`) and the filenames for U and V can be the same (as in this case)\n" |
| 13410 | + "First, define the names of the files containing the zonal (U) and meridional (V) velocities. You can use wildcards (`*`) and the filenames for U and V can be the same (as in this case).\n" |
13411 | 13411 | ] |
13412 | 13412 | }, |
13413 | 13413 | { |
|
13429 | 13429 | "cell_type": "markdown", |
13430 | 13430 | "metadata": {}, |
13431 | 13431 | "source": [ |
13432 | | - "Then, define a dictionary of the variables (`U` and `V`) and dimensions (`lon`, `lat` and `time`; note that in this case there is no `depth` because the GlobCurrent data is only for the surface of the ocean)\n" |
| 13432 | + "Then, define a dictionary of the variables (`U` and `V`) and dimensions (`lon`, `lat` and `time`; note that in this case there is no `depth` because the GlobCurrent data is only for the surface of the ocean).\n" |
13433 | 13433 | ] |
13434 | 13434 | }, |
13435 | 13435 | { |
|
13450 | 13450 | "cell_type": "markdown", |
13451 | 13451 | "metadata": {}, |
13452 | 13452 | "source": [ |
13453 | | - "Finally, read in the fieldset using the `FieldSet.from_netcdf` function with the above-defined `filenames`, `variables` and `dimensions`\n" |
| 13453 | + "Finally, read in the fieldset using the `FieldSet.from_netcdf` function with the above-defined `filenames`, `variables` and `dimensions`.\n" |
13454 | 13454 | ] |
13455 | 13455 | }, |
13456 | 13456 | { |
|
13467 | 13467 | "cell_type": "markdown", |
13468 | 13468 | "metadata": {}, |
13469 | 13469 | "source": [ |
13470 | | - "Now define a `ParticleSet`, in this case with 5 particle starting on a line between (28E, 33S) and (30E, 33S) using the `ParticleSet.from_line` constructor method\n" |
| 13470 | + "Now define a `ParticleSet`, in this case with 5 particle starting on a line between (28E, 33S) and (30E, 33S) using the `ParticleSet.from_line` constructor method.\n" |
13471 | 13471 | ] |
13472 | 13472 | }, |
13473 | 13473 | { |
|
13490 | 13490 | "cell_type": "markdown", |
13491 | 13491 | "metadata": {}, |
13492 | 13492 | "source": [ |
13493 | | - "And finally execute the `ParticleSet` for 10 days using 4th order Runge-Kutta\n" |
| 13493 | + "And finally execute the `ParticleSet` for 10 days using 4th order Runge-Kutta.\n" |
13494 | 13494 | ] |
13495 | 13495 | }, |
13496 | 13496 | { |
|
13524 | 13524 | "cell_type": "markdown", |
13525 | 13525 | "metadata": {}, |
13526 | 13526 | "source": [ |
13527 | | - "Because the GlobCurrent data represents the 'real' ocean, we can use the [trajan](https://opendrift.github.io/trajan/index.html) package to visualize this simulation. Use `ds.traj.plot()` to plot the trajectories\n" |
| 13527 | + "Because the GlobCurrent data represents the 'real' ocean, we can use the [trajan](https://opendrift.github.io/trajan/index.html) package to visualize this simulation. Use `ds.traj.plot()` to plot the trajectories.\n" |
13528 | 13528 | ] |
13529 | 13529 | }, |
13530 | 13530 | { |
|
13622 | 13622 | "cell_type": "markdown", |
13623 | 13623 | "metadata": {}, |
13624 | 13624 | "source": [ |
13625 | | - "Now define a `ParticleSet` using the `from_line` method also used above in the GlobCurrent data. Plot the `pset` on top of a contour plot of the `P` field\n" |
| 13625 | + "Now define a `ParticleSet` using the `from_line` method also used above in the GlobCurrent data. Plot the `pset` on top of a contour plot of the `P` field.\n" |
13626 | 13626 | ] |
13627 | 13627 | }, |
13628 | 13628 | { |
|
13684 | 13684 | "cell_type": "markdown", |
13685 | 13685 | "metadata": {}, |
13686 | 13686 | "source": [ |
13687 | | - "Now, execute the `pset` with a combination of the `AdvectionRK4` and `SampleP` kernels\n" |
| 13687 | + "Now, execute the `pset` with a combination of the `AdvectionRK4` and `SampleP` kernels.\n" |
13688 | 13688 | ] |
13689 | 13689 | }, |
13690 | 13690 | { |
|
13800 | 13800 | "cell_type": "markdown", |
13801 | 13801 | "metadata": {}, |
13802 | 13802 | "source": [ |
13803 | | - "Now define a new function `TotalDistance` that calculates the sum of Euclidean distances between the old and new locations in each RK4 step\n" |
| 13803 | + "Now define a new function `TotalDistance` that calculates the sum of Euclidean distances between the old and new locations in each RK4 step.\n" |
13804 | 13804 | ] |
13805 | 13805 | }, |
13806 | 13806 | { |
|
13902 | 13902 | "cell_type": "markdown", |
13903 | 13903 | "metadata": {}, |
13904 | 13904 | "source": [ |
13905 | | - "And finally print the distance in km that each particle has travelled (note that this is also stored in the `EddyParticles_Dist.zarr` file)\n" |
| 13905 | + "And finally print the distance in km that each particle has travelled (note that this is also stored in the `EddyParticles_Dist.zarr` file).\n" |
13906 | 13906 | ] |
13907 | 13907 | }, |
13908 | 13908 | { |
|
0 commit comments