-
Notifications
You must be signed in to change notification settings - Fork 9
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
Non-conformance in names #28
Comments
I wonder if retaining some of the capitalization might be important, to be consistent with mathematical nomenclature? For example, Lambda (or L) is the vertically-intergrated version of lambda (l); that is, capitalization denotes the exensive quantitity. Capital J is also a common mathematical notation for tracer fluxes, while capital Q is common for surface mass fluxes. These latter two are more easily replaced. Anyway, here are suggestions for some of these... Variables -- Must be longer than three characters and all lower case
Attributes -- Must be longer than three characters and all lower case
Functions -- Must be longer than three characters and all lower case
Class Methods -- Must be longer than three characters and all lower case
|
I agree with Graeme that it is more important for the capitalization convention for these terms to be consistent with the mathematical convention that the data formatting conventions, at least internally in the package. I can work on implementing @gmacgilchrist's suggested renaming if others agree. |
The Python programmer in me advises against this. The PEP-8 standard calls for lowercase variable names. The recommended way around this is to add descriptive suffixes, e.g. |
Thanks for the input, @jkrasting. I hadn't known the convention was so strict for variables/functions.
I am satisfied with just using suffixes like this. |
Staying close to conventional standards feels like the right move. |
Where does this convention come from? I don't see it in the PEP8 style guide. |
You’re right, @hdrake. PEP-8 does not specify a minimum length, but some Python linters enforce this convention for clarity. Pylint is good example of this. |
- Removed `swmt.py` and the `SurfaceWaterMassTransformation` class within it, with the idea that all of its functionality is already included within the core of `wmt.py` (and now `wm.py`). - Moved the core (parent) `WaterMass` class to `wm.py`. This was actually done in the last two commits, but here we include the associated updates to the exporting in `xwmt.__init__.py`. The keyword argument `t_name='temperature'` is now passed to `WaterMass` in the analytical convergence tests, which had broken. - Generalized core `WaterMassTransformations.datadict` method to now identify surface fluxes as tendencies that do not have any vertical coordinates (taken from `self.grid.axes['Z'].coords`) in their dimensions. Addresses - The vertical coordinate used in both calculations for pressure (in the `wm.WaterMass.get_density` method) and for the 2D->3D expansion that is currently used to compute WMT from surface fluxes (see `compute.expand_surface_to_3d`) has been renamed to `z` (with levels `z_l` and interfaces `z_i`) to emphasize that these only support depth coordinates as currently implemented. For WMT calculations in arbitrary vertical coordinates, these will need to be fundamentally changed. (See related discussion at NOAA-GFDL#3). - Added `/conventions/MOM6.yaml` file that can be read in as a python dictionary that is formatted as required by the `budgets_dict` argument of `WaterMassTransformations`, and includes the default names of the core heat, salt, and mass tendencies required for full WMT calculations in temperature, salinity, and density space. Issues addressed by this commit (or previous ones building up to) - Makes many of the re-labellings requested in NOAA-GFDL#28 - Partially addresses NOAA-GFDL#13, although the information is still stored as a dictionary. It should not be fairly straight forward to encode this information in attributes of the data arrays in `self.ds`. - Completely addresses NOAA-GFDL#7 and NOAA-GFDL#8, I think, except for the expansion of 2D surface fluxes (see above). There are now no redundant function or method definitions, as we have removed `swmt.py` completely and made use of class inheritance.
@jetesdal and @gmacgilchrist - there are a lot of variables, attributes, methods, etc. that could have more descriptive names. As a general rule, they should be longer than 3 characters and be all lower case.
We can exempt a small number if there is a good reason, (e.g.
ds
is commonly used throughout the community to denote anxarray.core.Dataset
object, but most of these could be made more intuitive.Can you suggest some alternatives?
Variables -- Must be longer than three characters and all lower case
Attributes -- Must be longer than three characters and all lower case
Functions -- Must be longer than three characters and all lower case
Class Methods -- Must be longer than three characters and all lower case
The text was updated successfully, but these errors were encountered: