Add vector_fields parameter to FieldSet creation methods#2715
Add vector_fields parameter to FieldSet creation methods#2715VeckoTheGecko wants to merge 20 commits into
vector_fields parameter to FieldSet creation methods#2715Conversation
9f73a2c to
72f9f47
Compare
| cls, | ||
| ds: ux.UxDataset, | ||
| mesh: str = "spherical", | ||
| vector_fields: TVectorFieldMapping | None | NotSetType = NOTSET, |
There was a problem hiding this comment.
NOTSET here is an example of a "sentinel value".
They're handy in the case of wanting to distinguish between None and "the default behaviour"
in our case here we want vector_fields=None to mean no vector fields, and the default behaviour to autodiscover based on if there are U and V fields.
erikvansebille
left a comment
There was a problem hiding this comment.
Thanks for this quick PR! See below some comments
| V = TypeVar("V") | ||
|
|
||
| NotSetType = enum.Enum("NotSetType", "VALUE") | ||
| NOTSET = NotSetType.VALUE |
There was a problem hiding this comment.
Not for this PR, but would there be a benefit in also using this NOTSET when postponing setting the particle.time?
Parcels/src/parcels/_core/particleset.py
Lines 89 to 91 in 32a7f2a
There was a problem hiding this comment.
I'm not quite sure what you mean by this. Do you mean to use NOTSET instead of None for the time parameter in the init of the particleset?
No longer relevant
These methods arent public API and these defaults are set on the FieldSet class
Also add vector_field_components to the private API
for more information, see https://pre-commit.ci
848e9d2 to
3f160ea
Compare
Now also has vectorfields
|
All feedback has been addressed - ready for re-review |
Description
This PR adds a
vector_fieldsparameter which allows users to control vector fields that are created.Looking at the following tests you can see how they're used
Now users can:
vector_fields = {}orvector_fields = None)If
vector_fieldsis not provided it uses the default behaviour of constructing UV and UVW if the component fields are present.These changes have also been added to the unstructured grid side as well.
Checklist
mainfor normal development,v3-supportfor v3 support)AI Disclosure