Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"myst_parser",
"nbsphinx",
"numpydoc",
"sphinxcontrib.mermaid",
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -207,6 +208,7 @@
"type": "fontawesome",
}
],
"announcement": "WARNING: This documentation is built for v4 of Parcels, which is unreleased and in active development. Use the version switcher in the bottom right to select your version of Parcels, or see <a href='https://docs.oceanparcels.org/'>stable docs</a>.",
}

html_context = {
Expand Down
6 changes: 1 addition & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
Parcels documentation
=====================

.. danger::

This documentation is built for v4 of Parcels, which is unreleased
and in active development. Use the version switcher in the bottom
right to select your version of Parcels.

Welcome to the documentation of Parcels. **Parcels** (Probably A Really Computationally Efficient Lagrangian Simulator) is a set of Python classes and methods to create customisable particle tracking simulations using output from Ocean Circulation models. Parcels can be used to track passive and active particulates such as water, plankton, `plastic <http://www.topios.org/>`_ and `fish <https://github.com/Jacketless/IKAMOANA>`_.

Expand All @@ -22,6 +17,7 @@ If you need more help with Parcels, try the `Discussions page on GitHub <https:/
:hidden:

Home <self>
v4 <v4/index>
Installation <installation>
Tutorials & Documentation <documentation/index>
API reference <reference>
Expand Down
41 changes: 41 additions & 0 deletions docs/v4/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# API design document

## Field data input

Here is the proposed API for Field data ingestion into Parcels.

```{mermaid}

classDiagram
class Fieldset{
+List[Field] fields
}
class Field{
+xr.Dataset|xr.DataArray|ux.Dataset|ux.DataArray data
+parcels.Grid|ux.Grid grid
+Interpolator interpolator
+eval(...)
}

class Interpolator{
+assert_is_compatible(Field)
+interpolate(Field, ...)
}


<<Protocol>> Interpolator

Fieldset ..> Field : depends on
Field ..> Interpolator : depends on
Interpolator <|.. ScalarInterpolator : Realization of
Interpolator <|.. VectorInterpolator : Realization of
Interpolator <|.. etc : Realization of
```

Here, important things to note are:

- Interpolators (which would implement the `Interpolator` protocol) are responsible for the actual interpolation of the data, and performance considerations. There will be interpolation and indexing utilities that can be made available to the interpolators, allowing for code re-use.

- In the `Field` class, not all combinations of `data`, `grid`, and `interpolator` will logically make sense (e.g., a `xr.DataArray` on a `ux.Grid`, or `ux.DataArray` on a `parcels.Grid`). It's up to the `Interpolator.assert_is_compatible(Field)` to define what is and is not compatible, and raise `ValueError` / `TypeError` on incompatible data types. The `.assert_is_compatible()` method also acts as developer documentation, defining clearly for the `.interpolate()` method what assumptions it is working on. The `.assert_is_compatible()` method should be lightweight as it will be called on `Field` initialisation.

- The `grid` object, in the case of unstructured grids, will be the `Grid` class from UXarray. For structured `Grid`s, it will be an object similar to that of `xgcm.Grid` (note that it will be very different from the v3 `Grid` object hierarchy).
10 changes: 10 additions & 0 deletions docs/v4/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# v4 development

This is a central hub to discuss the development of v4. As development progresses, some of the pages mentioned here will be incorporated into the main documentation.

You can think of this as a "living" document as we work towards the release of v4.

```{toctree}

api
```
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ dependencies:
- pydata-sphinx-theme
- sphinx-autobuild
- myst-parser
- sphinxcontrib-mermaid
Loading