Skip to content

Commit 10f4b95

Browse files
reint-fischerreint-fischer
authored andcommitted
fix code as suggested in review
1 parent 30566f8 commit 10f4b95

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

docs/getting_started/tutorial_quickstart.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pset = parcels.ParticleSet(
7171
temperature = ds_fields.isel(time=0, depth=0).thetao.plot(cmap="magma")
7272
velocity = ds_fields.isel(time=0, depth=0).plot.quiver(x="longitude", y="latitude", u="uo", v="vo")
7373
ax = temperature.axes
74-
ax.scatter(lon,lat,s=40,c='w',edgecolors='r')
74+
ax.scatter(lon,lat,s=40,c='w',edgecolors='r');
7575
```
7676

7777
## Compute: `Kernel`
@@ -134,7 +134,8 @@ Let's verify that Parcels has computed the advection of the virtual particles!
134134
import matplotlib.pyplot as plt
135135
136136
# plot positions and color particles by number of observation
137-
scatter = plt.scatter(ds_particles.lon.T, ds_particles.lat.T, c=np.repeat(ds_particles.obs.values,npart), cmap="Greys", edgecolors='r')
137+
scatter = plt.scatter(ds_particles.lon.T, ds_particles.lat.T, c=np.repeat(ds_particles.obs.values,npart))
138+
plt.scatter(lon,lat,facecolors="none",edgecolors='r') # starting positions
138139
plt.xlim(31,33)
139140
plt.ylabel("Latitude [deg N]")
140141
plt.ylim(-33,-30)
@@ -171,14 +172,19 @@ When we check the output, we can see that the particles have returned to their o
171172
```{code-cell}
172173
ds_particles_back = xr.open_zarr("output-backwards.zarr")
173174
174-
scatter = plt.scatter(ds_particles_back.lon.T, ds_particles_back.lat.T, c=np.repeat(ds_particles_back.obs.values,npart), cmap="Greys", edgecolors='r')
175+
scatter = plt.scatter(ds_particles_back.lon.T, ds_particles_back.lat.T, c=np.repeat(ds_particles_back.obs.values,npart))
176+
plt.scatter(lon,lat,facecolors="none",edgecolors='r') # starting positions
175177
plt.xlabel("Longitude [deg E]")
176178
plt.xlim(31,33)
177179
plt.ylabel("Latitude [deg N]")
178180
plt.ylim(-33,-30)
179181
plt.colorbar(scatter, label="Observation number")
180182
plt.show()
183+
```
184+
185+
Using Euler forward advection, the final positions are equal to the original positions with an accuracy of 2 decimals:
181186

187+
```{code-cell}
182188
# testing that final location == original location
183189
np.testing.assert_almost_equal(ds_particles_back['lat'].values[:,-1],ds_particles['lat'].values[:,0], 2)
184190
np.testing.assert_almost_equal(ds_particles_back['lon'].values[:,-1],ds_particles['lon'].values[:,0], 2)

0 commit comments

Comments
 (0)