Skip to content

Commit 5b603b1

Browse files
DOC: Add page for v4-migration guide (#2189)
1 parent 910fe2a commit 5b603b1

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

docs/community/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ See the sections in the primary sidebar and below to explore.
1010

1111
contributing
1212
Versioning and Deprecation Policies <policies>
13+
Release Notes <https://github.com/OceanParcels/Parcels/releases>
14+
Parcels v4.0 Migration Guide <v4-migration>
1315

1416

1517

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
## Kernels:
1+
# Parcels v4 migration guide
22

3-
- 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.
3+
```{warning}
4+
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).
5+
```
6+
7+
## Kernels
8+
9+
- 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.
410
- `particle.delete()` is no longer valid. Instead, use `particle.state = StatusCode.Delete`.
511
- Sharing state between kernels must be done via the particle data (as the kernels are not combined under the hood anymore).
612
- `particl_dlon`, `particle_dlat` etc have been renamed to `particle.dlon` and `particle.dlat`.
713
- `particle.dt` is a np.timedelta64 object; be careful when multiplying `particle.dt` with a velocity, as its value may be cast to nanoseconds.
814
- 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.
15+
- `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.
916

1017
## FieldSet
1118

docs/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ If you need more help with Parcels, try the `Discussions page on GitHub <https:/
2222
Installation <installation>
2323
Tutorials & Documentation <documentation/index>
2424
API reference <reference>
25-
Release Notes <https://github.com/OceanParcels/Parcels/releases>
26-
Contributing <community/index>
25+
Contributing, Release Notes and more <community/index>
2726
OceanParcels website <https://oceanparcels.org/>

docs/v4/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ api
2222
nojit
2323
TODO
2424
Parcels v4 Project Board <https://github.com/orgs/OceanParcels/projects/5>
25+
Parcels v4 migration guide <../community/v4-migration>
2526
```

0 commit comments

Comments
 (0)