Skip to content

Commit a6bb153

Browse files
[DOCS] Cleaning up the User Guide (#2737)
* Adding Headers to User guide So that sections can directly be linked to * Moving getting-started to within user-guide * Updating links * Update installation instructions * Clean up docs * Removing stray print statement in unit tests * Fix info on combining models
1 parent 05d1e16 commit a6bb153

15 files changed

Lines changed: 87 additions & 90 deletions

docs/_static/custom.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.bd-article .toctree-wrapper > p.caption {
2+
display: none;
3+
}

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@
187187
# relative to this directory. They are copied after the builtin static files,
188188
# so a file named "default.css" will overwrite the builtin "default.css".
189189
html_static_path = ["_static"]
190+
html_css_files = ["custom.css"]
190191
html_theme_options = {
191192
"logo": {
192193
"alt_text": "Parcels - Home",

docs/getting_started/index.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/index.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ _Animation of virtual particles carried by ocean surface flow in the global ocea
1212
You can browse the documentation for older versions by using the version switcher in the bottom right.
1313
```
1414

15-
**Useful links**: [Installation instructions](getting_started/installation.md) | [Discussions on GitHub](https://github.com/Parcels-code/parcels/discussions) | [Issue on GitHub](https://github.com/Parcels-code/parcels/issues) | [Parcels website](https://parcels-code.org/) | [CLAM community website](https://clam-community.github.io/) | [API reference](reference/parcels/index)
15+
**Useful links**: [Installation instructions](user_guide/getting_started/installation) | [Discussions on GitHub](https://github.com/Parcels-code/parcels/discussions) | [Issue on GitHub](https://github.com/Parcels-code/parcels/issues) | [Parcels website](https://parcels-code.org/) | [CLAM community website](https://clam-community.github.io/) | [API reference](reference/parcels/index)
16+
17+
New to **Parcels**? Check out the [installation instructions](user_guide/getting_started/installation), run the [quickstart tutorial](user_guide/getting_started/tutorial_quickstart), and learn the [key concepts](user_guide/getting_started/explanation_concepts) to understand the package.
1618

1719
`````{grid} 1 2 2 2
1820
:gutter: 4
@@ -22,13 +24,12 @@ You can browse the documentation for older versions by using the version switche
2224
````{grid-item-card} Getting started
2325
:shadow: md
2426
25-
New to **Parcels**? Check out the installation guide, run the quickstart tutorial, and learn the key concepts to understand the package.
27+
New to **Parcels**? Check out the [installation instructions](user_guide/getting_started/installation), run the [quickstart tutorial](user_guide/getting_started/tutorial_quickstart), and learn the [key concepts](user_guide/getting_started/explanation_concepts) to understand the package.
2628
2729
+++
2830
29-
```{button-ref} getting_started/index
31+
```{button-ref} user_guide/index
3032
:ref-type: doc
31-
:click-parent:
3233
:color: secondary
3334
:expand:
3435
@@ -38,13 +39,12 @@ Get started!
3839
````{grid-item-card} How to?
3940
:shadow: md
4041
41-
Wondering how to load a `FieldSet` or write a `Kernel`? Find **tutorials** and explainers to these and other questions here:
42+
Wondering how to load a `FieldSet` or write a `Kernel`? Find **tutorials** and explainers to these and other questions here.
4243
4344
+++
4445
4546
```{button-ref} user_guide/index
4647
:ref-type: doc
47-
:click-parent:
4848
:color: secondary
4949
:expand:
5050
@@ -60,7 +60,6 @@ We encourage anyone to help improve **Parcels**: read our guidelines to get star
6060
6161
```{button-ref} development/index
6262
:ref-type: doc
63-
:click-parent:
6463
:color: secondary
6564
:expand:
6665
@@ -76,7 +75,6 @@ Want to interact with other users and **Parcels** developers?
7675
7776
```{button-ref} community/index
7877
:ref-type: doc
79-
:click-parent:
8078
:color: secondary
8179
:expand:
8280
@@ -95,6 +93,5 @@ User guide <user_guide/index>
9593
Community <community/index>
9694
Development <development/index>
9795
API reference <reference/parcels/index>
98-
v4 <v4/index>
9996
Parcels website <https://parcels-code.org/>
10097
```

docs/user_guide/examples/tutorial_fesom.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"3. Build a `FieldSet` with `parcels.FieldSet.from_ugrid_conventions`.\n",
1919
"4. Run the simulation as on any structured grid.\n",
2020
"\n",
21-
"If you have not done so already, work through the [quickstart tutorial](../../getting_started/tutorial_quickstart.md) first to get familiar with `ParticleSet`, `Kernel`, and `ParticleFile`."
21+
"If you have not done so already, work through the [quickstart tutorial](../getting_started/tutorial_quickstart.md) first to get familiar with `ParticleSet`, `Kernel`, and `ParticleFile`."
2222
]
2323
},
2424
{
@@ -44,7 +44,7 @@
4444
"source": [
4545
"## Get the FESOM tutorial dataset\n",
4646
"\n",
47-
"We use a small periodic-channel snapshot from a FESOM2 simulation that ships with Parcels' tutorial data registry. As in the [quickstart](../../getting_started/tutorial_quickstart.md), `parcels.tutorial.open_dataset` downloads the files into a local cache on first use; subsequent calls just return the cached copy.\n",
47+
"We use a small periodic-channel snapshot from a FESOM2 simulation that ships with Parcels' tutorial data registry. As in the [quickstart](../getting_started/tutorial_quickstart.md), `parcels.tutorial.open_dataset` downloads the files into a local cache on first use; subsequent calls just return the cached copy.\n",
4848
"\n",
4949
"`uxarray` expects file paths rather than an in-memory dataset, so we trigger the downloads and then point `ux.open_mfdataset` at the cached files:"
5050
]

docs/user_guide/examples/tutorial_schism.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
" end up below the local bathymetry and stop advecting them.\n",
3232
"\n",
3333
"If you have not done so already, work through the\n",
34-
"[quickstart tutorial](../../getting_started/tutorial_quickstart.md) first to get familiar with\n",
34+
"[quickstart tutorial](../getting_started/tutorial_quickstart.md) first to get familiar with\n",
3535
"`ParticleSet`, `Kernel`, and `ParticleFile`."
3636
]
3737
},
@@ -66,7 +66,7 @@
6666
"* `horizontalVelX`, `horizontalVelY`: the 3D horizontal velocity components, defined at the mesh nodes\n",
6767
" over 32 vertical layers.\n",
6868
"\n",
69-
"As in the [quickstart](../../getting_started/tutorial_quickstart.md), `parcels.tutorial.open_dataset`\n",
69+
"As in the [quickstart](../getting_started/tutorial_quickstart.md), `parcels.tutorial.open_dataset`\n",
7070
"downloads the files into a local cache on first use (subsequent calls return the cached copy) and opens\n",
7171
"them as `xarray` datasets:"
7272
]

docs/user_guide/examples/tutorial_write_in_kernel.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"\n",
2020
"For these cases, you can use the `pfile.write()` method anywhere in a `Kernel`. You can write to the same file as the one specified in `output_file` or to a different file. \n",
2121
"\n",
22-
"This short tutorial will show you how to use `pfile.write()` in a kernel. We will use the same dataset and particle set as in the [output tutorial ](../../getting_started/tutorial_output.ipynb)."
22+
"This short tutorial will show you how to use `pfile.write()` in a kernel. We will use the same dataset and particle set as in the [output tutorial ](../getting_started/tutorial_output.ipynb)."
2323
]
2424
},
2525
{

docs/getting_started/explanation_concepts.md renamed to docs/user_guide/getting_started/explanation_concepts.md

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ A Parcels simulation is generally built up from four different components:
1717
3. [**Kernels**](#3-kernels). Kernels perform some specific operation on the particles every time step (e.g. advect the particles with the three-dimensional flow; or interpolate the temperature field to the particle location).
1818
4. [**Execute**](#4-execute). Execute the simulation. The core method which integrates the operations defined in Kernels for a given runtime and timestep, and writes output to a ParticleFile.
1919

20-
We discuss each component in more detail below. The subsections titled **"Learn how to"** link to more detailed [how-to guide notebooks](../user_guide/index.md) and more detailed _explanations_ of Parcels functionality are included under **"Read more about"** subsections. The full list of classes and methods is in the [API reference](../reference/parcels/index). If you want to learn by doing, check out the [quickstart tutorial](./tutorial_quickstart.md) to start creating your first Parcels simulation.
20+
We discuss each component in more detail below. The subsections titled **"Learn how to"** link to more detailed [how-to guide notebooks](../index.md) and more detailed _explanations_ of Parcels functionality are included under **"Read more about"** subsections. The full list of classes and methods is in the [API reference](../../reference/parcels/index). If you want to learn by doing, check out the [quickstart tutorial](./tutorial_quickstart.md) to start creating your first Parcels simulation.
2121

22-
```{figure} ../_static/concepts_diagram.png
22+
```{figure} ../../_static/concepts_diagram.png
2323
:alt: Parcels concepts diagram
2424
:width: 100%
2525
@@ -41,16 +41,13 @@ ds_fset = parcels.convert.copernicusmarine_to_sgrid(fields=fields)
4141
fieldset = parcels.FieldSet.from_sgrid_conventions(ds_fset)
4242
```
4343

44-
In some cases, we might want to combine `parcels.Field`s from different sources in the same `parcels.FieldSet`, such as ocean currents from one dataset and Stokes drift from another. This is possible in Parcels by adding each `parcels.Field` separately:
44+
In some cases, we might want to combine fields from different sources in the same `parcels.FieldSet`, such as ocean currents from one dataset and Stokes drift from another. This is possible in Parcels by creating multiple `parcels.FieldSet` objects and combining them into a single `parcels.FieldSet`:
4545

4646
```python
47-
dataset1 = xr.dataset("insert_current_data_files.nc")
4847
dataset2 = xr.dataset("insert_stokes_data_files.nc")
49-
50-
Ucurrent = parcels.Field(name="Ucurrent", data=dataset1["Ucurrent"], grid=parcels.XGrid.from_dataset(dataset1), interp_method=parcels.interpolators.XLinear)
51-
Ustokes = parcels.Field(name="Ustokes", data=dataset2["Ustokes"], grid=parcels.XGrid.from_dataset(dataset2), interp_method=parcels.interpolators.XLinear)
52-
53-
fieldset = parcels.FieldSet([Ucurrent, Ustokes])
48+
fields2 = {"Ustokes": ds_fields["ustokes"], "Vstokes": ds_fields["vstokes"]}
49+
ds_fset = parcels.convert.copernicusmarine_to_sgrid(fields=fields2)
50+
fieldset += parcels.FieldSet.from_sgrid_conventions(ds_fset, vector_fields={"UVstokes": ["Ustokes", "Vstokes"]})
5451
```
5552

5653
### Grid
@@ -59,7 +56,7 @@ Each `parcels.Field` is defined on a grid. With Parcels, we can simulate particl
5956

6057
```{admonition} 📖 Read more about grids
6158
:class: seealso
62-
- [Grids explanation](../user_guide/examples/explanation_grids.md)
59+
- [Grids explanation](../examples/explanation_grids.md)
6360
```
6461

6562
### Interpolation
@@ -68,12 +65,12 @@ To find the value of a `parcels.Field` at any particle location, Parcels interpo
6865

6966
```{admonition} 📖 Read more about interpolation
7067
:class: seealso
71-
- [Interpolation explanation](../user_guide/examples/explanation_interpolation.md)
68+
- [Interpolation explanation](../examples/explanation_interpolation.md)
7269
```
7370

7471
```{admonition} 🖥️ Learn how to use Parcels interpolators
7572
:class: seealso
76-
- [Interpolators guide](../user_guide/examples/tutorial_interpolation.ipynb)
73+
- [Interpolators guide](../examples/tutorial_interpolation.ipynb)
7774
```
7875

7976
## 2. ParticleSet
@@ -96,7 +93,7 @@ pset = parcels.ParticleSet(fieldset=fieldset, pclass=parcels.Particle, t=t, z=z,
9693

9794
```{admonition} 🖥️ Learn more about how to create ParticleSets
9895
:class: seealso
99-
- [Release particles at different times](../user_guide/examples/tutorial_delaystart.ipynb)
96+
- [Release particles at different times](../examples/tutorial_delaystart.ipynb)
10097
```
10198

10299
## 3. Kernels
@@ -126,7 +123,7 @@ def AdvectionEE(particles, fieldset):
126123
Basic kernels are included in Parcels to compute advection and diffusion. The standard advection kernel is `parcels.kernels.AdvectionRK2`, a [second-order Runge-Kutta integrator](https://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods#The_Runge%E2%80%93Kutta_method) of the advection function.
127124

128125
```{warning}
129-
It is advised _not_ to update the particle coordinates (`particles.t`, `particles.z`, `particles.y`, or `particles.x`) directly within a Kernel, as that can negatively interfere with the way that particle movements by different kernels are vectorially added. Use a change in the coordinates: `particles.dy`, `particles.dx` and/or `particles.dz`. Read the [kernel loop tutorial](../user_guide/examples/explanation_kernelloop.md) to understand why.
126+
It is advised _not_ to update the particle coordinates (`particles.t`, `particles.z`, `particles.y`, or `particles.x`) directly within a Kernel, as that can negatively interfere with the way that particle movements by different kernels are vectorially added. Use a change in the coordinates: `particles.dy`, `particles.dx` and/or `particles.dz`. Read the [kernel loop tutorial](../examples/explanation_kernelloop.md) to understand why.
130127
```
131128

132129
(custom-kernel)=
@@ -151,20 +148,20 @@ Every Kernel must be a function with the following (and only those) arguments: `
151148
```
152149

153150
```{warning}
154-
We have to be careful with kernels that sample velocities on "spherical" grids (so with longitude and latitude in degrees). Parcels can automatically convert velocities from m s<sup>-1</sup> to degrees s<sup>-1</sup>, but only when using `VectorFields`. [This guide](../user_guide/examples/tutorial_velocityconversion.ipynb) describes how to use velocities on a "spherical" grid in Parcels.
151+
We have to be careful with kernels that sample velocities on "spherical" grids (so with longitude and latitude in degrees). Parcels can automatically convert velocities from m s<sup>-1</sup> to degrees s<sup>-1</sup>, but only when using `VectorFields`. [This guide](../examples/tutorial_velocityconversion.ipynb) describes how to use velocities on a "spherical" grid in Parcels.
155152
```
156153

157154
```{admonition} 📖 Read more about the Kernel loop
158155
:class: seealso
159-
- [The Kernel loop](../user_guide/examples/explanation_kernelloop.md)
156+
- [The Kernel loop](../examples/explanation_kernelloop.md)
160157
```
161158

162159
```{admonition} 🖥️ Learn how to write Kernels
163160
:class: seealso
164-
- [Sample fields like temperature](../user_guide/examples/tutorial_sampling.ipynb).
165-
- [Mimic the behaviour of ARGO floats](../user_guide/examples/tutorial_Argofloats.ipynb).
166-
- [Add diffusion to approximate subgrid-scale processes and unresolved physics](../user_guide/examples/tutorial_diffusion.ipynb).
167-
- [Convert velocities between units in m s<sup>-1</sup> and degrees s<sup>-1</sup>](../user_guide/examples/tutorial_velocityconversion.ipynb).
161+
- [Sample fields like temperature](../examples/tutorial_sampling.ipynb).
162+
- [Mimic the behaviour of ARGO floats](../examples/tutorial_Argofloats.ipynb).
163+
- [Add diffusion to approximate subgrid-scale processes and unresolved physics](../examples/tutorial_diffusion.ipynb).
164+
- [Convert velocities between units in m s<sup>-1</sup> and degrees s<sup>-1</sup>](../examples/tutorial_velocityconversion.ipynb).
168165
```
169166

170167
## 4. Execute
@@ -188,10 +185,10 @@ pset.execute(kernels=kernels, dt=dt, runtime=runtime)
188185

189186
To analyse the particle data generated in the simulation, we need to define a `parcels.ParticleFile` and add it as an argument to `parcels.ParticleSet.execute()`. The output will be written in a [parquet format](https://parquet.apache.org/), which can be opened as a `polars.DataFrame`. The dataset will contain the particle data with at least `t`, `z`, `y` and `x`, for each particle at timesteps defined by the `outputdt` argument.
190187

191-
There are many ways to analyze particle output, and although we provide [a short tutorial to get started](./tutorial_output.ipynb), we recommend writing your own analysis code and checking out [related Lagrangian analysis projects in our community page](../community/index.md#analysis-code).
188+
There are many ways to analyze particle output, and although we provide [a short tutorial to get started](./tutorial_output.ipynb), we recommend writing your own analysis code and checking out [related Lagrangian analysis projects in our community page](../../community/index.md#analysis-code).
192189

193190
```{admonition} 🖥️ Learn how to run a simulation
194191
:class: seealso
195-
- [Choose an appropriate timestep and integrator](../user_guide/examples/tutorial_dt_integrators.ipynb)
192+
- [Choose an appropriate timestep and integrator](../examples/tutorial_dt_integrators.ipynb)
196193
- [Work with Parcels output](./tutorial_output.ipynb)
197194
```

docs/getting_started/installation.md renamed to docs/user_guide/getting_started/installation.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,19 @@ The steps below are the installation instructions for Linux, macOS and Windows.
1414
1515
**Step 2:** Start a terminal (Linux / macOS) or the Anaconda prompt (Windows). Activate the `base` environment of your Miniconda and create an environment containing Parcels, all its essential dependencies, `trajan` (a trajectory plotting dependency used in the notebooks) and the nice-to-have cartopy and jupyter packages: -->
1616

17-
Parcels v4 is in active development and hasn't been released.
17+
Parcels v4 is in active development.
1818

19-
A pre-release version of Parcels (i.e., the latest version on `main`) can be installed via conda using the following instructions (which creates an environment `parcels-env`, activates it, installs Parcels from a custom pre-release channel that we're using, and installs some additional helper packages).
19+
A pre-release version of Parcels (i.e., the latest version on `main`) can be installed via conda using the following instructions (which creates an environment `parcelsv4-env`, activates it, installs Parcels from a custom pre-release channel that we're using, and installs some additional helper packages).
20+
21+
```{warning}
22+
Before installing the latest version of Parcels, we *highly* recommend creating a new environment so that it doesn't affect your current environment (which you may be using for your research).
23+
24+
You can find your current environment with `conda env list` and identifying the environment with a `*` next to it. At any point, you can use `conda activate ...` (replacing `...` with the name that had the `*` next to it) to return to your environment with version 3 of Parcels.
25+
```
2026

2127
```bash
22-
conda create -n parcels-env python
23-
conda activate parcels-env
28+
conda create -n parcelsv4-env python
29+
conda activate parcelsv4-env
2430
conda config --add channels conda-forge
2531
conda install -c https://prefix.dev/parcels parcels
2632
conda install trajan cartopy jupyter
@@ -45,4 +51,4 @@ The next time you start a terminal and want to work with Parcels, activate the e
4551

4652
## Installation for developers
4753

48-
See the [development section in our contributing guide](../development/index.md#development) for development instructions.
54+
See the [development section in our contributing guide](../../development/index.md#development) for development instructions.
File renamed without changes.

0 commit comments

Comments
 (0)