|
5 | 5 | """Definitions of derived coordinates.""" |
6 | 6 |
|
7 | 7 | from abc import ABCMeta, abstractmethod |
8 | | -from iris.exceptions import warn_once_at_level |
9 | 8 |
|
10 | 9 | import cf_units |
11 | 10 | import dask.array as da |
12 | 11 | import numpy as np |
13 | 12 |
|
14 | 13 | from iris.common import CFVariableMixin, CoordMetadata, metadata_manager_factory |
15 | 14 | import iris.coords |
16 | | -from iris.exceptions import IrisIgnoringBoundsWarning |
| 15 | +from iris.exceptions import IrisIgnoringBoundsWarning, warn_once_at_level |
17 | 16 |
|
18 | 17 |
|
19 | 18 | class AuxCoordFactory(CFVariableMixin, metaclass=ABCMeta): |
@@ -429,7 +428,9 @@ def _check_dependencies(pressure_at_top, sigma, surface_air_pressure): |
429 | 428 | f"Coordinate '{coord.name()}' has bounds. These will " |
430 | 429 | "be disregarded" |
431 | 430 | ) |
432 | | - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) |
| 431 | + warn_once_at_level( |
| 432 | + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 |
| 433 | + ) |
433 | 434 |
|
434 | 435 | # Check units |
435 | 436 | if sigma.units.is_unknown(): |
@@ -704,7 +705,9 @@ def update(self, old_coord, new_coord=None): |
704 | 705 | "Orography coordinate {!r} has bounds." |
705 | 706 | " These will be disregarded.".format(new_coord.name()) |
706 | 707 | ) |
707 | | - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) |
| 708 | + warn_once_at_level( |
| 709 | + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 |
| 710 | + ) |
708 | 711 | self.orography = new_coord |
709 | 712 |
|
710 | 713 |
|
@@ -968,7 +971,9 @@ def _check_dependencies(sigma, eta, depth, depth_c, nsigma, zlev): |
968 | 971 | "The {} coordinate {!r} has bounds. " |
969 | 972 | "These are being disregarded.".format(term, coord.name()) |
970 | 973 | ) |
971 | | - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) |
| 974 | + warn_once_at_level( |
| 975 | + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 |
| 976 | + ) |
972 | 977 |
|
973 | 978 | for coord, term in ((depth_c, "depth_c"), (nsigma, "nsigma")): |
974 | 979 | if coord is not None and coord.shape != (1,): |
@@ -1125,7 +1130,9 @@ def make_coord(self, coord_dims_func): |
1125 | 1130 | "The {} coordinate {!r} has bounds. " |
1126 | 1131 | "These are being disregarded.".format(key, name) |
1127 | 1132 | ) |
1128 | | - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) |
| 1133 | + warn_once_at_level( |
| 1134 | + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 |
| 1135 | + ) |
1129 | 1136 | # Swap bounds with points. |
1130 | 1137 | bds_shape = list(nd_points_by_key[key].shape) + [1] |
1131 | 1138 | bounds = nd_points_by_key[key].reshape(bds_shape) |
@@ -1205,7 +1212,9 @@ def _check_dependencies(sigma, eta, depth): |
1205 | 1212 | "The {} coordinate {!r} has bounds. " |
1206 | 1213 | "These are being disregarded.".format(term, coord.name()) |
1207 | 1214 | ) |
1208 | | - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) |
| 1215 | + warn_once_at_level( |
| 1216 | + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 |
| 1217 | + ) |
1209 | 1218 |
|
1210 | 1219 | # Check units. |
1211 | 1220 | if sigma is not None and sigma.units.is_unknown(): |
@@ -1281,7 +1290,9 @@ def make_coord(self, coord_dims_func): |
1281 | 1290 | "The {} coordinate {!r} has bounds. " |
1282 | 1291 | "These are being disregarded.".format(key, name) |
1283 | 1292 | ) |
1284 | | - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) |
| 1293 | + warn_once_at_level( |
| 1294 | + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 |
| 1295 | + ) |
1285 | 1296 | # Swap bounds with points. |
1286 | 1297 | bds_shape = list(nd_points_by_key[key].shape) + [1] |
1287 | 1298 | bounds = nd_points_by_key[key].reshape(bds_shape) |
@@ -1372,7 +1383,9 @@ def _check_dependencies(s, c, eta, depth, depth_c): |
1372 | 1383 | "The {} coordinate {!r} has bounds. " |
1373 | 1384 | "These are being disregarded.".format(term, coord.name()) |
1374 | 1385 | ) |
1375 | | - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) |
| 1386 | + warn_once_at_level( |
| 1387 | + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 |
| 1388 | + ) |
1376 | 1389 |
|
1377 | 1390 | if depth_c is not None and depth_c.shape != (1,): |
1378 | 1391 | msg = "Expected scalar {} coordinate {!r}: got shape {!r}.".format( |
@@ -1466,7 +1479,9 @@ def make_coord(self, coord_dims_func): |
1466 | 1479 | "The {} coordinate {!r} has bounds. " |
1467 | 1480 | "These are being disregarded.".format(key, name) |
1468 | 1481 | ) |
1469 | | - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) |
| 1482 | + warn_once_at_level( |
| 1483 | + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 |
| 1484 | + ) |
1470 | 1485 | # Swap bounds with points. |
1471 | 1486 | bds_shape = list(nd_points_by_key[key].shape) + [1] |
1472 | 1487 | bounds = nd_points_by_key[key].reshape(bds_shape) |
@@ -1561,7 +1576,9 @@ def _check_dependencies(s, eta, depth, a, b, depth_c): |
1561 | 1576 | "The {} coordinate {!r} has bounds. " |
1562 | 1577 | "These are being disregarded.".format(term, coord.name()) |
1563 | 1578 | ) |
1564 | | - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) |
| 1579 | + warn_once_at_level( |
| 1580 | + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 |
| 1581 | + ) |
1565 | 1582 |
|
1566 | 1583 | coords = ((a, "a"), (b, "b"), (depth_c, "depth_c")) |
1567 | 1584 | for coord, term in coords: |
@@ -1658,7 +1675,9 @@ def make_coord(self, coord_dims_func): |
1658 | 1675 | "The {} coordinate {!r} has bounds. " |
1659 | 1676 | "These are being disregarded.".format(key, name) |
1660 | 1677 | ) |
1661 | | - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) |
| 1678 | + warn_once_at_level( |
| 1679 | + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 |
| 1680 | + ) |
1662 | 1681 | # Swap bounds with points. |
1663 | 1682 | bds_shape = list(nd_points_by_key[key].shape) + [1] |
1664 | 1683 | bounds = nd_points_by_key[key].reshape(bds_shape) |
@@ -1753,7 +1772,9 @@ def _check_dependencies(s, c, eta, depth, depth_c): |
1753 | 1772 | "The {} coordinate {!r} has bounds. " |
1754 | 1773 | "These are being disregarded.".format(term, coord.name()) |
1755 | 1774 | ) |
1756 | | - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) |
| 1775 | + warn_once_at_level( |
| 1776 | + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 |
| 1777 | + ) |
1757 | 1778 |
|
1758 | 1779 | if depth_c is not None and depth_c.shape != (1,): |
1759 | 1780 | msg = "Expected scalar depth_c coordinate {!r}: got shape {!r}.".format( |
@@ -1847,7 +1868,9 @@ def make_coord(self, coord_dims_func): |
1847 | 1868 | "The {} coordinate {!r} has bounds. " |
1848 | 1869 | "These are being disregarded.".format(key, name) |
1849 | 1870 | ) |
1850 | | - warn_once_at_level(msg, category=IrisIgnoringBoundsWarning, stacklevel=2) |
| 1871 | + warn_once_at_level( |
| 1872 | + msg, category=IrisIgnoringBoundsWarning, stacklevel=2 |
| 1873 | + ) |
1851 | 1874 | # Swap bounds with points. |
1852 | 1875 | bds_shape = list(nd_points_by_key[key].shape) + [1] |
1853 | 1876 | bounds = nd_points_by_key[key].reshape(bds_shape) |
|
0 commit comments