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

Prevent warning repeats #5506

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests
  • Loading branch information
stephenworsley committed Feb 12, 2024
commit 5852654d28dda1b5697772d2ed2965062ebf6610
3 changes: 1 addition & 2 deletions lib/iris/fileformats/_nc_load_rules/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"""
import re
from typing import List
import warnings

import cf_units
import numpy as np
Expand Down Expand Up @@ -438,7 +437,7 @@ def parse_cell_methods(nc_cell_methods, cf_name=None):
cell_methods.append(cell_method)
# only prints one warning, rather than each loop
if msg:
warnings.warn(msg, category=UnknownCellMethodWarning)
warn_once_at_level(msg, category=UnknownCellMethodWarning)
return tuple(cell_methods)


Expand Down
2 changes: 1 addition & 1 deletion lib/iris/fileformats/netcdf/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def coord_from_term(term):
"Ignoring atmosphere hybrid sigma pressure "
"scalar coordinate {!r} bounds.".format(coord_p0.name())
)
warnings.warn(
warn_once_at_level(
msg,
category=_WarnComboIgnoringBoundsLoad,
)
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/fileformats/netcdf/saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2829,7 +2829,7 @@ def attr_values_equal(val1, val2):
# Catch any demoted attrs where there is already a local version
blocked_attrs = demote_attrs & set(cube.attributes.locals)
if blocked_attrs:
warnings.warn(
warn_once_at_level(
f"Global cube attributes {sorted(blocked_attrs)} "
f'of cube "{cube.name()}" were not saved, overlaid '
"by existing local attributes with the same names.",
Expand Down
Loading