diff --git a/lib/iris/_concatenate.py b/lib/iris/_concatenate.py index 7330928fe3..0053a555f7 100644 --- a/lib/iris/_concatenate.py +++ b/lib/iris/_concatenate.py @@ -5,7 +5,6 @@ """Automatic concatenation of multiple cubes over one or more existing dimensions.""" from collections import defaultdict, namedtuple -from iris.exceptions import warn_once_at_level import dask.array as da import numpy as np @@ -13,6 +12,7 @@ import iris.coords import iris.cube import iris.exceptions +from iris.exceptions import warn_once_at_level from iris.util import array_equal, guess_coord_axis # diff --git a/lib/iris/analysis/_regrid.py b/lib/iris/analysis/_regrid.py index 637e380500..982a2de0ff 100644 --- a/lib/iris/analysis/_regrid.py +++ b/lib/iris/analysis/_regrid.py @@ -5,7 +5,6 @@ import copy import functools -from iris.exceptions import warn_once_at_level import numpy as np import numpy.ma as ma @@ -19,7 +18,7 @@ snapshot_grid, ) from iris.analysis._scipy_interpolate import _RegularGridInterpolator -from iris.exceptions import IrisImpossibleUpdateWarning +from iris.exceptions import IrisImpossibleUpdateWarning, warn_once_at_level from iris.util import _meshgrid, guess_coord_axis diff --git a/lib/iris/analysis/calculus.py b/lib/iris/analysis/calculus.py index 4e04737c3a..992b776d56 100644 --- a/lib/iris/analysis/calculus.py +++ b/lib/iris/analysis/calculus.py @@ -9,7 +9,6 @@ """ import re -from iris.exceptions import warn_once_at_level import cf_units import numpy as np @@ -22,7 +21,7 @@ import iris.analysis.maths import iris.coord_systems import iris.coords -from iris.exceptions import IrisUserWarning +from iris.exceptions import IrisUserWarning, warn_once_at_level from iris.util import delta __all__ = ["DIRECTIONAL_NAMES", "cube_delta", "curl", "differentiate"] diff --git a/lib/iris/analysis/cartography.py b/lib/iris/analysis/cartography.py index 3f20c0b891..b69d1e57d1 100644 --- a/lib/iris/analysis/cartography.py +++ b/lib/iris/analysis/cartography.py @@ -6,7 +6,6 @@ from collections import namedtuple import copy -from iris.exceptions import warn_once_at_level import cartopy.crs as ccrs import cartopy.img_transform @@ -18,6 +17,7 @@ import iris.coord_systems import iris.coords import iris.exceptions +from iris.exceptions import warn_once_at_level from iris.util import _meshgrid from ._grid_angles import gridcell_angles, rotate_grid_vectors diff --git a/lib/iris/analysis/geometry.py b/lib/iris/analysis/geometry.py index be446c3b3d..2be351ea50 100644 --- a/lib/iris/analysis/geometry.py +++ b/lib/iris/analysis/geometry.py @@ -9,12 +9,11 @@ """ -from iris.exceptions import warn_once_at_level - import numpy as np from shapely.geometry import Polygon import iris.exceptions +from iris.exceptions import warn_once_at_level def _extract_relevant_cube_slice(cube, geometry): diff --git a/lib/iris/analysis/maths.py b/lib/iris/analysis/maths.py index a6999c5c3d..2cb6ac8980 100644 --- a/lib/iris/analysis/maths.py +++ b/lib/iris/analysis/maths.py @@ -8,7 +8,6 @@ import inspect import math import operator -from iris.exceptions import warn_once_at_level import cf_units import dask.array as da @@ -22,6 +21,7 @@ from iris.config import get_logger import iris.coords import iris.exceptions +from iris.exceptions import warn_once_at_level import iris.util # Configure the logger. diff --git a/lib/iris/aux_factory.py b/lib/iris/aux_factory.py index f81fe9a52d..e0a5e51a1d 100644 --- a/lib/iris/aux_factory.py +++ b/lib/iris/aux_factory.py @@ -5,7 +5,6 @@ """Definitions of derived coordinates.""" from abc import ABCMeta, abstractmethod -from iris.exceptions import warn_once_at_level import cf_units import dask.array as da @@ -13,7 +12,7 @@ from iris.common import CFVariableMixin, CoordMetadata, metadata_manager_factory import iris.coords -from iris.exceptions import IrisIgnoringBoundsWarning +from iris.exceptions import IrisIgnoringBoundsWarning, warn_once_at_level class AuxCoordFactory(CFVariableMixin, metaclass=ABCMeta): @@ -429,7 +428,9 @@ def _check_dependencies(pressure_at_top, sigma, surface_air_pressure): f"Coordinate '{coord.name()}' has bounds. These will " "be disregarded" ) - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) + warn_once_at_level( + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 + ) # Check units if sigma.units.is_unknown(): @@ -704,7 +705,9 @@ def update(self, old_coord, new_coord=None): "Orography coordinate {!r} has bounds." " These will be disregarded.".format(new_coord.name()) ) - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) + warn_once_at_level( + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 + ) self.orography = new_coord @@ -968,7 +971,9 @@ def _check_dependencies(sigma, eta, depth, depth_c, nsigma, zlev): "The {} coordinate {!r} has bounds. " "These are being disregarded.".format(term, coord.name()) ) - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) + warn_once_at_level( + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 + ) for coord, term in ((depth_c, "depth_c"), (nsigma, "nsigma")): if coord is not None and coord.shape != (1,): @@ -1125,7 +1130,9 @@ def make_coord(self, coord_dims_func): "The {} coordinate {!r} has bounds. " "These are being disregarded.".format(key, name) ) - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) + warn_once_at_level( + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 + ) # Swap bounds with points. bds_shape = list(nd_points_by_key[key].shape) + [1] bounds = nd_points_by_key[key].reshape(bds_shape) @@ -1205,7 +1212,9 @@ def _check_dependencies(sigma, eta, depth): "The {} coordinate {!r} has bounds. " "These are being disregarded.".format(term, coord.name()) ) - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) + warn_once_at_level( + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 + ) # Check units. if sigma is not None and sigma.units.is_unknown(): @@ -1281,7 +1290,9 @@ def make_coord(self, coord_dims_func): "The {} coordinate {!r} has bounds. " "These are being disregarded.".format(key, name) ) - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) + warn_once_at_level( + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 + ) # Swap bounds with points. bds_shape = list(nd_points_by_key[key].shape) + [1] bounds = nd_points_by_key[key].reshape(bds_shape) @@ -1372,7 +1383,9 @@ def _check_dependencies(s, c, eta, depth, depth_c): "The {} coordinate {!r} has bounds. " "These are being disregarded.".format(term, coord.name()) ) - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) + warn_once_at_level( + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 + ) if depth_c is not None and depth_c.shape != (1,): msg = "Expected scalar {} coordinate {!r}: got shape {!r}.".format( @@ -1466,7 +1479,9 @@ def make_coord(self, coord_dims_func): "The {} coordinate {!r} has bounds. " "These are being disregarded.".format(key, name) ) - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) + warn_once_at_level( + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 + ) # Swap bounds with points. bds_shape = list(nd_points_by_key[key].shape) + [1] bounds = nd_points_by_key[key].reshape(bds_shape) @@ -1561,7 +1576,9 @@ def _check_dependencies(s, eta, depth, a, b, depth_c): "The {} coordinate {!r} has bounds. " "These are being disregarded.".format(term, coord.name()) ) - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) + warn_once_at_level( + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 + ) coords = ((a, "a"), (b, "b"), (depth_c, "depth_c")) for coord, term in coords: @@ -1658,7 +1675,9 @@ def make_coord(self, coord_dims_func): "The {} coordinate {!r} has bounds. " "These are being disregarded.".format(key, name) ) - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) + warn_once_at_level( + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 + ) # Swap bounds with points. bds_shape = list(nd_points_by_key[key].shape) + [1] bounds = nd_points_by_key[key].reshape(bds_shape) @@ -1753,7 +1772,9 @@ def _check_dependencies(s, c, eta, depth, depth_c): "The {} coordinate {!r} has bounds. " "These are being disregarded.".format(term, coord.name()) ) - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) + warn_once_at_level( + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 + ) if depth_c is not None and depth_c.shape != (1,): msg = "Expected scalar depth_c coordinate {!r}: got shape {!r}.".format( @@ -1847,7 +1868,9 @@ def make_coord(self, coord_dims_func): "The {} coordinate {!r} has bounds. " "These are being disregarded.".format(key, name) ) - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) + warn_once_at_level( + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 + ) # Swap bounds with points. bds_shape = list(nd_points_by_key[key].shape) + [1] bounds = nd_points_by_key[key].reshape(bds_shape) diff --git a/lib/iris/config.py b/lib/iris/config.py index e5822f3002..fd85d70ebb 100644 --- a/lib/iris/config.py +++ b/lib/iris/config.py @@ -29,9 +29,9 @@ import contextlib import logging import os.path -from iris.exceptions import warn_once_at_level import iris.exceptions +from iris.exceptions import warn_once_at_level def get_logger(name, datefmt=None, fmt=None, level=None, propagate=None, handler=True): diff --git a/lib/iris/coord_systems.py b/lib/iris/coord_systems.py index 91610d3377..6014e12b53 100644 --- a/lib/iris/coord_systems.py +++ b/lib/iris/coord_systems.py @@ -7,13 +7,13 @@ from abc import ABCMeta, abstractmethod from functools import cached_property import re -from iris.exceptions import warn_once_at_level import cartopy.crs as ccrs import numpy as np from iris._deprecation import warn_deprecated import iris.exceptions +from iris.exceptions import warn_once_at_level def _arg_default(value, default, cast_as=float): diff --git a/lib/iris/coords.py b/lib/iris/coords.py index 3f61e67e93..fe426932e2 100644 --- a/lib/iris/coords.py +++ b/lib/iris/coords.py @@ -11,7 +11,6 @@ from functools import lru_cache from itertools import zip_longest import operator -from iris.exceptions import warn_once_at_level import zlib import dask.array as da @@ -30,6 +29,7 @@ metadata_manager_factory, ) import iris.exceptions +from iris.exceptions import warn_once_at_level import iris.time import iris.util diff --git a/lib/iris/cube.py b/lib/iris/cube.py index 8ac0bff2f0..04173b8375 100644 --- a/lib/iris/cube.py +++ b/lib/iris/cube.py @@ -20,7 +20,6 @@ Optional, Union, ) -from iris.exceptions import warn_once_at_level from xml.dom.minidom import Document import zlib @@ -44,6 +43,7 @@ import iris.coord_systems import iris.coords import iris.exceptions +from iris.exceptions import warn_once_at_level import iris.util __all__ = ["Cube", "CubeAttrsDict", "CubeList"] diff --git a/lib/iris/exceptions.py b/lib/iris/exceptions.py index ad7e6b06cc..4637627a4d 100644 --- a/lib/iris/exceptions.py +++ b/lib/iris/exceptions.py @@ -356,8 +356,7 @@ def warn_once(msg, type, stacklevel, frame, **kwargs): def warn_once_at_level(msg, type=None, stacklevel=0, **kwargs): - """ - Raise a warning only if a similar one hasn't been raised from the same line + """Raise a warning only if a similar one hasn't been raised from the same line for a given stack level. """ stacklevel += 1 diff --git a/lib/iris/experimental/regrid.py b/lib/iris/experimental/regrid.py index 4f56a1b6e8..5a523f5349 100644 --- a/lib/iris/experimental/regrid.py +++ b/lib/iris/experimental/regrid.py @@ -18,7 +18,6 @@ """ import copy import functools -from iris.exceptions import warn_once_at_level import cartopy.crs as ccrs import numpy as np @@ -37,7 +36,7 @@ import iris.analysis.cartography import iris.coord_systems import iris.cube -from iris.exceptions import IrisImpossibleUpdateWarning +from iris.exceptions import IrisImpossibleUpdateWarning, warn_once_at_level from iris.util import _meshgrid wmsg = ( diff --git a/lib/iris/experimental/ugrid/cf.py b/lib/iris/experimental/ugrid/cf.py index b958b9afcd..688791abab 100644 --- a/lib/iris/experimental/ugrid/cf.py +++ b/lib/iris/experimental/ugrid/cf.py @@ -65,7 +65,9 @@ def identify(cls, variables, ignore=None, target=None, warn=True): f"{nc_var_name}" ) if warn: - warn_once_at_level(message, category=IrisCfMissingVarWarning) + warn_once_at_level( + message, category=IrisCfMissingVarWarning + ) else: # Restrict to non-string type i.e. not a # CFLabelVariable. @@ -217,7 +219,9 @@ def identify(cls, variables, ignore=None, target=None, warn=True): f"referenced by netCDF variable {nc_var_name}" ) if warn: - warn_once_at_level(message, category=IrisCfMissingVarWarning) + warn_once_at_level( + message, category=IrisCfMissingVarWarning + ) else: # Restrict to non-string type i.e. not a # CFLabelVariable. @@ -230,7 +234,9 @@ def identify(cls, variables, ignore=None, target=None, warn=True): f"variable." ) if warn: - warn_once_at_level(message, category=IrisCfLabelVarWarning) + warn_once_at_level( + message, category=IrisCfLabelVarWarning + ) return result diff --git a/lib/iris/experimental/ugrid/load.py b/lib/iris/experimental/ugrid/load.py index 7df8018a67..acd4d24a58 100644 --- a/lib/iris/experimental/ugrid/load.py +++ b/lib/iris/experimental/ugrid/load.py @@ -15,6 +15,7 @@ from itertools import groupby from pathlib import Path import threading + from iris.exceptions import warn_once_at_level from ...config import get_logger diff --git a/lib/iris/fileformats/_ff.py b/lib/iris/fileformats/_ff.py index 4e9721a585..0e4c3e3d33 100644 --- a/lib/iris/fileformats/_ff.py +++ b/lib/iris/fileformats/_ff.py @@ -5,7 +5,6 @@ """Provides UK Met Office Fields File (FF) format specific capabilities.""" import os -from iris.exceptions import warn_once_at_level import numpy as np @@ -13,6 +12,7 @@ IrisDefaultingWarning, IrisLoadWarning, NotYetImplementedError, + warn_once_at_level, ) from iris.fileformats._ff_cross_references import STASH_TRANS @@ -799,7 +799,9 @@ def _extract_field(self): "Input field skipped as PPField creation failed :" " error = {!r}" ) - warn_once_at_level(msg.format(str(valerr)), category=IrisLoadWarning) + warn_once_at_level( + msg.format(str(valerr)), category=IrisLoadWarning + ) def __iter__(self): return pp._interpret_fields(self._extract_field()) diff --git a/lib/iris/fileformats/_nc_load_rules/actions.py b/lib/iris/fileformats/_nc_load_rules/actions.py index a9b5cdd2f0..ccfa0c6668 100644 --- a/lib/iris/fileformats/_nc_load_rules/actions.py +++ b/lib/iris/fileformats/_nc_load_rules/actions.py @@ -40,10 +40,10 @@ """ from functools import wraps -from iris.exceptions import warn_once_at_level from iris.config import get_logger import iris.exceptions +from iris.exceptions import warn_once_at_level import iris.fileformats.cf import iris.fileformats.pp as pp diff --git a/lib/iris/fileformats/_nc_load_rules/helpers.py b/lib/iris/fileformats/_nc_load_rules/helpers.py index 01ee90593c..903d54623b 100644 --- a/lib/iris/fileformats/_nc_load_rules/helpers.py +++ b/lib/iris/fileformats/_nc_load_rules/helpers.py @@ -321,7 +321,9 @@ def _split_cell_methods(nc_cell_methods: str) -> List[re.Match]: nc_cell_method_match = _CM_PARSE.match(nc_cell_method_str.strip()) if not nc_cell_method_match: msg = f"Failed to fully parse cell method string: {nc_cell_methods}" - warn_once_at_level(msg, category=iris.exceptions.IrisCfLoadWarning, stacklevel=2) + warn_once_at_level( + msg, category=iris.exceptions.IrisCfLoadWarning, stacklevel=2 + ) continue nc_cell_methods_matches.append(nc_cell_method_match) @@ -521,7 +523,9 @@ def _get_ellipsoid(cf_grid_var): "applied. To apply the datum when loading, use the " "iris.FUTURE.datum_support flag." ) - iris.exceptions.warn_once_at_level(wmsg, FutureWarning, category=FutureWarning, stacklevel=14) + iris.exceptions.warn_once_at_level( + wmsg, FutureWarning, category=FutureWarning, stacklevel=14 + ) datum = None if datum is not None: diff --git a/lib/iris/fileformats/cf.py b/lib/iris/fileformats/cf.py index 1c99181333..ceabac62f8 100644 --- a/lib/iris/fileformats/cf.py +++ b/lib/iris/fileformats/cf.py @@ -18,12 +18,12 @@ from collections.abc import Iterable, MutableMapping import os import re -from iris.exceptions import warn_once_at_level import numpy as np import numpy.ma as ma import iris.exceptions +from iris.exceptions import warn_once_at_level from iris.fileformats.netcdf import _thread_safe_nc import iris.util diff --git a/lib/iris/fileformats/name_loaders.py b/lib/iris/fileformats/name_loaders.py index 2c11d01138..f6d1f414c3 100644 --- a/lib/iris/fileformats/name_loaders.py +++ b/lib/iris/fileformats/name_loaders.py @@ -8,7 +8,6 @@ import datetime from operator import itemgetter import re -from iris.exceptions import warn_once_at_level import cf_units import numpy as np @@ -16,7 +15,7 @@ import iris.coord_systems from iris.coords import AuxCoord, CellMethod, DimCoord import iris.cube -from iris.exceptions import IrisLoadWarning, TranslationError +from iris.exceptions import IrisLoadWarning, TranslationError, warn_once_at_level import iris.util EARTH_RADIUS = 6371229.0 @@ -265,7 +264,9 @@ def _parse_units(units): try: units = cf_units.Unit(units) except ValueError: - warn_once_at_level("Unknown units: {!r}".format(units), category=IrisLoadWarning) + warn_once_at_level( + "Unknown units: {!r}".format(units), category=IrisLoadWarning + ) units = cf_units.Unit(None) return units diff --git a/lib/iris/fileformats/netcdf/loader.py b/lib/iris/fileformats/netcdf/loader.py index b9cc4870d1..24c240eaa0 100644 --- a/lib/iris/fileformats/netcdf/loader.py +++ b/lib/iris/fileformats/netcdf/loader.py @@ -16,7 +16,6 @@ from enum import Enum, auto import threading from typing import Union -from iris.exceptions import warn_once_at_level import numpy as np @@ -35,6 +34,7 @@ import iris.coord_systems import iris.coords import iris.exceptions +from iris.exceptions import warn_once_at_level import iris.fileformats.cf from iris.fileformats.netcdf import _thread_safe_nc from iris.fileformats.netcdf.saver import _CF_ATTRS diff --git a/lib/iris/fileformats/netcdf/saver.py b/lib/iris/fileformats/netcdf/saver.py index c2f043ebac..77febe7440 100644 --- a/lib/iris/fileformats/netcdf/saver.py +++ b/lib/iris/fileformats/netcdf/saver.py @@ -20,7 +20,6 @@ import re import string from typing import List -from iris.exceptions import warn_once_at_level import cf_units import dask @@ -45,6 +44,7 @@ import iris.coords from iris.coords import AncillaryVariable, AuxCoord, CellMeasure, DimCoord import iris.exceptions +from iris.exceptions import warn_once_at_level import iris.fileformats.cf from iris.fileformats.netcdf import _dask_locks, _thread_safe_nc import iris.io @@ -2565,7 +2565,9 @@ def complete(self, issue_warnings=True) -> List[Warning]: if issue_warnings: # Issue any delayed warnings from the compute. for delayed_warning in result_warnings: - warn_once_at_level(delayed_warning, category=iris.exceptions.IrisSaveWarning) + warn_once_at_level( + delayed_warning, category=iris.exceptions.IrisSaveWarning + ) return result_warnings diff --git a/lib/iris/fileformats/nimrod_load_rules.py b/lib/iris/fileformats/nimrod_load_rules.py index 0df1404d8c..521dbf2400 100644 --- a/lib/iris/fileformats/nimrod_load_rules.py +++ b/lib/iris/fileformats/nimrod_load_rules.py @@ -6,7 +6,6 @@ import re import string -from iris.exceptions import warn_once_at_level import cf_units import cftime @@ -19,6 +18,7 @@ CoordinateNotFoundError, IrisNimrodTranslationWarning, TranslationError, + warn_once_at_level, ) __all__ = ["run"] diff --git a/lib/iris/fileformats/pp.py b/lib/iris/fileformats/pp.py index 33140dc382..868ea09ef4 100644 --- a/lib/iris/fileformats/pp.py +++ b/lib/iris/fileformats/pp.py @@ -11,7 +11,6 @@ import os import re import struct -from iris.exceptions import warn_once_at_level import cf_units import cftime @@ -24,6 +23,7 @@ import iris.config import iris.coord_systems import iris.exceptions +from iris.exceptions import warn_once_at_level # NOTE: this is for backwards-compatitibility *ONLY* # We could simply remove it for v2.0 ? diff --git a/lib/iris/fileformats/pp_save_rules.py b/lib/iris/fileformats/pp_save_rules.py index 501be5e5b4..04aedd18bb 100644 --- a/lib/iris/fileformats/pp_save_rules.py +++ b/lib/iris/fileformats/pp_save_rules.py @@ -5,13 +5,11 @@ """PP Save Rules.""" -from iris.exceptions import warn_once_at_level - import cftime import iris from iris.aux_factory import HybridHeightFactory, HybridPressureFactory -from iris.exceptions import IrisPpClimModifiedWarning +from iris.exceptions import IrisPpClimModifiedWarning, warn_once_at_level from iris.fileformats._ff_cross_references import STASH_TRANS from iris.fileformats._pp_lbproc_pairs import LBPROC_MAP from iris.fileformats.rules import ( diff --git a/lib/iris/fileformats/rules.py b/lib/iris/fileformats/rules.py index 6b835baaa0..d167fb2804 100644 --- a/lib/iris/fileformats/rules.py +++ b/lib/iris/fileformats/rules.py @@ -5,13 +5,13 @@ """Generalised mechanisms for metadata translation and cube construction.""" import collections -from iris.exceptions import warn_once_at_level import cf_units from iris.analysis import Linear import iris.cube import iris.exceptions +from iris.exceptions import warn_once_at_level import iris.fileformats.um_cf_map Factory = collections.namedtuple("Factory", ["factory_class", "args"]) diff --git a/lib/iris/iterate.py b/lib/iris/iterate.py index 8982abcac3..f726fac74a 100644 --- a/lib/iris/iterate.py +++ b/lib/iris/iterate.py @@ -6,11 +6,10 @@ from collections.abc import Iterator import itertools -from iris.exceptions import warn_once_at_level import numpy as np -from iris.exceptions import IrisUserWarning +from iris.exceptions import IrisUserWarning, warn_once_at_level __all__ = ["izip"] diff --git a/lib/iris/pandas.py b/lib/iris/pandas.py index 8f0d631b13..b6ad373aa1 100644 --- a/lib/iris/pandas.py +++ b/lib/iris/pandas.py @@ -9,7 +9,6 @@ """ import datetime from itertools import chain, combinations -from iris.exceptions import warn_once_at_level import cf_units from cf_units import Unit @@ -18,6 +17,8 @@ import numpy.ma as ma import pandas as pd +from iris.exceptions import warn_once_at_level + try: from pandas.core.indexes.datetimes import DatetimeIndex # pandas >=0.20 except ImportError: diff --git a/lib/iris/plot.py b/lib/iris/plot.py index 6a6c1bd2dc..811bf5c099 100644 --- a/lib/iris/plot.py +++ b/lib/iris/plot.py @@ -10,7 +10,6 @@ import collections import datetime -from iris.exceptions import warn_once_at_level import cartopy.crs as ccrs from cartopy.geodesic import Geodesic @@ -30,7 +29,11 @@ import iris.coord_systems import iris.coords import iris.cube -from iris.exceptions import IrisError, IrisUnsupportedPlottingWarning +from iris.exceptions import ( + IrisError, + IrisUnsupportedPlottingWarning, + warn_once_at_level, +) # Importing iris.palette to register the brewer palettes. import iris.palette