-
Notifications
You must be signed in to change notification settings - Fork 39
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
Fix bad parent_time_units for UKESM1-0-LL #274
Conversation
this should be solved by #231 so even though I am in favour of double-taking, I reckon we should wait for that PR to be merged and then see if there's any more issues 🍺 |
Added extra line for PEP8 compliance.
Not sure about the codacy error, it looks like some of our standard behaviours for fixes are not PEP8 compliant. |
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.
Could you please add a unit test?
There have been some changes to how the fixes are setup in the last few months, could you please have a look at some other fixes and align this one? That should also solve the Codacy issues.
In fact, it looks like this work was already done by @schlunma last month: ESMValCore/esmvalcore/cmor/_fixes/cmip6/ukesm1_0_ll.py Lines 1 to 6 in a4ec54e
Can this be closed? |
try: | ||
if cube.attributes[parent_units] == bad_value: | ||
cube.attributes[parent_units] = 'days since 1850-01-01' | ||
except AttributeError: |
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.
except AttributeError: | |
except KeyError: |
AttributeError would be raised if cube.attributes
did not exist, you probably mean KeyError, which would be raised if there is no key 'parent_time_units'
in cube.attributes
. Maybe it would be simpler to just write
if cube.attributes.get(parent_units, '') == bad_value:
cube.attributes[parent_units] = 'days since 1850-01-01'
without the try except
@ledm Can you comment on this? #274 (comment) Is this still needed? |
I'm pretty sure this can be closed @ledm? We got this in the current ESMValCore/esmvalcore/cmor/_fixes/cmip6/ukesm1_0_ll.py Lines 6 to 30 in fee5d54
|
Closing this (see comment above), feel free to reopen if necessary. |
Added a minor fix for UKESM1 cmip6 model. Literally, I just copied and pasted code from the HadGEM3 fix.