Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

pp-mo
Copy link
Member

@pp-mo pp-mo commented Jun 2, 2020

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.

@pp-mo
Copy link
Member Author

pp-mo commented Jun 3, 2020

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
Copy link
Member Author

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):
Copy link
Member Author

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.

@pp-mo
Copy link
Member Author

pp-mo commented Sep 7, 2022

Peloton : code proposals now out-of-date
Created an issue #4946 to cover instead

@pp-mo pp-mo closed this Sep 7, 2022
@pp-mo pp-mo deleted the clarify_cf_code branch April 28, 2023 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants