Skip to content

Commit 9e0afa9

Browse files
Merge branch 'v4-dev' into update_parcels_pitch_readme
2 parents 0448095 + 6baf346 commit 9e0afa9

76 files changed

Lines changed: 5662 additions & 4322 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ jobs:
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
os: [macos, ubuntu, windows]
27-
python-version: ["3.13"]
26+
os: [ubuntu] #, mac, windows] # TODO v4: Re-enable windows and mac
27+
python-version: ["3.12"]
2828
include:
2929
- os: ubuntu
3030
python-version: "3.11"
31-
- os: ubuntu
32-
python-version: "3.12"
3331
steps:
3432
- name: Checkout
3533
uses: actions/checkout@v4
@@ -40,13 +38,12 @@ jobs:
4038
python-version: ${{ matrix.python-version }}
4139
- name: Unit test
4240
run: |
43-
coverage run -m pytest -v -s --html=${{ matrix.os }}_${{ matrix.python-version }}_unit_test_report.html --self-contained-html tests
41+
coverage run -m pytest -v -s --html=${{ matrix.os }}_${{ matrix.python-version }}_unit_test_report.html --self-contained-html
4442
coverage xml
4543
- name: Codecov
4644
uses: codecov/codecov-action@v5.3.1
4745
env:
4846
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
49-
if: matrix.python-version == '3.13'
5047
with:
5148
flags: unit-tests
5249
- name: Upload test results
@@ -56,13 +53,15 @@ jobs:
5653
name: Unittest report ${{ matrix.os }}-${{ matrix.python-version }}
5754
path: ${{ matrix.os }}_${{ matrix.python-version }}_unit_test_report.html
5855
integration-test:
56+
# TODO v4: Re-enable the workflow once development has stabilized and we want to run integration tests again
57+
if: false
5958
name: "py${{ matrix.python-version }} | ${{ matrix.os }} | integration tests"
6059
runs-on: ${{ matrix.os }}-latest
6160
strategy:
6261
fail-fast: false
6362
matrix:
64-
os: [macos, ubuntu, windows]
65-
python-version: ["3.13"]
63+
os: [ubuntu] #, mac, windows] # TODO v4: Re-enable windows and mac
64+
python-version: ["3.12"]
6665
include:
6766
- os: ubuntu
6867
python-version: "3.11"
@@ -109,6 +108,8 @@ jobs:
109108
pattern: "* report *"
110109
typechecking:
111110
name: mypy
111+
# TODO v4: Enable typechecking again
112+
if: false
112113
runs-on: ubuntu-latest
113114
steps:
114115
- name: Checkout

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ parcels.egg-info/*
2727
dist/parcels*.egg
2828
parcels/_version_setup.py
2929
.pytest_cache
30+
.hypothesis
3031
.coverage
3132

3233
# pixi environments

docs/examples/example_globcurrent.py

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,6 @@ def set_globcurrent_fieldset(
3030
)
3131

3232

33-
@pytest.mark.v4remove(
34-
reason="indices keryword is not supported in v4. Subsetting should be done on xarray level."
35-
)
36-
@pytest.mark.parametrize(
37-
"use_xarray", [True, pytest.param(False, marks=pytest.mark.xfail)]
38-
)
39-
def test_globcurrent_fieldset(use_xarray):
40-
fieldset = set_globcurrent_fieldset()
41-
assert fieldset.U.lon.size == 81
42-
assert fieldset.U.lat.size == 41
43-
assert fieldset.V.lon.size == 81
44-
assert fieldset.V.lat.size == 41
45-
46-
if not use_xarray:
47-
indices = {"lon": [5], "lat": range(20, 30)}
48-
fieldsetsub = set_globcurrent_fieldset(indices=indices)
49-
assert np.allclose(fieldsetsub.U.lon, fieldset.U.lon[indices["lon"]])
50-
assert np.allclose(fieldsetsub.U.lat, fieldset.U.lat[indices["lat"]])
51-
assert np.allclose(fieldsetsub.V.lon, fieldset.V.lon[indices["lon"]])
52-
assert np.allclose(fieldsetsub.V.lat, fieldset.V.lat[indices["lat"]])
53-
54-
5533
@pytest.mark.parametrize(
5634
"dt, lonstart, latstart", [(3600.0, 25, -35), (-3600.0, 20, -39)]
5735
)
@@ -103,55 +81,6 @@ def test_globcurrent_particles():
10381
assert abs(pset[0].lat - -35.3) < 1
10482

10583

106-
@pytest.mark.v4remove
107-
@pytest.mark.xfail(
108-
reason="Can't patch metadata without using xarray. v4 will natively use xarray anyway. GH1919."
109-
)
110-
@pytest.mark.parametrize("dt", [-300, 300])
111-
def test_globcurrent_xarray_vs_netcdf(dt):
112-
fieldsetNetcdf = set_globcurrent_fieldset(use_xarray=False)
113-
fieldsetxarray = set_globcurrent_fieldset(use_xarray=True)
114-
lonstart, latstart, runtime = (25, -35, timedelta(days=7))
115-
116-
psetN = parcels.ParticleSet(
117-
fieldsetNetcdf, pclass=parcels.Particle, lon=lonstart, lat=latstart
118-
)
119-
psetN.execute(parcels.AdvectionRK4, runtime=runtime, dt=dt)
120-
121-
psetX = parcels.ParticleSet(
122-
fieldsetxarray, pclass=parcels.Particle, lon=lonstart, lat=latstart
123-
)
124-
psetX.execute(parcels.AdvectionRK4, runtime=runtime, dt=dt)
125-
126-
assert np.allclose(psetN[0].lon, psetX[0].lon)
127-
assert np.allclose(psetN[0].lat, psetX[0].lat)
128-
129-
130-
@pytest.mark.v4remove
131-
@pytest.mark.xfail(
132-
reason="Timeslices will be removed in v4, as users will be able to use xarray directly."
133-
)
134-
@pytest.mark.parametrize("dt", [-300, 300])
135-
def test_globcurrent_netcdf_timestamps(dt):
136-
fieldsetNetcdf = set_globcurrent_fieldset()
137-
timestamps = fieldsetNetcdf.U.grid.timeslices
138-
fieldsetTimestamps = set_globcurrent_fieldset(timestamps=timestamps)
139-
lonstart, latstart, runtime = (25, -35, timedelta(days=7))
140-
141-
psetN = parcels.ParticleSet(
142-
fieldsetNetcdf, pclass=parcels.Particle, lon=lonstart, lat=latstart
143-
)
144-
psetN.execute(parcels.AdvectionRK4, runtime=runtime, dt=dt)
145-
146-
psetT = parcels.ParticleSet(
147-
fieldsetTimestamps, pclass=parcels.Particle, lon=lonstart, lat=latstart
148-
)
149-
psetT.execute(parcels.AdvectionRK4, runtime=runtime, dt=dt)
150-
151-
assert np.allclose(psetN.lon[0], psetT.lon[0])
152-
assert np.allclose(psetN.lat[0], psetT.lat[0])
153-
154-
15584
def test__particles_init_time():
15685
fieldset = set_globcurrent_fieldset()
15786

0 commit comments

Comments
 (0)