Skip to content

Commit 87cfb11

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent e51196c commit 87cfb11

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

docs/getting_started/tutorial_quickstart.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,19 @@ kernels = parcels.kernels.AdvectionEE
8282
```
8383

8484
## Prepare output: `ParticleFile`
85+
8586
Before starting the simulation, we must define where and how frequent we want to write the output of our simulation. We can define this in a `ParticleFile` object:
8687

8788
```{code-cell}
8889
output_file = parcels.ParticleFile("Output.zarr", outputdt=np.timedelta64(1, "h"))
8990
```
9091

91-
The output files are in `.zarr` [format]([format](https://zarr.readthedocs.io/en/stable/).), which can be read by `xarray`. See the [Parcels output tutorial](../user_guide/examples/tutorial_output.ipynb) for more information on the zarr format. We want to choose the `outputdt` argument such they capture the smallest timescales of our interest.
92+
The output files are in `.zarr` [format](<[format](https://zarr.readthedocs.io/en/stable/).>), which can be read by `xarray`. See the [Parcels output tutorial](../user_guide/examples/tutorial_output.ipynb) for more information on the zarr format. We want to choose the `outputdt` argument such they capture the smallest timescales of our interest.
9293

9394
## Run Simulation: `ParticleSet.execute()`
94-
Finally, we can run the simulation by *executing* the `ParticleSet` using the specified `kernels`. Additionally, we need to specify:
95+
96+
Finally, we can run the simulation by _executing_ the `ParticleSet` using the specified `kernels`. Additionally, we need to specify:
97+
9598
- the `runtime`: for how long we want to simulate particles.
9699
- the `dt`: the timestep with which to perform the numerical integration in the `kernels`. Depending on the numerical integration scheme, the accuracy of our simulation will depend on `dt`. Read [this notebook](https://github.com/Parcels-code/10year-anniversary-session2/blob/8931ef69577dbf00273a5ab4b7cf522667e146c5/advection_and_windage.ipynb) to learn more about numerical accuracy.
97100

@@ -110,6 +113,7 @@ pset.execute(
110113
```
111114

112115
## Read output
116+
113117
To start analyzing the trajectories computed by **Parcels**, we can open the `ParticleFile` using `xarray`:
114118

115119
```{code-cell}
@@ -128,9 +132,11 @@ plt.xlabel("Longitude [deg E]")
128132
plt.ylabel("Latitude [deg N]")
129133
plt.show()
130134
```
135+
131136
That looks good! The virtual particles released in a line along the 32nd meridian (dark blue) have been advected by the flow field.
132137

133138
## Running a simulation backwards in time
139+
134140
Now that we know how to run a simulation, we can easily run another and change one of the settings. We can trace back the particles from their current to their original position by running the simulation backwards in time. To do so, we can simply make `dt` < 0.
135141

136142
```{code-cell}
@@ -146,6 +152,7 @@ pset.execute(
146152
output_file=output_file,
147153
)
148154
```
155+
149156
When we check the output, we can see that the particles have returned to their original position!
150157

151158
```{code-cell}
@@ -155,4 +162,4 @@ plt.scatter(ds_out.lon.T, ds_out.lat.T, c=np.repeat(ds_out.obs.values,npart))
155162
plt.xlabel("Longitude [deg E]")
156163
plt.ylabel("Latitude [deg N]")
157164
plt.show()
158-
```
165+
```

0 commit comments

Comments
 (0)