Skip to content

Conversation

@stephenworsley
Copy link
Contributor

This should fix one of the failing tests in #3731 which would change the behaviour of nimrod loading due to a change in default units upon coord creation.

@stephenworsley
Copy link
Contributor Author

It may still be worth checking if units are always explicitly set on lines:

new_coord = iris.coords.AuxCoord(
coord_point, bounds=bounds, **coord_args
)

and
new_coord = iris.coords.AuxCoord(
np.array(coord_val, dtype=np.float32), bounds=bounds, **coord_keys
)

@pp-mo
Copy link
Member

pp-mo commented Jun 11, 2020

@stephenworsley may still be worth checking

Undestood.
Is this otherwise ready to go, do you think ?

@stephenworsley
Copy link
Contributor Author

@pp-mo Yeah, I think this should be

@stephenworsley
Copy link
Contributor Author

After looking through the code a bit more, I believe the two cases I mentioned before should always set explicit units. In the first case because the dictionary set here contains units for every value:

vertical_codes = {
0: {
"standard_name": "height",
"units": "m",
"attributes": {"positive": "up"},
},

and in the seond case because this logic ensures that a unit is always present in the arguments:

if not coord_keys.get("units"):
coord_keys["units"] = units_from_field_code.get(
field.field_code, "unknown"
)

@pp-mo
Copy link
Member

pp-mo commented Jun 11, 2020

@stephenworsley the two cases I mentioned before should always set explicit units.

Dead right, I had just come to the conclusion myself.

I also checked all the ".add_xxx_coord(" throughout, and I believe they all check out.
So I reckon this is all good + we are done here ! 👍

@pp-mo pp-mo merged commit c653280 into SciTools:master Jun 11, 2020
tkknight pushed a commit to tkknight/iris that referenced this pull request Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants