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

Cmorise cci lst v3 #3656

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open

Cmorise cci lst v3 #3656

wants to merge 26 commits into from

Conversation

morobking
Copy link
Contributor

@morobking morobking commented Jun 18, 2024

This pull request is part of the CMUG work package on uncertainty propagation in ESMValTool with @morobking and @axel-lauer. It is part of issue #3408.
A separate pull request will be made in ESMValCore on branch CCI_LST_V3_CMOR_tables

Description

  • Closes #issue_number
  • Link to documentation:

Before you get started

Checklist

It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.

New or updated recipe/diagnostic

New or updated data reformatting script


To help with the number of pull requests:

@morobking morobking requested a review from a team as a code owner June 18, 2024 15:24
Copy link
Contributor

@valeriupredoi valeriupredoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

many thanks for your work @morobking 🍺 And my apologies for the review tardiness, summer holidays just over! I have a few minor points, and a couple rather important one related to your use of try and except in some places, please have a look and tell me if things are not clear 👍

# loop_date += relativedelta.relativedelta(months=1)
# else:
# logger.info('%d: no data found', loop_date.year)
# loop_date += relativedelta.relativedelta(years=1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'd be useful to either remove commented out code, if you know for sure it's not needed no more, or place in a callable function/object so that it can be used at a later stage


Modification history
20201015 Started by Robert King
20201029 Day/Night averaging added along with CMOR utils
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please keep this header and update it with current info? All other cmorizers have it, and it's a useful bit of doc


from esmvaltool.cmorizers.data import utilities as utils
from ...utilities import fix_coords
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package-level imports are better than relative path imports, so here it'd be from esmvaltool.cmorizers.data.utilities import fix_coords

month,
vals['raw'],
)
except:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank excepts are bad, do you know what sort of exception the iris cube loader may throw at you? It's not clear from the info printed below

try:
cubes.remove_coord('time')
except:
logger.info('Coord fix issue %s' % cubes.long_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too - I'd be much happier if you caught the right exception eg coord not found etc; to the very least please be more specific in your logger message - it contains very little info about what went wrong. If you are unsure of the type and handling of exception, it's always better to leave it blow up, and not try catch it, mask it, then output an non-descriptive message

Comment on lines +87 to +91
try:
cubes.coords()[2].standard_name = 'longitude'
except:
# No change needed
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the point of this? The code doesn't fail unless specifically instructed, and if it doesn't fail, and no warning or info is fed to the user then there is no point in having the check

Comment on lines +126 to +128
iris.save(cubes,
save_name
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
iris.save(cubes,
save_name
)
iris.save(cubes, save_name)

logger.info(f'Loading {in_dir}/{file}{year}{month:02d}.nc')
cube = iris.load_cube(f'{in_dir}/{file}{year}{month:02d}*.nc',
variable_list
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your code formatting is not following standard rules, please run a yapf -i on your codes when you done editing

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.

3 participants