Skip to content

Commit 1fe3489

Browse files
committed
Added density plot also to Parcels example
1 parent 26d3f95 commit 1fe3489

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

examples/example_parcels.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,23 @@
2323
# TODO: we must allow no time dimension for the below to work
2424
#ds.mean('trajectory', skipna=True).traj.plot(color='r', label='Mean trajectory')
2525
# In the meantime, we regrid to a regular 1D dataset to allow plotting a mean trajectory
26-
ds = ds.traj.gridtime('1h')
26+
ds = ds.traj.gridtime('4h')
2727
ds.mean('trajectory').traj.plot(color='r', label='Mean trajectory')
2828
plt.legend()
2929
plt.show()
3030

31+
#%%
32+
# Calculating and plotting the concentration of elements, after 6 and 24 hours
33+
grid = ds.traj.make_grid(dx=3000)
34+
ds_conc = ds.traj.concentration(grid)
35+
plt.subplot(1,2,1)
36+
ds_conc.number.isel(time=6).plot(vmin=0, vmax=20)
37+
plt.scatter(ds.isel(time=6).lon, ds.isel(time=6).lat, s=1, color='black')
38+
plt.subplot(1,2,2)
39+
ds_conc.number.isel(time=24).plot(vmin=0, vmax=20)
40+
plt.scatter(ds.isel(time=24).lon, ds.isel(time=24).lat, s=1, color='black')
41+
plt.show()
42+
3143
#%%
3244
# Calculating skillscore
3345
# Defining the first trajectory to be the "true"

0 commit comments

Comments
 (0)