Skip to content

Commit 5b6a731

Browse files
reint-fischerreint-fischer
authored andcommitted
remove populate indices and fix xticks
1 parent 070cbea commit 5b6a731

File tree

1 file changed

+4
-35
lines changed

1 file changed

+4
-35
lines changed

docs/user_guide/examples/tutorial_nemo_curvilinear.ipynb

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,10 @@
207207
"ds = xr.open_zarr(\"output_curvilinear.zarr\")\n",
208208
"\n",
209209
"plt.plot(ds.lon.T, ds.lat.T, \".-\")\n",
210-
"plt.vlines(np.arange(-180, 900, 360), -90, 90, color=\"r\", label=\"antimeridian\")\n",
210+
"plt.vlines(np.arange(-180, 901, 360), -90, 90, color=\"r\", label=\"antimeridian\")\n",
211211
"plt.ylabel(\"Latitude [deg N]\")\n",
212212
"plt.xlabel(\"Longitude [deg E]\")\n",
213+
"plt.xticks(np.arange(-180, 901, 90))\n",
213214
"plt.legend(loc=\"lower right\")\n",
214215
"plt.show()"
215216
]
@@ -275,52 +276,20 @@
275276
"ax[0].vlines(np.arange(-180, 360, 360), -90, 90, color=\"r\", label=\"antimeridian\")\n",
276277
"ax[0].set_ylabel(\"Latitude [deg N]\")\n",
277278
"ax[0].set_xlabel(\"Longitude [deg E]\")\n",
279+
"ax[0].set_xticks(np.arange(-180, 181, 45))\n",
278280
"ax[0].set_title(\"in post processing\")\n",
279281
"ax[0].legend(loc=\"lower center\")\n",
280282
"\n",
281283
"ax[1].plot(ds_periodic.lon.T, ds_periodic.lat.T, \".-\")\n",
282284
"ax[1].vlines(np.arange(-180, 360, 360), -90, 90, color=\"r\", label=\"antimeridian\")\n",
283285
"ax[1].set_ylabel(\"Latitude [deg N]\")\n",
284286
"ax[1].set_xlabel(\"Longitude [deg E]\")\n",
287+
"ax[1].set_xticks(np.arange(-180, 181, 45))\n",
285288
"ax[1].set_title(\"with periodic Kernel\")\n",
286289
"ax[1].legend(loc=\"lower center\")\n",
287290
"\n",
288291
"plt.show()"
289292
]
290-
},
291-
{
292-
"attachments": {},
293-
"cell_type": "markdown",
294-
"metadata": {},
295-
"source": [
296-
"## Speeding up `ParticleSet` initialisation by efficiently finding particle start-locations on the `Grid`\n",
297-
"\n",
298-
"On a Curvilinear grid, determining the location of all `particles` on the grid is more complicated and therefore takes longer than on a Rectilinear grid. Since Parcels version 2.2.2, a function is available on the `ParticleSet` class, that speeds up the look-up. After creating the `ParticleSet`, but before running the `ParticleSet.execute()`, simply call the function `ParticleSet.populate_indices()`.\n"
299-
]
300-
},
301-
{
302-
"cell_type": "code",
303-
"execution_count": null,
304-
"metadata": {},
305-
"outputs": [],
306-
"source": [
307-
"pset = parcels.ParticleSet(fieldset, lon=lonp, lat=latp)\n",
308-
"pset.populate_indices()"
309-
]
310-
},
311-
{
312-
"cell_type": "markdown",
313-
"metadata": {},
314-
"source": [
315-
"For this speed-up to remain in effect while evaluating a `parcels.Field` in a `Kernel`, we need to remember to pass the `particles` object in the square brackets, by using one of:\n",
316-
"```\n",
317-
"particles.P = fieldset.P[particles]\n",
318-
"```\n",
319-
"or\n",
320-
"```\n",
321-
"particles.P = fieldset.P[particles.time, particles.z, particles.lat, particles.lon, particles]\n",
322-
"```"
323-
]
324293
}
325294
],
326295
"metadata": {

0 commit comments

Comments
 (0)