-
Notifications
You must be signed in to change notification settings - Fork 285
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
Clarify behaviour of "wrapper" objects derived from CFVariable. #3725
Conversation
Note: lots of Mock-ist tests to be adjusted. That's pretty mechanical, but I'll wait to see whether anyone wants these changes first. |
|
||
#: NetCDF variable name. | ||
self.cf_name = name | ||
|
||
#: NetCDF4 Variable data instance. | ||
self.cf_data = data |
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.
I think the term 'data' is desperately confusing.
This is actually always a netcdf file variable, netCDF4.Variable (and not the variable's data).
Hence the rename !
@@ -115,8 +126,8 @@ def _identify_common(variables, ignore, target): | |||
|
|||
return (ignore, target) | |||
|
|||
@abstractmethod | |||
def identify(self, variables, ignore=None, target=None, warn=True): |
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.
Changed to match the signature in the concrete classes.
Peloton : code proposals now out-of-date |
I spent ages trying to fully understand this, and especially what was introduced in #213
(all that time ago!)
I think there is an excess of subtlety here, and I would have liked to remove some, but that is quite complicated !
So instead, here is an attempt to make the mechanisms clearer : Mainly, just renaming a few things, and adding a few choice comments which I wish I'd had to go on.
Frankly, I'd like to go further and ditch the "wrapper" implementation, which allows us to use a "cf_var" (of a CFVariable-derived type) as a proxy for the underlying netcdf variable object.
( "cf_var.cf_data" -- or as I'm now calling it, "cf_var.nc_variable" ).
Unfortunately there is a lot of other code using that, in both Pyke rules (example) and netcdf.py (example), so I think that change is just too big to include with this.