-
Notifications
You must be signed in to change notification settings - Fork 165
Description
Following from #2122, it would be good to rethink the API and refactor the code for particleset data. See below the original comment by @VeckoTheGecko
Hmm, I assume that this change was needed since we are passing the particleset all the way to the kernels now? I think we should at some point pass the particle data itself down - as I touched on f2f, there is a distinction between the particle data and the ParticleSet (e.g., it doesn't make sense to call pset.execute() in a kernel). By passing the particledata down to the kernel it makes this clear. This also means that we don't silently limit users variable names (currently they can't call their variable names
executeor anything that is already a method/attr on ParticleSet).
Happy for that to be a future issue.
Perhaps:
- Make ParticleData its own class (dict of arrays under the hood, but allowing
.attrnotation to get and set values)- Only have private variables/methods/names on this dataset (i.e.,
_data). All public attribute access will be assumed to correspond with particle data -> this results in no shadowing - Disallow names starting with
_inparcels/particle.py@Variableas this could collide with PariticleData
- Only have private variables/methods/names on this dataset (i.e.,
- Pass ParticleData down to the kernels
- Update
pset._datato bepset.dataso that its on our public API.- @erikvansebille can we then remove the
__getattr__and__setattr__methods on thepset? I don't think its too prohibitive to dopset.data.lonif users want to access their lon values, or would you prefer to still have thepset.lon? (a getattr? or also a setattr?)
- @erikvansebille can we then remove the
Also, thoughts on explicitly disallowing object.__setattr__(self, name, value) in that last else clause? I know that its to maintain the default behaviour for Python objects, but I don't see the benefit in supporting it here - and since it works outside of our model it means that that data would fall through the cracks if we write particle data (and also means that if people typo in their kernel it will be a silent bug)
Originally posted by @VeckoTheGecko in #2122 (comment)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status