-
Notifications
You must be signed in to change notification settings - Fork 283
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
Allow passing None for all coord-system optional args. #3804
Conversation
3643e2b
to
9ef63e5
Compare
9ef63e5
to
57a53ac
Compare
059ef6e
to
17485d2
Compare
17485d2
to
ad14497
Compare
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.
Thanks @pp-mo, this is a whopper! Definitely takes the record for the largest PR I have reviewed. I'm particularly impressed that - despite what I assume was a lot of copy-paste - each of the tests refers to the correct variables and the correct defaults. And despite the large number of changed coordinate systems almost everything had the right corresponding tests, although see the note below. Top work! 🏆 💐
Further to my specific code comments, here are some notes on possible missing coverage for the pyke rules tests:
- Missing equivalent test coverage for:
- Not sure why there is no
fc_rules_cf_fc.build_orthographic_coordinate_system
?
lib/iris/coord_systems.py
Outdated
* false_easting | ||
X offset from planar origin in metres. | ||
Defaults to 0. |
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.
Is there a reason you're not saying Defaults to 0.0.
for consistency?
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.
No!
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.
...s/pyke_rules/compiled_krb/fc_rules_cf_fc/test_build_transverse_mercator_coordinate_system.py
Show resolved
Hide resolved
...fileformats/pyke_rules/compiled_krb/fc_rules_cf_fc/test_build_verticalp_coordinate_system.py
Show resolved
Hide resolved
...fileformats/pyke_rules/compiled_krb/fc_rules_cf_fc/test_build_verticalp_coordinate_system.py
Show resolved
Hide resolved
It looks like we just don't support this for netcdf load. |
These are not affected by the primary code changes, because they do not support Frankly, there is a lot that is untidy and missing in the existing testing strategies, for both the iris coord-systems, and the netcdf loading. All the tests in P.S. I just noticed this, prior art which relates : #3409 |
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.
Initial comments -- not done yet ...
.../fileformats/pyke_rules/compiled_krb/fc_rules_cf_fc/test_build_mercator_coordinate_system.py
Show resolved
Hide resolved
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.
Thanks for the hard work @pp-mo , I consider my comments largely addressed, with the exception of the two new comments below.
lib/iris/coord_systems.py
Outdated
|
||
* false_easting | ||
X offset from planar origin in metres. | ||
X offset from planar origin in metres. Defaults to 0 |
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.
@pp-mo and I have agreed offline that this file needs a quick check through to make sure docstrings consistently make it clear that the defaults are float
types, since different lines containing integers and floats may be misinterpreted as actual different behaviour.
I decided in the end to rationalise all the docstrings, I also considered adding types for all the instance parameters, e.g. |
Great work @pp-mo 👌 LGTM |
* master: whatsnew - using the author github id (SciTools#3849) Bring SciTools#3804 whatsnew in line with format changes from SciTools#3838. (SciTools#3847) "What's New" credit and referencing (SciTools#3838) Allow passing None for all coord-system optional args. (SciTools#3804) var_name in AuxCoord created by trajectory.interpolate() (SciTools#3718)
The need for this is due to the way the netcdf load rules translate the attributes of a grid-mapping variable into a coordinate system : The functions "build_xxx_coordinate_system" (in the Pyke rules, e.g. here) fetch netcdf var attributes defaulted to None, and then call the class constructor expecting it to fill in defaults for unspecified arguments. But this cannot work if the constructor relies on an optional argument definition of the form "arg=number", e.g. here :
So instead, the CoordSystem constructors should be capable of accepting an "arg=None" and applying a default.
Aiming at:
closes #3629
closes #3675