Skip to content

Conversation

@erikvansebille
Copy link
Member

@erikvansebille erikvansebille commented Jul 24, 2025

This PR moves and updates unit tests from the v3-testsuite to v4

erikvansebille and others added 26 commits July 24, 2025 19:10
Where tau could return a DataArray (instead of a float)
And also moving mesh interpolation test into separate test-file
Because the dataset itself can cause issues when changed in a pytest
And also moving BiLinear interpolation to interpolation.py
But can't finsih until we have ParticleFile implemented
@erikvansebille
Copy link
Member Author

This PR does not yet contain the full suite of all unit tests from v3, but I think would be good to merge into v4-dev already, just to avoid too large PRs

@erikvansebille erikvansebille marked this pull request as ready for review July 28, 2025 14:05
Comment on lines +466 to +467
if len(arr) < 2:
return 0, 0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know which test required this change? (I assume something to do with 2d fields?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, every test that had 1D depth fields. E.g. pytest tests/v4/test_diffusion.py -k "test_fieldKh_Brownian[flat]"

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok. I'm not sure what it means to have a 1 length dimension with a coordinate for that dimension (shown in tests/v4/test_advection.py::test_length1dimensions). I don't think the coordinate matters.

This might be something to either deal with earlier on, or be something to make a bit more explicit internally. Let's keep this for now so that it can be revisited later with refactored tests. Leaving a TODO comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be clear (also for future reference), I'm a bit concerned here that we're assuming that the 0D dimension has a coordinate assigned to it, when really it doesn't matter if it does. We need to make sure (and test) that we aren't implicitly assuming a coordinate for this dim.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, you can check the code in test_diffusion.py/test_fieldKh_Brownian for where this warning was raised. Perhaps I created the dataset and/or fieldset wrongly?

@github-project-automation github-project-automation bot moved this from Backlog to Ready in Parcels development Jul 28, 2025
@VeckoTheGecko
Copy link
Contributor

Can we merge this tomorrow morning (with or without feedback implemented). I would like to make sweeping changes to kernel.py and want this in a stabler branch so I can use this suite to validate.

@erikvansebille erikvansebille merged commit fdba4c5 into v4-dev Jul 29, 2025
9 checks passed
@erikvansebille erikvansebille deleted the adding_unit_tests branch July 29, 2025 06:41
@github-project-automation github-project-automation bot moved this from Ready to Done in Parcels development Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants