Repository navigation
Cleanup skipped and xfailed unittests #3008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
erikvansebille
merged 20 commits into
Parcels-code:main
from
erikvansebille:cleanup-particlefile-unittests
Oct 28, 2026
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
5134f99
First attempt at cleaning up unit tests
erikvansebille edbff40
Merge branch 'main' into cleanup-particlefile-unittests
erikvansebille 9197c57
Removing xfail on passing test in test_particleset_execute
erikvansebille fc05147
Fixing localize function to use new position dictionary
erikvansebille c9e430f
Renaming localize to UK spelling localise
erikvansebille 81e5d9a
Remove irrelevant test
erikvansebille 12016fe
Using temporary file for output
erikvansebille f71ac91
Updating unit tests in xgrid
erikvansebille 8dce2a8
Removing unit test that I think is not relevant anymore
erikvansebille c3bf3be
Update test_xgrid.py
erikvansebille d62d7a6
Merge branch 'main' into cleanup-unittests
erikvansebille 023c339
removing unused/unnecessary tests
erikvansebille 2b4f6cf
Expanding grid combing tests
erikvansebille a7b8af1
Adding test for mismatched calendar errors
erikvansebille 0118e1c
Adding test for incompatible calendars in VectorField
erikvansebille 24eb917
Removing irrelevant tests
erikvansebille aec5eda
Adding explicit axis to timeV
erikvansebille a76f618
Reinserting test for duplicate axis
erikvansebille c9fa86d
Fix typing
erikvansebille efd3260
Merge branch 'main' into cleanup-particlefile-unittests
erikvansebille File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,6 @@ | |
| import pyarrow as pa | ||
| import pyarrow.parquet as pq | ||
| import pytest | ||
| import xarray as xr | ||
| from re_assert import Matches | ||
|
|
||
| import parcels.tutorial | ||
|
|
@@ -156,46 +155,6 @@ def test_write_dtypes_pfile(fieldset, tmp_parquet): | |
| assert tab[f"v_{d.__name__}"].type == pa.from_numpy_dtype(d) | ||
|
|
||
|
|
||
| @pytest.mark.skip(reason="Pending ParticleFile refactor; see issue #2386") | ||
| @pytest.mark.parametrize("dt", [-np.timedelta64(1, "s"), np.timedelta64(1, "s")]) | ||
| @pytest.mark.parametrize("maxvar", [2, 4, 10]) | ||
| def test_pset_repeated_release_delayed_adding_deleting(fieldset, tmp_parquet, dt, maxvar): | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I spent quite some time on making this test work for v4, but then decided that it was too complex because the parquet format and the kernel loop have changed so much. So I suggest to remove it - we test/check output in tutorials and on other places |
||
| """Tests that if particles are released and deleted based on age that resulting output file is correct.""" | ||
| npart = 10 | ||
| fieldset.add_context("maxvar", maxvar) | ||
|
|
||
| MyParticle = Particle.add_variable( | ||
| [Variable("sample_var", initial=0.0), Variable("v_once", dtype=np.float64, initial=0.0)] | ||
| ) | ||
|
|
||
| pset = ParticleSet( | ||
| fieldset, | ||
| x=np.zeros(npart), | ||
| y=np.zeros(npart), | ||
| pclass=MyParticle, | ||
| t=fieldset.time_interval.left + [np.timedelta64(i + 1, "s") for i in range(npart)], | ||
| ) | ||
| pfile = ParticleFile(tmp_parquet, outputdt=abs(dt)) | ||
|
|
||
| def IncrLon(particles, fieldset): # pragma: no cover | ||
| particles.sample_var += 1.0 | ||
| particles.state = np.where( | ||
| particles.sample_var > fieldset.maxvar, | ||
| StatusCode.Delete, | ||
| particles.state, | ||
| ) | ||
|
|
||
| for _ in range(npart): | ||
| pset.execute(IncrLon, dt=dt, runtime=np.timedelta64(1, "s"), output_file=pfile) | ||
|
|
||
| ds = xr.open_zarr(tmp_parquet) | ||
| samplevar = ds["sample_var"][:] | ||
| assert samplevar.shape == (npart, min(maxvar, npart + 1)) | ||
| # test whether samplevar[:, k] = k | ||
| for k in range(samplevar.shape[1]): | ||
| assert np.allclose([p for p in samplevar[:, k] if np.isfinite(p)], k + 1) | ||
|
|
||
|
|
||
| def test_file_warnings(fieldset, tmp_parquet): | ||
| pset = ParticleSet(fieldset, x=[0, 0], y=[0, 0], t=[np.timedelta64(0, "s"), np.timedelta64(1, "s")]) | ||
| pfile = ParticleFile(tmp_parquet, outputdt=np.timedelta64(2, "s")) | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.