-
Notifications
You must be signed in to change notification settings - Fork 168
ParticleFile refactor and re-integration into v4-dev #2142
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
Conversation
e7fd808 to
64e09d8
Compare
0929bc5 to
7bb4f89
Compare
parcels/kernel.py
Outdated
| def name(self): | ||
| return f"{self._ptype.name}{self.funcname}" | ||
| # return f"{self._ptype.name}{self.funcname}" # TODO v4: Should we propogate the name of the particle to the metadata? At the moment we don't have the concept of naming particles (somewhat incompatible with the .add_variable() API?) | ||
| return f"{self.funcname}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^
Should we force users to name their particles @erikvansebille ? IIRC in v3 particles created with add_variable were called NewParticle?
|
Still need to fix the tests |
parcels/particle.py
Outdated
| Variable( | ||
| "time", | ||
| dtype=_SAME_AS_FIELDSET_TIME_INTERVAL.VALUE, | ||
| attrs={"long_name": "", "standard_name": "time", "units": "seconds", "axis": "T"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the units here always in seconds? Does that not depend on the type of time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When serialized out, this gets updated to seconds since ... for datetime objects
Setting the particle write status during execution is no longer supported
Also update all references of particledata to _data
Looking at time_nextloop instead. We might rework the kernel loop in future (and the responsibilities of time, time_nextloop, as well as their effect on particle writing).
Not sure how that got in there.... Typo
- Set metadata in file - Remove temp pytest marker
Also flag tests that should be looked at later - as they are out of scope for this PR (or may be able to be tested another way)
0856fa4 to
16032a4
Compare
In favour of directly using the ParticleFile object
v4-devfor v4 changes)This PR brings back particlefile writing into the Parcels codebase, making it compatible with
v4-dev.Changes:
ParticleSetI think that this can be significantly improved in future (namely by working natively with zarr rather than intializing with xarray first then "extending" with zarr) making the code cleaner and more robust.
Previous description
@erikvansebille Just thought I would send you a quick update on my progress on the PariticleFile writing. PR is very much WIP (no review needed), and I will edit this description again once finalized.
pfile-native-zarr- this will make its way into this PR). I think we can work with zarr and extend the size when we encounter out of bounds. I still need to properly test this (and perhaps report a bug to Zarr) since I was encountering irregularities in the produced dataset using with the exact code I had (observations written at the end of the chunk and not the beginning).Bad news is that this has taken longer than I hoped. I was having some difficulty working with v3
test_particlefile.pyfile - since its more of an integration test suite, and there have been a lot of changes since branching off main, the errors weren't informative. I have now taken a step back to build up the test suite using unit tests and using that to guide refactoring - but ran out of time today.I'll get back to this once I'm back online.