Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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/community/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ See the sections in the primary sidebar and below to explore.

contributing
Versioning and Deprecation Policies <policies>
Release Notes <https://github.com/OceanParcels/Parcels/releases>
Parcels v4.0 Migration Guide <v4-migration>
Comment on lines +13 to +14
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't 100% sure where this should go. This was the best place I could think of. Other projects don't really have a standard place to put this - zarr has a dedicated page in their "user guide", uses a release notes section of their website.




Expand Down
11 changes: 9 additions & 2 deletions v3to4-breaking-changes.md → docs/community/v4-migration.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
## Kernels:
# Parcels v4 migration guide

- The Kernel loop has been 'vectorized', so that the input of a Kernel is not one particle anymore, but a list of particles. This means that `if`-statements in Kernels don't work anymore. Replace `if`-statements with `numpy.where` statements.
```{warning}
Version 4 of Parcels is unreleased at the moment. The information in this migration guide is a work in progress, and is subject to change. If you would like to provide feedback on this migration guide (or generally on the development of v4) please [submit an issue](https://github.com/OceanParcels/Parcels/issues/new/choose).
```

## Kernels

- The Kernel loop has been 'vectorized', so that the input of a Kernel is not one particle anymore, but a collection of particles. This means that `if`-statements in Kernels don't work anymore. Replace `if`-statements with `numpy.where` statements.
- `particle.delete()` is no longer valid. Instead, use `particle.state = StatusCode.Delete`.
- Sharing state between kernels must be done via the particle data (as the kernels are not combined under the hood anymore).
- `particl_dlon`, `particle_dlat` etc have been renamed to `particle.dlon` and `particle.dlat`.
- `particle.dt` is a np.timedelta64 object; be careful when multiplying `particle.dt` with a velocity, as its value may be cast to nanoseconds.
- The `time` argument in the Kernel signature is now standard `None` (and may be removed in the Kernel API before release of v4), so can't be used. Use `particle.time` instead.
- `math` functions should be replaced with array compatible equivalents (e.g., `math.sin` -> `np.sin`). Instead of `ParcelsRandom` you should use numpy's random functions.

## FieldSet

Expand Down
3 changes: 1 addition & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ If you need more help with Parcels, try the `Discussions page on GitHub <https:/
Installation <installation>
Tutorials & Documentation <documentation/index>
API reference <reference>
Release Notes <https://github.com/OceanParcels/Parcels/releases>
Contributing <community/index>
Contributing, Release Notes and more <community/index>
OceanParcels website <https://oceanparcels.org/>
1 change: 1 addition & 0 deletions docs/v4/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ api
nojit
TODO
Parcels v4 Project Board <https://github.com/orgs/OceanParcels/projects/5>
Parcels v4 migration guide <../community/v4-migration>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linking it as well from this page, but once v4 is released this whole "v4" section will be deleted (we probably might want to do other restructuring as well, to be decided/discussed later)

```
Loading