Skip to content

Commit 2e67ac0

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent a503041 commit 2e67ac0

29 files changed

+92
-57
lines changed

lib/iris/_concatenate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
"""Automatic concatenation of multiple cubes over one or more existing dimensions."""
66

77
from collections import defaultdict, namedtuple
8-
from iris.exceptions import warn_once_at_level
98

109
import dask.array as da
1110
import numpy as np
1211

1312
import iris.coords
1413
import iris.cube
1514
import iris.exceptions
15+
from iris.exceptions import warn_once_at_level
1616
from iris.util import array_equal, guess_coord_axis
1717

1818
#

lib/iris/analysis/_regrid.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import copy
77
import functools
8-
from iris.exceptions import warn_once_at_level
98

109
import numpy as np
1110
import numpy.ma as ma
@@ -19,7 +18,7 @@
1918
snapshot_grid,
2019
)
2120
from iris.analysis._scipy_interpolate import _RegularGridInterpolator
22-
from iris.exceptions import IrisImpossibleUpdateWarning
21+
from iris.exceptions import IrisImpossibleUpdateWarning, warn_once_at_level
2322
from iris.util import _meshgrid, guess_coord_axis
2423

2524

lib/iris/analysis/calculus.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"""
1010

1111
import re
12-
from iris.exceptions import warn_once_at_level
1312

1413
import cf_units
1514
import numpy as np
@@ -22,7 +21,7 @@
2221
import iris.analysis.maths
2322
import iris.coord_systems
2423
import iris.coords
25-
from iris.exceptions import IrisUserWarning
24+
from iris.exceptions import IrisUserWarning, warn_once_at_level
2625
from iris.util import delta
2726

2827
__all__ = ["DIRECTIONAL_NAMES", "cube_delta", "curl", "differentiate"]

lib/iris/analysis/cartography.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
from collections import namedtuple
88
import copy
9-
from iris.exceptions import warn_once_at_level
109

1110
import cartopy.crs as ccrs
1211
import cartopy.img_transform
@@ -18,6 +17,7 @@
1817
import iris.coord_systems
1918
import iris.coords
2019
import iris.exceptions
20+
from iris.exceptions import warn_once_at_level
2121
from iris.util import _meshgrid
2222

2323
from ._grid_angles import gridcell_angles, rotate_grid_vectors

lib/iris/analysis/geometry.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
1010
"""
1111

12-
from iris.exceptions import warn_once_at_level
13-
1412
import numpy as np
1513
from shapely.geometry import Polygon
1614

1715
import iris.exceptions
16+
from iris.exceptions import warn_once_at_level
1817

1918

2019
def _extract_relevant_cube_slice(cube, geometry):

lib/iris/analysis/maths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import inspect
99
import math
1010
import operator
11-
from iris.exceptions import warn_once_at_level
1211

1312
import cf_units
1413
import dask.array as da
@@ -22,6 +21,7 @@
2221
from iris.config import get_logger
2322
import iris.coords
2423
import iris.exceptions
24+
from iris.exceptions import warn_once_at_level
2525
import iris.util
2626

2727
# Configure the logger.

lib/iris/aux_factory.py

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
"""Definitions of derived coordinates."""
66

77
from abc import ABCMeta, abstractmethod
8-
from iris.exceptions import warn_once_at_level
98

109
import cf_units
1110
import dask.array as da
1211
import numpy as np
1312

1413
from iris.common import CFVariableMixin, CoordMetadata, metadata_manager_factory
1514
import iris.coords
16-
from iris.exceptions import IrisIgnoringBoundsWarning
15+
from iris.exceptions import IrisIgnoringBoundsWarning, warn_once_at_level
1716

1817

1918
class AuxCoordFactory(CFVariableMixin, metaclass=ABCMeta):
@@ -429,7 +428,9 @@ def _check_dependencies(pressure_at_top, sigma, surface_air_pressure):
429428
f"Coordinate '{coord.name()}' has bounds. These will "
430429
"be disregarded"
431430
)
432-
warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2)
431+
warn_once_at_level(
432+
msg, category=IrisIgnoringBoundsWarning, stacklevel=2
433+
)
433434

434435
# Check units
435436
if sigma.units.is_unknown():
@@ -704,7 +705,9 @@ def update(self, old_coord, new_coord=None):
704705
"Orography coordinate {!r} has bounds."
705706
" These will be disregarded.".format(new_coord.name())
706707
)
707-
warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2)
708+
warn_once_at_level(
709+
msg, category=IrisIgnoringBoundsWarning, stacklevel=2
710+
)
708711
self.orography = new_coord
709712

710713

@@ -968,7 +971,9 @@ def _check_dependencies(sigma, eta, depth, depth_c, nsigma, zlev):
968971
"The {} coordinate {!r} has bounds. "
969972
"These are being disregarded.".format(term, coord.name())
970973
)
971-
warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2)
974+
warn_once_at_level(
975+
msg, category=IrisIgnoringBoundsWarning, stacklevel=2
976+
)
972977

973978
for coord, term in ((depth_c, "depth_c"), (nsigma, "nsigma")):
974979
if coord is not None and coord.shape != (1,):
@@ -1125,7 +1130,9 @@ def make_coord(self, coord_dims_func):
11251130
"The {} coordinate {!r} has bounds. "
11261131
"These are being disregarded.".format(key, name)
11271132
)
1128-
warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2)
1133+
warn_once_at_level(
1134+
msg, category=IrisIgnoringBoundsWarning, stacklevel=2
1135+
)
11291136
# Swap bounds with points.
11301137
bds_shape = list(nd_points_by_key[key].shape) + [1]
11311138
bounds = nd_points_by_key[key].reshape(bds_shape)
@@ -1205,7 +1212,9 @@ def _check_dependencies(sigma, eta, depth):
12051212
"The {} coordinate {!r} has bounds. "
12061213
"These are being disregarded.".format(term, coord.name())
12071214
)
1208-
warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2)
1215+
warn_once_at_level(
1216+
msg, category=IrisIgnoringBoundsWarning, stacklevel=2
1217+
)
12091218

12101219
# Check units.
12111220
if sigma is not None and sigma.units.is_unknown():
@@ -1281,7 +1290,9 @@ def make_coord(self, coord_dims_func):
12811290
"The {} coordinate {!r} has bounds. "
12821291
"These are being disregarded.".format(key, name)
12831292
)
1284-
warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2)
1293+
warn_once_at_level(
1294+
msg, category=IrisIgnoringBoundsWarning, stacklevel=2
1295+
)
12851296
# Swap bounds with points.
12861297
bds_shape = list(nd_points_by_key[key].shape) + [1]
12871298
bounds = nd_points_by_key[key].reshape(bds_shape)
@@ -1372,7 +1383,9 @@ def _check_dependencies(s, c, eta, depth, depth_c):
13721383
"The {} coordinate {!r} has bounds. "
13731384
"These are being disregarded.".format(term, coord.name())
13741385
)
1375-
warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2)
1386+
warn_once_at_level(
1387+
msg, category=IrisIgnoringBoundsWarning, stacklevel=2
1388+
)
13761389

13771390
if depth_c is not None and depth_c.shape != (1,):
13781391
msg = "Expected scalar {} coordinate {!r}: got shape {!r}.".format(
@@ -1466,7 +1479,9 @@ def make_coord(self, coord_dims_func):
14661479
"The {} coordinate {!r} has bounds. "
14671480
"These are being disregarded.".format(key, name)
14681481
)
1469-
warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2)
1482+
warn_once_at_level(
1483+
msg, category=IrisIgnoringBoundsWarning, stacklevel=2
1484+
)
14701485
# Swap bounds with points.
14711486
bds_shape = list(nd_points_by_key[key].shape) + [1]
14721487
bounds = nd_points_by_key[key].reshape(bds_shape)
@@ -1561,7 +1576,9 @@ def _check_dependencies(s, eta, depth, a, b, depth_c):
15611576
"The {} coordinate {!r} has bounds. "
15621577
"These are being disregarded.".format(term, coord.name())
15631578
)
1564-
warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2)
1579+
warn_once_at_level(
1580+
msg, category=IrisIgnoringBoundsWarning, stacklevel=2
1581+
)
15651582

15661583
coords = ((a, "a"), (b, "b"), (depth_c, "depth_c"))
15671584
for coord, term in coords:
@@ -1658,7 +1675,9 @@ def make_coord(self, coord_dims_func):
16581675
"The {} coordinate {!r} has bounds. "
16591676
"These are being disregarded.".format(key, name)
16601677
)
1661-
warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2)
1678+
warn_once_at_level(
1679+
msg, category=IrisIgnoringBoundsWarning, stacklevel=2
1680+
)
16621681
# Swap bounds with points.
16631682
bds_shape = list(nd_points_by_key[key].shape) + [1]
16641683
bounds = nd_points_by_key[key].reshape(bds_shape)
@@ -1753,7 +1772,9 @@ def _check_dependencies(s, c, eta, depth, depth_c):
17531772
"The {} coordinate {!r} has bounds. "
17541773
"These are being disregarded.".format(term, coord.name())
17551774
)
1756-
warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2)
1775+
warn_once_at_level(
1776+
msg, category=IrisIgnoringBoundsWarning, stacklevel=2
1777+
)
17571778

17581779
if depth_c is not None and depth_c.shape != (1,):
17591780
msg = "Expected scalar depth_c coordinate {!r}: got shape {!r}.".format(
@@ -1847,7 +1868,9 @@ def make_coord(self, coord_dims_func):
18471868
"The {} coordinate {!r} has bounds. "
18481869
"These are being disregarded.".format(key, name)
18491870
)
1850-
warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2)
1871+
warn_once_at_level(
1872+
msg, category=IrisIgnoringBoundsWarning, stacklevel=2
1873+
)
18511874
# Swap bounds with points.
18521875
bds_shape = list(nd_points_by_key[key].shape) + [1]
18531876
bounds = nd_points_by_key[key].reshape(bds_shape)

lib/iris/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
import contextlib
3030
import logging
3131
import os.path
32-
from iris.exceptions import warn_once_at_level
3332

3433
import iris.exceptions
34+
from iris.exceptions import warn_once_at_level
3535

3636

3737
def get_logger(name, datefmt=None, fmt=None, level=None, propagate=None, handler=True):

lib/iris/coord_systems.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
from abc import ABCMeta, abstractmethod
88
from functools import cached_property
99
import re
10-
from iris.exceptions import warn_once_at_level
1110

1211
import cartopy.crs as ccrs
1312
import numpy as np
1413

1514
from iris._deprecation import warn_deprecated
1615
import iris.exceptions
16+
from iris.exceptions import warn_once_at_level
1717

1818

1919
def _arg_default(value, default, cast_as=float):

lib/iris/coords.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from functools import lru_cache
1212
from itertools import zip_longest
1313
import operator
14-
from iris.exceptions import warn_once_at_level
1514
import zlib
1615

1716
import dask.array as da
@@ -30,6 +29,7 @@
3029
metadata_manager_factory,
3130
)
3231
import iris.exceptions
32+
from iris.exceptions import warn_once_at_level
3333
import iris.time
3434
import iris.util
3535

0 commit comments

Comments
 (0)