diff --git a/etc/iris_tests_results/file_load/theta_levels.cml b/etc/iris_tests_results/file_load/theta_levels.cml
index dacf19d2b6..0716ab3c3e 100644
--- a/etc/iris_tests_results/file_load/theta_levels.cml
+++ b/etc/iris_tests_results/file_load/theta_levels.cml
@@ -29,7 +29,7 @@
-
+
@@ -81,7 +81,7 @@
-
+
@@ -133,7 +133,7 @@
-
+
@@ -185,7 +185,7 @@
-
+
@@ -237,7 +237,7 @@
-
+
@@ -289,7 +289,7 @@
-
+
@@ -341,7 +341,7 @@
-
+
@@ -393,7 +393,7 @@
-
+
@@ -445,7 +445,7 @@
-
+
@@ -497,7 +497,7 @@
-
+
@@ -549,7 +549,7 @@
-
+
@@ -601,7 +601,7 @@
-
+
@@ -653,7 +653,7 @@
-
+
@@ -705,7 +705,7 @@
-
+
@@ -757,7 +757,7 @@
-
+
@@ -809,7 +809,7 @@
-
+
@@ -861,7 +861,7 @@
-
+
@@ -913,7 +913,7 @@
-
+
@@ -965,7 +965,7 @@
-
+
@@ -1017,7 +1017,7 @@
-
+
@@ -1069,7 +1069,7 @@
-
+
@@ -1121,7 +1121,7 @@
-
+
@@ -1173,7 +1173,7 @@
-
+
@@ -1225,7 +1225,7 @@
-
+
@@ -1277,7 +1277,7 @@
-
+
@@ -1329,7 +1329,7 @@
-
+
@@ -1381,7 +1381,7 @@
-
+
@@ -1433,7 +1433,7 @@
-
+
@@ -1485,7 +1485,7 @@
-
+
@@ -1537,7 +1537,7 @@
-
+
@@ -1589,7 +1589,7 @@
-
+
@@ -1641,7 +1641,7 @@
-
+
@@ -1693,7 +1693,7 @@
-
+
@@ -1745,7 +1745,7 @@
-
+
@@ -1797,7 +1797,7 @@
-
+
@@ -1849,7 +1849,7 @@
-
+
@@ -1901,7 +1901,7 @@
-
+
@@ -1953,7 +1953,7 @@
-
+
diff --git a/etc/iris_tests_results/file_load/u_wind_levels.cml b/etc/iris_tests_results/file_load/u_wind_levels.cml
index 3f1a105b94..92fe9150fa 100644
--- a/etc/iris_tests_results/file_load/u_wind_levels.cml
+++ b/etc/iris_tests_results/file_load/u_wind_levels.cml
@@ -30,7 +30,7 @@
-
+
@@ -83,7 +83,7 @@
-
+
@@ -136,7 +136,7 @@
-
+
@@ -189,7 +189,7 @@
-
+
@@ -242,7 +242,7 @@
-
+
@@ -295,7 +295,7 @@
-
+
@@ -348,7 +348,7 @@
-
+
@@ -401,7 +401,7 @@
-
+
@@ -454,7 +454,7 @@
-
+
@@ -507,7 +507,7 @@
-
+
@@ -560,7 +560,7 @@
-
+
@@ -613,7 +613,7 @@
-
+
@@ -666,7 +666,7 @@
-
+
@@ -719,7 +719,7 @@
-
+
@@ -772,7 +772,7 @@
-
+
@@ -825,7 +825,7 @@
-
+
@@ -878,7 +878,7 @@
-
+
@@ -931,7 +931,7 @@
-
+
@@ -984,7 +984,7 @@
-
+
@@ -1037,7 +1037,7 @@
-
+
@@ -1090,7 +1090,7 @@
-
+
@@ -1143,7 +1143,7 @@
-
+
@@ -1196,7 +1196,7 @@
-
+
@@ -1249,7 +1249,7 @@
-
+
@@ -1302,7 +1302,7 @@
-
+
@@ -1355,7 +1355,7 @@
-
+
@@ -1408,7 +1408,7 @@
-
+
@@ -1461,7 +1461,7 @@
-
+
@@ -1514,7 +1514,7 @@
-
+
@@ -1567,7 +1567,7 @@
-
+
@@ -1620,7 +1620,7 @@
-
+
@@ -1673,7 +1673,7 @@
-
+
@@ -1726,7 +1726,7 @@
-
+
@@ -1779,7 +1779,7 @@
-
+
@@ -1832,7 +1832,7 @@
-
+
@@ -1885,7 +1885,7 @@
-
+
@@ -1938,7 +1938,7 @@
-
+
@@ -1991,7 +1991,7 @@
-
+
diff --git a/etc/iris_tests_results/file_load/v_wind_levels.cml b/etc/iris_tests_results/file_load/v_wind_levels.cml
index c9623a213c..45b229525c 100644
--- a/etc/iris_tests_results/file_load/v_wind_levels.cml
+++ b/etc/iris_tests_results/file_load/v_wind_levels.cml
@@ -30,7 +30,7 @@
-
+
@@ -83,7 +83,7 @@
-
+
@@ -136,7 +136,7 @@
-
+
@@ -189,7 +189,7 @@
-
+
@@ -242,7 +242,7 @@
-
+
@@ -295,7 +295,7 @@
-
+
@@ -348,7 +348,7 @@
-
+
@@ -401,7 +401,7 @@
-
+
@@ -454,7 +454,7 @@
-
+
@@ -507,7 +507,7 @@
-
+
@@ -560,7 +560,7 @@
-
+
@@ -613,7 +613,7 @@
-
+
@@ -666,7 +666,7 @@
-
+
@@ -719,7 +719,7 @@
-
+
@@ -772,7 +772,7 @@
-
+
@@ -825,7 +825,7 @@
-
+
@@ -878,7 +878,7 @@
-
+
@@ -931,7 +931,7 @@
-
+
@@ -984,7 +984,7 @@
-
+
@@ -1037,7 +1037,7 @@
-
+
@@ -1090,7 +1090,7 @@
-
+
@@ -1143,7 +1143,7 @@
-
+
@@ -1196,7 +1196,7 @@
-
+
@@ -1249,7 +1249,7 @@
-
+
@@ -1302,7 +1302,7 @@
-
+
@@ -1355,7 +1355,7 @@
-
+
@@ -1408,7 +1408,7 @@
-
+
@@ -1461,7 +1461,7 @@
-
+
@@ -1514,7 +1514,7 @@
-
+
@@ -1567,7 +1567,7 @@
-
+
@@ -1620,7 +1620,7 @@
-
+
@@ -1673,7 +1673,7 @@
-
+
@@ -1726,7 +1726,7 @@
-
+
@@ -1779,7 +1779,7 @@
-
+
@@ -1832,7 +1832,7 @@
-
+
@@ -1885,7 +1885,7 @@
-
+
@@ -1938,7 +1938,7 @@
-
+
@@ -1991,7 +1991,7 @@
-
+
diff --git a/etc/iris_tests_results/file_load/wind_levels.cml b/etc/iris_tests_results/file_load/wind_levels.cml
index 14b01d0088..f623e18ca6 100644
--- a/etc/iris_tests_results/file_load/wind_levels.cml
+++ b/etc/iris_tests_results/file_load/wind_levels.cml
@@ -30,7 +30,7 @@
-
+
@@ -83,7 +83,7 @@
-
+
@@ -136,7 +136,7 @@
-
+
@@ -189,7 +189,7 @@
-
+
@@ -242,7 +242,7 @@
-
+
@@ -295,7 +295,7 @@
-
+
@@ -348,7 +348,7 @@
-
+
@@ -401,7 +401,7 @@
-
+
@@ -454,7 +454,7 @@
-
+
@@ -507,7 +507,7 @@
-
+
@@ -560,7 +560,7 @@
-
+
@@ -613,7 +613,7 @@
-
+
@@ -666,7 +666,7 @@
-
+
@@ -719,7 +719,7 @@
-
+
@@ -772,7 +772,7 @@
-
+
@@ -825,7 +825,7 @@
-
+
@@ -878,7 +878,7 @@
-
+
@@ -931,7 +931,7 @@
-
+
@@ -984,7 +984,7 @@
-
+
@@ -1037,7 +1037,7 @@
-
+
@@ -1090,7 +1090,7 @@
-
+
@@ -1143,7 +1143,7 @@
-
+
@@ -1196,7 +1196,7 @@
-
+
@@ -1249,7 +1249,7 @@
-
+
@@ -1302,7 +1302,7 @@
-
+
@@ -1355,7 +1355,7 @@
-
+
@@ -1408,7 +1408,7 @@
-
+
@@ -1461,7 +1461,7 @@
-
+
@@ -1514,7 +1514,7 @@
-
+
@@ -1567,7 +1567,7 @@
-
+
@@ -1620,7 +1620,7 @@
-
+
@@ -1673,7 +1673,7 @@
-
+
@@ -1726,7 +1726,7 @@
-
+
@@ -1779,7 +1779,7 @@
-
+
@@ -1832,7 +1832,7 @@
-
+
@@ -1885,7 +1885,7 @@
-
+
@@ -1938,7 +1938,7 @@
-
+
@@ -1991,7 +1991,7 @@
-
+
@@ -2044,7 +2044,7 @@
-
+
@@ -2097,7 +2097,7 @@
-
+
@@ -2150,7 +2150,7 @@
-
+
@@ -2203,7 +2203,7 @@
-
+
@@ -2256,7 +2256,7 @@
-
+
@@ -2309,7 +2309,7 @@
-
+
@@ -2362,7 +2362,7 @@
-
+
@@ -2415,7 +2415,7 @@
-
+
@@ -2468,7 +2468,7 @@
-
+
@@ -2521,7 +2521,7 @@
-
+
@@ -2574,7 +2574,7 @@
-
+
@@ -2627,7 +2627,7 @@
-
+
@@ -2680,7 +2680,7 @@
-
+
@@ -2733,7 +2733,7 @@
-
+
@@ -2786,7 +2786,7 @@
-
+
@@ -2839,7 +2839,7 @@
-
+
@@ -2892,7 +2892,7 @@
-
+
@@ -2945,7 +2945,7 @@
-
+
@@ -2998,7 +2998,7 @@
-
+
@@ -3051,7 +3051,7 @@
-
+
@@ -3104,7 +3104,7 @@
-
+
@@ -3157,7 +3157,7 @@
-
+
@@ -3210,7 +3210,7 @@
-
+
@@ -3263,7 +3263,7 @@
-
+
@@ -3316,7 +3316,7 @@
-
+
@@ -3369,7 +3369,7 @@
-
+
@@ -3422,7 +3422,7 @@
-
+
@@ -3475,7 +3475,7 @@
-
+
@@ -3528,7 +3528,7 @@
-
+
@@ -3581,7 +3581,7 @@
-
+
@@ -3634,7 +3634,7 @@
-
+
@@ -3687,7 +3687,7 @@
-
+
@@ -3740,7 +3740,7 @@
-
+
@@ -3793,7 +3793,7 @@
-
+
@@ -3846,7 +3846,7 @@
-
+
@@ -3899,7 +3899,7 @@
-
+
@@ -3952,7 +3952,7 @@
-
+
@@ -4005,7 +4005,7 @@
-
+
diff --git a/lib/iris/coords.py b/lib/iris/coords.py
index 6cf1f58e5b..27e656f103 100644
--- a/lib/iris/coords.py
+++ b/lib/iris/coords.py
@@ -59,8 +59,6 @@ def name(self, default='unknown'):
return self.standard_name or self.long_name or default
-USE_OLD_XML = False
-
# Coordinate cell styles. Used in plot and cartography.
POINT_MODE = 0
BOUND_MODE = 1
@@ -893,102 +891,6 @@ def _value_type_name(self):
value_type_name = 'unicode'
return value_type_name
- if USE_OLD_XML:
- def xml_element(self, doc):
- """Return a DOM element describing this Coord."""
- # Create the xml element
- element = doc.createElement(self._xml_element_name())
- self._xml_element_basic_attributes(element)
-
- if getattr(self, '_TEST_COMPAT_hybrid', False):
- hybrid = doc.createElement('hybridHeightCS')
- hybrid.setAttribute('orography', self._TEST_COMPAT_hybrid)
- element.appendChild(hybrid)
- else:
- # Add a user-attributes sub-element?
- if len(self.attributes) > 0:
- attributes_element = doc.createElement("attributes")
- for k, v in self.attributes.items():
- attributes_element.setAttribute(k, str(v))
- element.appendChild(attributes_element)
-
- # Add a coord system sub-element?
- if self.coord_system:
- element.appendChild(self.coord_system.xml_element(doc))
-
- return element
-
- def _xml_element_name(self):
- """Get xml CS name from class name."""
- name = "explicitCoord"
- from iris.fileformats.rules import is_regular
- if is_regular(self) and not (getattr(self, '_TEST_COMPAT_force_explicit', False)):
- name = "regularCoord"
- if self.shape == (1,) and getattr(self, '_TEST_COMPAT_force_regular_scalar', False):
- name = "regularCoord"
- return name
-
- def _xml_element_basic_attributes(self, element):
- """Add atomic, non-structural attributes to the xml element."""
- # Common
- element.setAttribute('name', self.name())
- element.setAttribute('unit', repr(self.units))
- if hasattr(self, '_TEST_COMPAT_override_axis'):
- axis = self._TEST_COMPAT_override_axis
- elif self.name() == 'forecast_reference_time':
- axis = 'rt'
- elif self.name() in ('level_height', 'sigma', 'model_level_number'):
- axis = 'z'
- else:
- axis = str(iris.util.guess_coord_axis(self) or self.name())
- element.setAttribute('axis', axis.lower())
- # approximation to definitive
- definitive = False
- if hasattr(self, '_TEST_COMPAT_definitive'):
- definitive = self._TEST_COMPAT_definitive
- elif self._xml_element_name() != 'regularCoord':
- definitive = (numpy.unique(self.points).size == self.points.size and
- self.name() != 'history' and self.name() != 'source')
- if definitive:
- element.setAttribute('definitive', 'true')
- value_type = getattr(self, '_TEST_COMPAT_value_type', self._value_type_name())
- element.setAttribute('value_type', str(value_type))
- if getattr(self, "circular", False):
- element.setAttribute('circular', str(self.circular))
-
- # Regular
- from iris.fileformats.rules import is_regular, regular_step
- if is_regular(self) and not (getattr(self, '_TEST_COMPAT_force_explicit', False)):
- element.setAttribute('start', str(self.points[0]))
- element.setAttribute('step', str(regular_step(self)))
- element.setAttribute('count', str(len(self.points)))
- if self.bounds is not None:
- if regular_step(self) == 0:
- bp = 0.5 # undefined so set to default value
- else:
- bp = (self.points[0] - self.bounds[0][0]) / (self.bounds[0][1] - self.bounds[0][0])
- element.setAttribute('bound_position', str(bp))
- # Scalar
- elif self.shape == (1,) and getattr(self, '_TEST_COMPAT_force_regular_scalar', False):
- element.setAttribute('start', str(self.points[0]))
- element.setAttribute('step', str(0.0))
- element.setAttribute('count', str(len(self.points)))
- if self.bounds is not None:
- bp = (self.points[0] - self.bounds[0][0]) / (self.bounds[0][1] - self.bounds[0][0])
- element.setAttribute('bound_position', str(bp))
- # Explicit
- else:
- if getattr(self, '_TEST_COMPAT_points', True) and self.standard_name != 'surface_altitude':
- if hasattr(self._points, 'to_xml_attr'):
- element.setAttribute('points', self._points.to_xml_attr())
- else:
- element.setAttribute('points', self._array_for_xml(self.points))
- if self._bounds is not None:
- if hasattr(self._bounds, 'to_xml_attr'):
- element.setAttribute('bounds', self._bounds.to_xml_attr())
- else:
- element.setAttribute('bounds', self._array_for_xml(self.bounds))
-
class DimCoord(Coord):
"""
diff --git a/lib/iris/cube.py b/lib/iris/cube.py
index 135d86d940..c275758f1f 100644
--- a/lib/iris/cube.py
+++ b/lib/iris/cube.py
@@ -48,9 +48,6 @@
from iris._cube_coord_common import CFVariableMixin, LimitedAttributeDict
-USE_OLD_XML = False
-
-
__all__ = ['Cube', 'CubeList', 'CubeMetadata']
@@ -1510,70 +1507,6 @@ def _xml_element(self, doc, checksum=False):
return cube_xml_element
- if USE_OLD_XML:
- def _xml_element(self, doc, checksum=False):
- cube_xml_element = doc.createElement("cube")
-
- cube_xml_element.setAttribute('standard_name', self.name(''))
- cube_xml_element.setAttribute('unit', str(self.units))
-
- if self.attributes:
- attributes_element = doc.createElement('attributes')
- for name in sorted(self.attributes.iterkeys()):
- attribute_element = doc.createElement('attribute')
- attribute_element.setAttribute('name', name)
- if name == 'history':
- value = re.sub("[\d\/]{8} [\d\:]{8} Iris\: ", '', str(self.attributes[name]))
- else:
- value = str(self.attributes[name])
- attribute_element.setAttribute('value', value)
- attributes_element.appendChild(attribute_element)
- cube_xml_element.appendChild(attributes_element)
-
- coords_xml_element = doc.createElement("coords")
- coords = self.dim_coords + self.aux_coords
- for coord in sorted(coords, key=lambda coord: coord.name()):
- coord_xml_element_wrapper = doc.createElement("coord")
- if self.coord_dims(coord):
- coord_xml_element_wrapper.setAttribute('datadims', str(self.coord_dims(coord)))
- coord_xml_element = coord.xml_element(doc)
- coord_xml_element_wrapper.appendChild(coord_xml_element)
- coords_xml_element.appendChild(coord_xml_element_wrapper)
-
- cube_xml_element.appendChild(coords_xml_element)
-
- # cell methods (no sorting!)
- cell_methods_xml_element = doc.createElement("cellMethods")
- for cm in self.cell_methods:
- cell_method_xml_element = cm.xml_element(doc)
- cell_methods_xml_element.appendChild(cell_method_xml_element)
- cube_xml_element.appendChild(cell_methods_xml_element)
-
- if self._data is not None:
- data_xml_element = doc.createElement("data")
-
- data_xml_element.setAttribute("shape", str(self.shape))
-
- # Add the datatype
- if self._data_manager is not None:
- data_xml_element.setAttribute("dtype", self._data_manager.data_type.name)
- else:
- data_xml_element.setAttribute("dtype", self._data.dtype.name)
-
- # getting a checksum triggers any deferred loading
- if checksum:
- data_xml_element.setAttribute("checksum", hex(zlib.crc32(self.data)))
- if isinstance(self.data, numpy.ma.core.MaskedArray):
- data_xml_element.setAttribute("mask_checksum", hex(zlib.crc32(self.data.mask)))
- elif self._data_manager is not None:
- data_xml_element.setAttribute("state", "deferred")
- else:
- data_xml_element.setAttribute("state", "loaded")
-
- cube_xml_element.appendChild(data_xml_element)
-
- return cube_xml_element
-
def copy(self, data=None):
"""
Returns a deep copy of this cube.
diff --git a/lib/iris_tests/stock.py b/lib/iris_tests/stock.py
index 6d1e2688b9..82dc556683 100644
--- a/lib/iris_tests/stock.py
+++ b/lib/iris_tests/stock.py
@@ -60,14 +60,8 @@ def callback_global_pp(cube, field, filename):
return cube
def simple_pp():
-
filename = tests.get_data_path(['PP', 'simple_pp', 'global.pp']) # Differs from global_pp()
cube = iris.load_strict(filename)
-
- cube.coord("forecast_period")._TEST_COMPAT_override_axis = "forecast_period"
- cube.coord("source")._TEST_COMPAT_override_axis = "source"
- cube.coord("source")._TEST_COMPAT_definitive = False
-
return cube
@@ -121,14 +115,6 @@ def simple_2d(with_bounds=True):
x_bounds = numpy.array([[-15, 0], [0, 15], [15, 30], [30, 45]], dtype=numpy.int32)
x_coord = iris.coords.DimCoord(x_points, long_name='foo', units='1', bounds=x_bounds if with_bounds else None)
- # TEMPORARY compat fixes
- y_coord._TEST_COMPAT_force_explicit = True
- y_coord._TEST_COMPAT_definitive = False
- y_coord._TEST_COMPAT_override_axis = 'y'
- x_coord._TEST_COMPAT_force_explicit = True
- x_coord._TEST_COMPAT_definitive = False
- x_coord._TEST_COMPAT_override_axis = 'x'
-
cube.add_dim_coord(y_coord, 0)
cube.add_dim_coord(x_coord, 1)
return cube
@@ -196,12 +182,7 @@ def simple_3d_w_multidim_coords(with_bounds=True):
[[-25, 0], [0, 8], [8, 45], [45, 50]],
[[-5, 10], [10, 18], [18, 55], [18, 70]]], dtype=numpy.int32)
x_coord = iris.coords.AuxCoord(points=x_points, long_name='foo', units='1', bounds=x_bounds if with_bounds else None)
-
wibble_coord = iris.coords.DimCoord(numpy.array([ 10., 30.], dtype=numpy.float32), long_name='wibble', units='1')
- x_coord._TEST_COMPAT_override_axis = 'x'
- x_coord._TEST_COMPAT_definitive = False
- y_coord._TEST_COMPAT_override_axis = 'y'
- wibble_coord._TEST_COMPAT_override_axis = 'w'
cube.add_dim_coord(wibble_coord, [0])
cube.add_aux_coord(y_coord, [1, 2])
@@ -254,19 +235,6 @@ def simple_2d_w_multidim_and_scalars():
my_multi_dim_coord = iris.coords.AuxCoord(numpy.arange(50, dtype=numpy.int32).reshape(5, 10),
long_name='my_multi_dim_coord', units='1',
bounds=numpy.arange(200, dtype=numpy.int32).reshape(5, 10, 4))
-
-
- dim1._TEST_COMPAT_override_axis = 'y'
- dim1._TEST_COMPAT_definitive = False
- dim2._TEST_COMPAT_override_axis = 'x'
- dim2._TEST_COMPAT_definitive = False
- dim2._TEST_COMPAT_force_explicit = True
- an_other._TEST_COMPAT_override_axis = 't'
- an_other._TEST_COMPAT_definitive = False
- an_other._TEST_COMPAT_force_explicit = True
- my_multi_dim_coord._TEST_COMPAT_override_axis = 'foo'
- my_multi_dim_coord._TEST_COMPAT_definitive = False
- my_multi_dim_coord._TEST_COMPAT_force_explicit = True
cube.add_dim_coord(dim1, 0)
cube.add_dim_coord(dim2, 1)
diff --git a/lib/iris_tests/test_aggregate_by.py b/lib/iris_tests/test_aggregate_by.py
index 8132674e07..ed87c056c0 100644
--- a/lib/iris_tests/test_aggregate_by.py
+++ b/lib/iris_tests/test_aggregate_by.py
@@ -99,47 +99,6 @@ def setUp(self):
[[15., 30., 45.], [60., 75., 90.], [105., 120., 135.]],
[[16.5, 33., 49.5], [66., 82.5, 99.], [115.5, 132., 148.5]]], dtype=np.float64)
- def assertCML(self, cube, path, *args, **kwargs):
- try:
- coord = cube.coord('height')
- coord._TEST_COMPAT_force_explicit = True
- coord._TEST_COMPAT_definitive = False
- coord._TEST_COMPAT_override_axis = 'z'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('model_level')
- coord._TEST_COMPAT_override_axis = 'z'
- coord._TEST_COMPAT_definitive = False
- coord._TEST_COMPAT_points = False
- coord._TEST_COMPAT_value_type = 'int32'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('level')
- coord._TEST_COMPAT_override_axis = 'z'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('gamma')
- coord._TEST_COMPAT_force_explicit = True
- coord._TEST_COMPAT_override_axis = 'z'
- coord._TEST_COMPAT_definitive = False
- coord._TEST_COMPAT_points = False
- coord._TEST_COMPAT_value_type = 'int32'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('sigma')
- coord._TEST_COMPAT_force_explicit = True
- coord._TEST_COMPAT_override_axis = 'z'
- coord._TEST_COMPAT_definitive = False
- coord._TEST_COMPAT_points = False
- coord._TEST_COMPAT_value_type = 'int32'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- super(TestAggregateBy, self).assertCML(cube, path, *args, **kwargs)
-
def test_single(self):
# group-by with single coordinate name.
aggregateby_cube = self.cube_single.aggregated_by('height', iris.analysis.MEAN)
@@ -230,9 +189,6 @@ def test_easy(self):
#
aggregateby_cube = cube.aggregated_by('longitude', iris.analysis.MEAN)
np.testing.assert_almost_equal(aggregateby_cube.data, np.array([[8., 15.], [10., 17.], [15., 8.]], dtype=np.float32))
- coord = aggregateby_cube.coord('longitude')
- coord._TEST_COMPAT_force_explicit = True
- coord._TEST_COMPAT_definitive = False
self.assertCML(aggregateby_cube, ('analysis', 'aggregated_by', 'easy.cml'), checksum=False)
aggregateby_cube = cube.aggregated_by('latitude', iris.analysis.MEAN)
diff --git a/lib/iris_tests/test_analysis.py b/lib/iris_tests/test_analysis.py
index 0b1984b9c2..d0f442849b 100644
--- a/lib/iris_tests/test_analysis.py
+++ b/lib/iris_tests/test_analysis.py
@@ -113,46 +113,18 @@ def test_weighted_mean_little(self):
cube.add_dim_coord(lat_coord, 0)
cube.add_dim_coord(lon_coord, 1)
cube.add_aux_coord(iris.coords.AuxCoord(numpy.arange(3, dtype=numpy.float32), long_name="dummy", units=1), 1)
-
- cube.coord("dummy")._TEST_COMPAT_override_axis = "x"
- cube.coord("lon")._TEST_COMPAT_override_axis = "x"
- cube.coord("lon")._TEST_COMPAT_force_explicit = True
- cube.coord("lat")._TEST_COMPAT_override_axis = "y"
- cube.coord("lat")._TEST_COMPAT_force_explicit = True
-
self.assertCML(cube, ('analysis', 'weighted_mean_source.cml'))
a = cube.collapsed('lat', iris.analysis.MEAN, weights=weights)
-
- a.coord("dummy")._TEST_COMPAT_override_axis = "x"
- a.coord("lon")._TEST_COMPAT_override_axis = "x"
- a.coord("lon")._TEST_COMPAT_force_explicit = True
- a.coord("lat")._TEST_COMPAT_override_axis = "y"
- a.coord("lat")._TEST_COMPAT_force_explicit = True
-
self.assertCMLApproxData(a, ('analysis', 'weighted_mean_lat.cml'))
b = cube.collapsed(lon_coord, iris.analysis.MEAN, weights=weights)
b.data = numpy.asarray(b.data)
-
- b.coord("dummy")._TEST_COMPAT_override_axis = "x"
- b.coord("lon")._TEST_COMPAT_override_axis = "x"
- b.coord("lon")._TEST_COMPAT_force_explicit = True
- b.coord("lat")._TEST_COMPAT_override_axis = "y"
- b.coord("lat")._TEST_COMPAT_force_explicit = True
-
self.assertCMLApproxData(b, ('analysis', 'weighted_mean_lon.cml'))
self.assertEquals(b.coord("dummy").shape, (1,))
# test collapsing multiple coordinates (and the fact that one of the coordinates isn't the same coordinate instance as on the cube)
c = cube.collapsed([lat_coord[:], lon_coord], iris.analysis.MEAN, weights=weights)
-
- c.coord("dummy")._TEST_COMPAT_override_axis = "x"
- c.coord("lon")._TEST_COMPAT_override_axis = "x"
- c.coord("lon")._TEST_COMPAT_force_explicit = True
- c.coord("lat")._TEST_COMPAT_override_axis = "y"
- c.coord("lat")._TEST_COMPAT_force_explicit = True
-
self.assertCMLApproxData(c, ('analysis', 'weighted_mean_latlon.cml'))
self.assertEquals(c.coord("dummy").shape, (1,))
@@ -213,14 +185,6 @@ def setUp(self):
file = tests.get_data_path(('PP', 'aPProt1', 'rotatedMHtimecube.pp'))
cubes = iris.load(file)
self.cube = cubes[0]
-
- self.cube.coord("forecast_period")._TEST_COMPAT_force_explicit = True
-# self.cube.coord("forecast_period")._TEST_COMPAT_definitive = False
- self.cube.coord("forecast_period")._TEST_COMPAT_override_axis = "forecast_period"
- self.cube.coord("source")._TEST_COMPAT_definitive = False
- self.cube.coord("source")._TEST_COMPAT_override_axis = "source"
- self.cube.coord("time")._TEST_COMPAT_force_explicit = True
-
self.assertCML(self.cube, ('analysis', 'original.cml'))
def _common(self, name, aggregate, original_name='original_common.cml', *args, **kwargs):
@@ -325,15 +289,6 @@ def test_sum(self):
class TestAggregators(tests.IrisTest):
- def assertCML(self, cube, path, *args, **kwargs):
- try:
- coord = cube.coord('foo')
- coord._TEST_COMPAT_definitive = False
- coord._TEST_COMPAT_override_axis = 'x'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- super(TestAggregators, self).assertCML(cube, path, *args, **kwargs)
-
def test_percentile_1d(self):
cube = tests.stock.simple_1d()
@@ -499,21 +454,6 @@ def setUp(self):
self.cube = cube
- def assertCML(self, cube, path, *args, **kwargs):
- try:
- coord = cube.coord('longitude')
- coord._TEST_COMPAT_force_explicit = True
- coord._TEST_COMPAT_definitive = False
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('latitude')
- coord._TEST_COMPAT_force_explicit = True
- coord._TEST_COMPAT_definitive = False
- except iris.exceptions.CoordinateNotFoundError:
- pass
- super(TestRollingWindow, self).assertCML(cube, path, *args, **kwargs)
-
def test_non_mean_operator(self):
res_cube = self.cube.rolling_window('longitude', iris.analysis.MAX, window=2)
expected_result = numpy.array([[10, 12, 18],
diff --git a/lib/iris_tests/test_analysis_calculus.py b/lib/iris_tests/test_analysis_calculus.py
index e82f8997bd..52ad5b9bc4 100644
--- a/lib/iris_tests/test_analysis_calculus.py
+++ b/lib/iris_tests/test_analysis_calculus.py
@@ -51,90 +51,65 @@ def _simple_filename(self, suffix):
def test_simple1_delta_midpoint(self):
a = iris.coords.DimCoord((numpy.arange(4, dtype=numpy.float32) * 90) - 180, long_name='foo',
units='degrees', circular=True)
- a._TEST_COMPAT_override_axis = 'foo'
- a._TEST_COMPAT_definitive = False
self.assertXMLElement(a, self._simple_filename('1'))
delta = iris.analysis.calculus._construct_delta_coord(a)
- delta._TEST_COMPAT_override_axis = 'foo'
self.assertXMLElement(delta, self._simple_filename('1_delta'))
midpoint = iris.analysis.calculus._construct_midpoint_coord(a)
- midpoint._TEST_COMPAT_override_axis = 'foo'
- midpoint._TEST_COMPAT_definitive = False
self.assertXMLElement(midpoint, self._simple_filename('1_midpoint'))
def test_simple2_delta_midpoint(self):
a = iris.coords.DimCoord((numpy.arange(4, dtype=numpy.float32) * -90) + 180, long_name='foo',
units='degrees', circular=True)
- a._TEST_COMPAT_override_axis = 'foo'
- a._TEST_COMPAT_definitive = False
self.assertXMLElement(a, self._simple_filename('2'))
delta = iris.analysis.calculus._construct_delta_coord(a)
- delta._TEST_COMPAT_override_axis = 'foo'
self.assertXMLElement(delta, self._simple_filename('2_delta'))
midpoint = iris.analysis.calculus._construct_midpoint_coord(a)
- midpoint._TEST_COMPAT_override_axis = 'foo'
- midpoint._TEST_COMPAT_definitive = False
self.assertXMLElement(midpoint, self._simple_filename('2_midpoint'))
def test_simple3_delta_midpoint(self):
a = iris.coords.DimCoord((numpy.arange(4, dtype=numpy.float32) * 90) - 180, long_name='foo',
units='degrees', circular=True)
a.guess_bounds(0.5)
- a._TEST_COMPAT_override_axis = 'foo'
- a._TEST_COMPAT_definitive = False
self.assertXMLElement(a, self._simple_filename('3'))
delta = iris.analysis.calculus._construct_delta_coord(a)
- delta._TEST_COMPAT_override_axis = 'foo'
self.assertXMLElement(delta, self._simple_filename('3_delta'))
midpoint = iris.analysis.calculus._construct_midpoint_coord(a)
- midpoint._TEST_COMPAT_override_axis = 'foo'
- midpoint._TEST_COMPAT_definitive = False
self.assertXMLElement(midpoint, self._simple_filename('3_midpoint'))
def test_simple4_delta_midpoint(self):
a = iris.coords.AuxCoord(numpy.arange(4, dtype=numpy.float32) * 90 - 180, long_name='foo', units='degrees')
a.guess_bounds()
- a._TEST_COMPAT_definitive = False
- a._TEST_COMPAT_override_axis = 'foo'
b = a.copy()
self.assertXMLElement(b, self._simple_filename('4'))
delta = iris.analysis.calculus._construct_delta_coord(b)
- delta._TEST_COMPAT_override_axis = 'foo'
self.assertXMLElement(delta, self._simple_filename('4_delta'))
midpoint = iris.analysis.calculus._construct_midpoint_coord(b)
- midpoint._TEST_COMPAT_override_axis = 'foo'
self.assertXMLElement(midpoint, self._simple_filename('4_midpoint'))
def test_simple5_not_degrees_delta_midpoint(self):
# Not sure it makes sense to have a circular coordinate which does not have a modulus but test it anyway.
a = iris.coords.DimCoord(numpy.arange(4, dtype=numpy.float32) * 90 - 180,
long_name='foo', units='meter', circular=True)
- a._TEST_COMPAT_override_axis = 'foo'
self.assertXMLElement(a, self._simple_filename('5'))
delta = iris.analysis.calculus._construct_delta_coord(a)
- delta._TEST_COMPAT_override_axis = 'foo'
- delta._TEST_COMPAT_definitive = True
self.assertXMLElement(delta, self._simple_filename('5_delta'))
midpoints = iris.analysis.calculus._construct_midpoint_coord(a)
- midpoints._TEST_COMPAT_override_axis = 'foo'
- midpoints._TEST_COMPAT_definitive = True
self.assertXMLElement(midpoints, self._simple_filename('5_midpoint'))
def test_simple6_delta_midpoint(self):
a = iris.coords.DimCoord(numpy.arange(5, dtype=numpy.float32), long_name='foo',
units='count', circular=True)
midpoints = iris.analysis.calculus._construct_midpoint_coord(a)
- midpoints._TEST_COMPAT_override_axis = 'foo'
self.assertXMLElement(midpoints, self._simple_filename('6'))
def test_singular_delta(self):
@@ -142,8 +117,6 @@ def test_singular_delta(self):
lon = iris.coords.DimCoord(numpy.float32(-180.), 'latitude', units='degrees', circular=True)
r_expl = iris.analysis.calculus._construct_delta_coord(lon)
- r_expl._TEST_COMPAT_force_explicit = True
- r_expl._TEST_COMPAT_override_axis = 'x'
self.assertXMLElement(r_expl, ('analysis', 'delta_and_midpoint', 'delta_one_element_explicit.xml'))
# Test single valued coordinate mid-points when not circular
@@ -156,7 +129,6 @@ def test_singular_midpoint(self):
lon = iris.coords.DimCoord(numpy.float32(-180.), 'latitude', units='degrees', circular=True)
r_expl = iris.analysis.calculus._construct_midpoint_coord(lon)
- r_expl._TEST_COMPAT_override_axis = 'x'
self.assertXMLElement(r_expl, ('analysis', 'delta_and_midpoint', 'midpoint_one_element_explicit.xml'))
# Test single valued coordinate mid-points when not circular
@@ -207,7 +179,6 @@ def setUp(self):
def test_diff_wrt_x(self):
t = iris.analysis.calculus.differentiate(self.cube, 'x')
- t.coord("x")._TEST_COMPAT_definitive = True
self.assertCMLApproxData(t, ('analysis', 'calculus', 'handmade_wrt_x.cml'))
def test_diff_wrt_y(self):
@@ -216,7 +187,6 @@ def test_diff_wrt_y(self):
def test_diff_wrt_lon(self):
t = iris.analysis.calculus.differentiate(self.cube, 'longitude')
- t.coord("x")._TEST_COMPAT_definitive = True
self.assertCMLApproxData(t, ('analysis', 'calculus', 'handmade_wrt_lon.cml'))
def test_diff_wrt_lat(self):
@@ -225,7 +195,6 @@ def test_diff_wrt_lat(self):
def test_delta_wrt_x(self):
t = iris.analysis.calculus.cube_delta(self.cube, 'x')
- t.coord("x")._TEST_COMPAT_definitive = True
self.assertCMLApproxData(t, ('analysis', 'calculus', 'delta_handmade_wrt_x.cml'))
def test_delta_wrt_y(self):
@@ -234,7 +203,6 @@ def test_delta_wrt_y(self):
def test_delta_wrt_lon(self):
t = iris.analysis.calculus.cube_delta(self.cube, 'longitude')
- t.coord("x")._TEST_COMPAT_definitive = True
self.assertCMLApproxData(t, ('analysis', 'calculus', 'delta_handmade_wrt_lon.cml'))
def test_delta_wrt_lat(self):
@@ -470,10 +438,6 @@ def test_contrived_sphrical_curl1(self):
result = r.copy(data=r.data * 0)
numpy.testing.assert_array_almost_equal(result.data[5:-5], r.data[5:-5], decimal=1)
-
- r.coord("latitude")._TEST_COMPAT_force_explicit = True
- r.coord("longitude")._TEST_COMPAT_force_explicit = True
-
self.assertCML(r, ('analysis', 'calculus', 'grad_contrived1.cml'), checksum=False)
def test_contrived_sphrical_curl2(self):
@@ -511,10 +475,6 @@ def test_contrived_sphrical_curl2(self):
result = r.copy(data=2*cos_x_pts*cos_y_pts)
numpy.testing.assert_array_almost_equal(result.data[30:-30, :], r.data[30:-30, :], decimal=1)
-
- r.coord("latitude")._TEST_COMPAT_force_explicit = True
- r.coord("longitude")._TEST_COMPAT_force_explicit = True
-
self.assertCML(r, ('analysis', 'calculus', 'grad_contrived2.cml'), checksum=False)
diff --git a/lib/iris_tests/test_basic_maths.py b/lib/iris_tests/test_basic_maths.py
index e403a1ab0a..f784fd7767 100644
--- a/lib/iris_tests/test_basic_maths.py
+++ b/lib/iris_tests/test_basic_maths.py
@@ -30,31 +30,21 @@
import iris.tests.stock
-def old_style_coords(c, *coord_names):
- for coord_name in coord_names:
- c.coord(coord_name)._TEST_COMPAT_override_axis = coord_name
- if coord_name == "source":
- c.coord(coord_name)._TEST_COMPAT_definitive = False
-
-
@iris.tests.skip_data
class TestBasicMaths(tests.IrisTest):
def setUp(self):
self.cube = iris.tests.stock.global_pp()
self.cube.data = self.cube.data - 260
- old_style_coords(self.cube, "forecast_period", "source")
def test_abs(self):
a = self.cube
b = iris.analysis.maths.abs(a, in_place=False)
self.assertCML(a, ('analysis', 'maths_original.cml'))
- old_style_coords(b, "forecast_period", "source")
self.assertCML(b, ('analysis', 'abs.cml'))
iris.analysis.maths.abs(a, in_place=True)
self.assertCML(b, ('analysis', 'abs.cml'))
- old_style_coords(a, "forecast_period", "source")
self.assertCML(a, ('analysis', 'abs.cml'))
def test_minus(self):
@@ -65,14 +55,12 @@ def test_minus(self):
self.assertCML(a, ('analysis', 'maths_original.cml'))
d = a - a
- old_style_coords(d, "forecast_period", "source")
self.assertCML(d, ('analysis', 'subtract.cml'))
# Check that the subtraction has had no effect on the original
self.assertCML(a, ('analysis', 'maths_original.cml'))
c = iris.analysis.maths.subtract(e, e)
- old_style_coords(c, "forecast_period", "source")
self.assertCML(c, ('analysis', 'subtract.cml'))
# Check that the subtraction has had no effect on the original
@@ -100,7 +88,6 @@ def test_minus_scalar(self):
self.assertCML(a, ('analysis', 'maths_original.cml'))
b = a - 200
- old_style_coords(b, "forecast_period", "source")
self.assertCML(b, ('analysis', 'subtract_scalar.cml'))
# Check that the subtraction has had no effect on the original
self.assertCML(a, ('analysis', 'maths_original.cml'))
@@ -115,7 +102,6 @@ def test_minus_array(self):
# subtract an array of exactly the same shape as the original
b = a - data_array
self.assertArrayEqual(b.data, numpy.array(0, dtype=numpy.float32))
- old_style_coords(b, "forecast_period", "source")
self.assertCML(b, ('analysis', 'subtract_array.cml'), checksum=False)
# subtract an array of the same number of dimensions, but with one of the dimensions having len 1
@@ -146,13 +132,11 @@ def test_minus_coord(self):
self.assertCML(a, ('analysis', 'maths_original.cml'))
b = iris.analysis.maths.subtract(a, c_x, dim=1)
- old_style_coords(b, "forecast_period", "source")
self.assertCML(b, ('analysis', 'subtract_coord_x.cml'))
# Check that the subtraction has had no effect on the original
self.assertCML(a, ('analysis', 'maths_original.cml'))
b = iris.analysis.maths.subtract(a, c_y, dim=0)
- old_style_coords(b, "forecast_period", "source")
self.assertCML(b, ('analysis', 'subtract_coord_y.cml'))
# Check that the subtraction has had no effect on the original
self.assertCML(a, ('analysis', 'maths_original.cml'))
@@ -163,7 +147,6 @@ def test_addition_scalar(self):
self.assertCML(a, ('analysis', 'maths_original.cml'))
b = a + 200
- old_style_coords(b, "forecast_period", "source")
self.assertCML(b, ('analysis', 'addition_scalar.cml'))
# Check that the addition has had no effect on the original
self.assertCML(a, ('analysis', 'maths_original.cml'))
@@ -179,13 +162,11 @@ def test_addition_coord(self):
self.assertCML(a, ('analysis', 'maths_original.cml'))
b = iris.analysis.maths.add(a, c_x, dim=1)
- old_style_coords(b, "forecast_period", "source")
self.assertCML(b, ('analysis', 'addition_coord_x.cml'))
# Check that the addition has had no effect on the original
self.assertCML(a, ('analysis', 'maths_original.cml'))
b = iris.analysis.maths.add(a, c_y, dim=0)
- old_style_coords(b, "forecast_period", "source")
self.assertCML(b, ('analysis', 'addition_coord_y.cml'))
# Check that the addition has had no effect on the original
self.assertCML(a, ('analysis', 'maths_original.cml'))
@@ -194,7 +175,6 @@ def test_addition(self):
a = self.cube
c = a + a
- old_style_coords(c, "forecast_period", "source")
self.assertCML(c, ('analysis', 'addition.cml'))
# Check that the addition has had no effect on the original
self.assertCML(a, ('analysis', 'maths_original.cml'))
@@ -204,7 +184,6 @@ def test_addition_different_standard_name(self):
b = self.cube.copy()
b.rename('my cube data')
c = a + b
- old_style_coords(c, "forecast_period", "source")
self.assertCML(c, ('analysis', 'addition_different_std_name.cml'), checksum=False)
def test_addition_fail(self):
@@ -223,7 +202,6 @@ def test_addition_in_place(self):
b = iris.analysis.maths.add(a, self.cube, in_place=True)
self.assertTrue(b is a)
- old_style_coords(a, "forecast_period", "source")
self.assertCML(a, ('analysis', 'addition_in_place.cml'))
def test_addition_in_place_coord(self):
@@ -232,7 +210,6 @@ def test_addition_in_place_coord(self):
# scalar is promoted to a coordinate internally
b = iris.analysis.maths.add(a, 1000, in_place=True)
self.assertTrue(b is a)
- old_style_coords(a, "forecast_period", "source")
self.assertCML(a, ('analysis', 'addition_in_place_coord.cml'))
def test_addition_different_attributes(self):
@@ -249,7 +226,6 @@ class TestDivideAndMultiply(tests.IrisTest):
def setUp(self):
self.cube = iris.tests.stock.global_pp()
self.cube.data = self.cube.data - 260
- old_style_coords(self.cube, "forecast_period", "source")
def test_divide(self):
a = self.cube
@@ -257,7 +233,6 @@ def test_divide(self):
c = a / a
numpy.testing.assert_array_almost_equal(a.data / a.data, c.data)
- old_style_coords(c, "forecast_period", "source")
self.assertCML(c, ('analysis', 'division.cml'), checksum=False)
# Check that the division has had no effect on the original
@@ -269,7 +244,6 @@ def test_divide_by_scalar(self):
c = a / 10
numpy.testing.assert_array_almost_equal(a.data / 10, c.data)
- old_style_coords(c, "forecast_period", "source")
self.assertCML(c, ('analysis', 'division_scalar.cml'), checksum=False)
# Check that the division has had no effect on the original
@@ -279,7 +253,6 @@ def test_divide_by_coordinate(self):
a = self.cube
c = a / a.coord('latitude')
- old_style_coords(c, "forecast_period", "source")
self.assertCML(c, ('analysis', 'division_by_latitude.cml'))
# Check that the division has had no effect on the original
@@ -292,7 +265,6 @@ def test_divide_by_array(self):
# test division by exactly the same shape data
c = a / data_array
self.assertArrayEqual(c.data, numpy.array(1, dtype=numpy.float32))
- old_style_coords(c, "forecast_period", "source")
self.assertCML(c, ('analysis', 'division_by_array.cml'), checksum=False)
# test division by array of fewer dimensions
@@ -313,7 +285,6 @@ def test_divide_by_coordinate_dim2(self):
a.coord('longitude').points = a.coord('longitude').points + 0.5
c = a / a.coord('longitude')
- old_style_coords(c, "forecast_period", "source")
self.assertCML(c, ('analysis', 'division_by_longitude.cml'))
# Reset to allow comparison with original
@@ -327,7 +298,6 @@ def test_divide_by_singluar_coordinate(self):
coord = iris.coords.DimCoord(points=2, long_name='foo', units='1')
c = iris.analysis.maths.divide(a, coord)
- old_style_coords(c, "forecast_period", "source")
self.assertCML(c, ('analysis', 'division_by_singular_coord.cml'))
# Check that the division is equivalent to dividing the whole of the data by 2
@@ -344,7 +314,6 @@ def test_multiply(self):
a = self.cube
c = a * a
- old_style_coords(c, "forecast_period", "source")
self.assertCML(c, ('analysis', 'multiply.cml'))
# Check that the multiplication has had no effect on the original
@@ -355,7 +324,6 @@ def test_multiplication_different_standard_name(self):
b = self.cube.copy()
b.rename('my cube data')
c = a * b
- old_style_coords(c, "forecast_period", "source")
self.assertCML(c, ('analysis', 'multiply_different_std_name.cml'), checksum=False)
def test_multiplication_different_attributes(self):
@@ -372,13 +340,11 @@ class TestExponentiate(tests.IrisTest):
def setUp(self):
self.cube = iris.tests.stock.global_pp()
self.cube.data = self.cube.data - 260
- old_style_coords(self.cube, "forecast_period", "source")
def test_exponentiate(self):
a = self.cube
a.data = a.data.astype(numpy.float64)
e = pow(a, 4)
- old_style_coords(e, "forecast_period", "source")
self.assertCMLApproxData(e, ('analysis', 'exponentiate.cml'))
def test_square_root(self):
@@ -389,7 +355,6 @@ def test_square_root(self):
e = a ** 0.5
- old_style_coords(e, "forecast_period", "source")
self.assertCML(e, ('analysis', 'sqrt.cml'))
self.assertArrayEqual(e.data, a.data ** 0.5)
self.assertRaises(ValueError, iris.analysis.maths.exponentiate, a, 0.3)
@@ -399,21 +364,17 @@ def test_square_root(self):
class TestLog(tests.IrisTest):
def setUp(self):
self.cube = iris.tests.stock.global_pp()
- old_style_coords(self.cube, "forecast_period", "source")
def test_log(self):
e = iris.analysis.maths.log(self.cube)
- old_style_coords(e, "forecast_period", "source")
self.assertCMLApproxData(e, ('analysis', 'log.cml'))
def test_log2(self):
e = iris.analysis.maths.log2(self.cube)
- old_style_coords(e, "forecast_period", "source")
self.assertCMLApproxData(e, ('analysis', 'log2.cml'))
def test_log10(self):
e = iris.analysis.maths.log10(self.cube)
- old_style_coords(e, "forecast_period", "source")
self.assertCMLApproxData(e, ('analysis', 'log10.cml'))
diff --git a/lib/iris_tests/test_cdm.py b/lib/iris_tests/test_cdm.py
index 9f694ac059..06ff734536 100644
--- a/lib/iris_tests/test_cdm.py
+++ b/lib/iris_tests/test_cdm.py
@@ -454,15 +454,11 @@ def test_cube_indexing_1d_multi_slice(self):
self.assertCML([self.t[0, numpy.array([0, 1])]], ('cube_slice', '2d_to_1d_cube_multi_slice.cml'))
def test_cube_indexing_1d_multi_slice2(self):
- self.t.coord('dim1')._TEST_COMPAT_force_explicit = True
- self.t.coord('dim1')._TEST_COMPAT_definitive = True
self.assertCML([self.t[(0, 2), (0, 1, 3)]], ('cube_slice', '2d_to_1d_cube_multi_slice2.cml'))
self.assertCML([self.t[numpy.array([0, 2]), (0, 1, 3)]], ('cube_slice', '2d_to_1d_cube_multi_slice2.cml'))
self.assertCML([self.t[numpy.array([0, 2]), numpy.array([0, 1, 3])]], ('cube_slice', '2d_to_1d_cube_multi_slice2.cml'))
def test_cube_indexing_1d_multi_slice3(self):
- self.t.coord('dim1')._TEST_COMPAT_force_explicit = True
- self.t.coord('dim1')._TEST_COMPAT_definitive = True
self.assertCML([self.t[(0, 2), :]], ('cube_slice', '2d_to_1d_cube_multi_slice3.cml'))
self.assertCML([self.t[numpy.array([0, 2]), :]], ('cube_slice', '2d_to_1d_cube_multi_slice3.cml'))
@@ -490,8 +486,6 @@ def test_ellipsis(self):
self.assertCML([self.t[0, Ellipsis, 0]], ('cube_slice', '2d_to_0d_cube_slice.cml'))
self.assertCML([self.t[0, 0, Ellipsis]], ('cube_slice', '2d_to_0d_cube_slice.cml'))
- self.t.coord('dim1')._TEST_COMPAT_force_explicit = True
- self.t.coord('dim1')._TEST_COMPAT_definitive = True
self.assertCML([self.t[Ellipsis, (0, 2), :]], ('cube_slice', '2d_to_1d_cube_multi_slice3.cml'))
self.assertCML([self.t[(0, 2), Ellipsis, :]], ('cube_slice', '2d_to_1d_cube_multi_slice3.cml'))
self.assertCML([self.t[(0, 2), :, Ellipsis]], ('cube_slice', '2d_to_1d_cube_multi_slice3.cml'))
@@ -556,21 +550,10 @@ def test_cube_extract_by_coord_advanced(self):
class TestCubeExtract(tests.IrisTest):
def setUp(self):
self.single_cube = iris.load_strict(tests.get_data_path(('PP', 'globClim1', 'theta.pp')), 'air_potential_temperature')
- self.single_cube.coord('forecast_period')._TEST_COMPAT_override_axis = 'forecast_period'
- self.single_cube.coord('forecast_reference_time')._TEST_COMPAT_override_axis = 'rt'
- self.single_cube.coord('source')._TEST_COMPAT_override_axis = 'source'
- self.single_cube.coord('source')._TEST_COMPAT_definitive = False
- self.single_cube.coord('model_level_number')._TEST_COMPAT_force_explicit = True
- self.single_cube.coord('model_level_number')._TEST_COMPAT_override_axis = 'z'
- self.single_cube.coord('level_height')._TEST_COMPAT_override_axis = 'z'
- self.single_cube.coord('sigma')._TEST_COMPAT_override_axis = 'z'
- self.single_cube.coord('time')._TEST_COMPAT_points = False
-
def test_simple(self):
constraint = iris.Constraint(latitude=10)
cube = self.single_cube.extract(constraint)
- cube.coord('latitude')._TEST_COMPAT_force_regular_scalar = True
self.assertCML(cube, ('cdm', 'extract', 'lat_eq_10.cml'))
constraint = iris.Constraint(latitude=lambda c: c > 10)
self.assertCML(self.single_cube.extract(constraint), ('cdm', 'extract', 'lat_gt_10.cml'))
@@ -802,25 +785,13 @@ def test_cube_empty_indexing(self):
numpy.testing.assert_array_equal(r_data, c.data)
def test_real_data_cube_indexing(self):
- self.cube.coord('source')._TEST_COMPAT_force_explicit = True
- self.cube.coord('source')._TEST_COMPAT_override_axis = 'source'
- self.cube.coord('source')._TEST_COMPAT_definitive = False
-
cube = self.cube[(0, 4, 5, 2), 0, 0]
- cube.coord('forecast_period')._TEST_COMPAT_override_axis = 'forecast_period'
- cube.coord('grid_longitude')._TEST_COMPAT_force_regular_scalar = True
- cube.coord('grid_latitude')._TEST_COMPAT_force_regular_scalar = True
self.assertCML(cube, ('cube_slice', 'real_data_dual_tuple_indexing1.cml'))
cube = self.cube[0, (0, 4, 5, 2), (3, 5, 5)]
- cube.coord('forecast_period')._TEST_COMPAT_override_axis = 'forecast_period'
- cube.coord('grid_longitude')._TEST_COMPAT_definitive = True
self.assertCML(cube, ('cube_slice', 'real_data_dual_tuple_indexing2.cml'))
cube = self.cube[(0, 4, 5, 2), 0, (3, 5, 5)]
- cube.coord('forecast_period')._TEST_COMPAT_override_axis = 'forecast_period'
- cube.coord('grid_longitude')._TEST_COMPAT_definitive = True
- cube.coord('grid_latitude')._TEST_COMPAT_force_regular_scalar = True
self.assertCML(cube, ('cube_slice', 'real_data_dual_tuple_indexing3.cml'))
self.assertRaises(IndexError, self.cube.__getitem__, ((0, 4, 5, 2), (3, 5, 5), 0, 0, 4) )
@@ -856,15 +827,6 @@ def collapse_test_common(self, cube, a_name, b_name, *args, **kwargs):
@iris.tests.skip_data
def test_multi_d(self):
cube = iris.load(tests.get_data_path(('PP', 'COLPEX', 'theta_and_orog_subset.pp')))[0]
- cube.coord('forecast_period')._TEST_COMPAT_override_axis = 'forecast_period'
- cube.coord('time')._TEST_COMPAT_force_explicit = True
- cube.coord('grid_latitude')._TEST_COMPAT_force_explicit = True
- cube.coord('source')._TEST_COMPAT_override_axis = 'source'
- cube.coord('source')._TEST_COMPAT_definitive = False
- cube.coord('model_level_number')._TEST_COMPAT_force_explicit = True
- cube.coord('model_level_number')._TEST_COMPAT_override_axis = 'z'
- cube.coord('level_height')._TEST_COMPAT_override_axis = 'z'
- cube.coord('sigma')._TEST_COMPAT_override_axis = 'z'
# TODO: Re-instate surface_altitude & hybrid-height once we're
# using the post-CF test results.
@@ -946,12 +908,6 @@ def test_masked_field(self):
def test_missing_file(self):
cube = self._load_3d_cube()
self.assertTrue(isinstance(cube.data, numpy.ma.core.MaskedArray), "Expected a numpy.ma.core.MaskedArray")
- cube.coord('forecast_period')._TEST_COMPAT_override_axis = 'forecast_period'
- cube.coord('source')._TEST_COMPAT_override_axis = 'source'
- cube.coord('forecast_period')._TEST_COMPAT_definitive = True
- cube.coord('pressure')._TEST_COMPAT_definitive = True
- cube.coord('time')._TEST_COMPAT_definitive = True
- cube.coord('source')._TEST_COMPAT_definitive = False
self.assertCML(cube, ('cdm', 'masked_cube.cml'))
def test_slicing(self):
diff --git a/lib/iris_tests/test_constraints.py b/lib/iris_tests/test_constraints.py
index 5690ec76de..715141ecfc 100644
--- a/lib/iris_tests/test_constraints.py
+++ b/lib/iris_tests/test_constraints.py
@@ -29,19 +29,6 @@
SN_SPECIFIC_HUMIDITY = 'specific_humidity'
-def old_style_coords(cube):
- cube.coord("forecast_period")._TEST_COMPAT_override_axis = "forecast_period"
- cube.coord("forecast_period")._TEST_COMPAT_definitive = True
- cube.coord("forecast_reference_time")._TEST_COMPAT_override_axis = "rt"
- cube.coord("source")._TEST_COMPAT_override_axis = "source"
- cube.coord("source")._TEST_COMPAT_definitive = False
- cube.coord("model_level_number")._TEST_COMPAT_force_explicit = True
- cube.coord("model_level_number")._TEST_COMPAT_override_axis = "z"
- cube.coord("sigma")._TEST_COMPAT_override_axis = "z"
- cube.coord("sigma")._TEST_COMPAT_force_explicit = True
- cube.coord("sigma")._TEST_COMPAT_definitive = False
- cube.coord("level_height")._TEST_COMPAT_force_explicit = True
-
# TODO: Workaround, pending #1262
def workaround_pending_1262(cubes):
"""Reverse the cube if sigma was chosen as a dim_coord."""
@@ -235,8 +222,6 @@ def load_match(self, files, constraints):
cubes = iris.load(files, constraints)
if not isinstance(cubes, iris.cube.CubeList):
raise Exception("NOT A CUBE LIST! " + str(type(cubes)))
- for cube in cubes:
- old_style_coords(cube)
return cubes
@@ -248,8 +233,6 @@ def load_match(self, files, constraints):
cubes = iris.load(files).extract(constraints)
if not isinstance(cubes, iris.cube.CubeList):
raise Exception("NOT A CUBE LIST! " + str(type(cubes)))
- for cube in cubes:
- old_style_coords(cube)
return cubes
@@ -259,11 +242,6 @@ class TestCubeLoadStrictConstraint(StrictConstraintMixin, tests.IrisTest):
def load_match(self, files, constraints):
cubes = iris.load_strict(files, constraints)
- if isinstance(cubes, iris.cube.Cube):
- old_style_coords(cubes)
- else:
- for cube in cubes:
- old_style_coords(cube)
return cubes
@@ -273,11 +251,6 @@ class TestCubeListStrictConstraint(StrictConstraintMixin, tests.IrisTest):
def load_match(self, files, constraints):
cubes = iris.load(files).extract_strict(constraints)
- if isinstance(cubes, iris.cube.Cube):
- old_style_coords(cubes)
- else:
- for cube in cubes:
- old_style_coords(cube)
return cubes
@@ -286,7 +259,6 @@ class TestCubeExtract(TestMixin, tests.IrisTest):
def setUp(self):
TestMixin.setUp(self)
self.cube = iris.load_strict(self.theta_path)
- old_style_coords(self.cube)
def test_attribute_constraint(self):
# there is no my_attribute attribute on the cube, so ensure it returns None
diff --git a/lib/iris_tests/test_coord_api.py b/lib/iris_tests/test_coord_api.py
index e6b969cfa8..bf488cfe21 100644
--- a/lib/iris_tests/test_coord_api.py
+++ b/lib/iris_tests/test_coord_api.py
@@ -96,16 +96,12 @@ def setUp(self):
[ 24.75, 27.75],
[ 27.75, 30.75]], dtype=numpy.float32)
self.b = iris.coords.AuxCoord(pts, long_name='foo', units='meter', bounds=bnds)
- self.b._TEST_COMPAT_override_axis = 'foobar'
- self.b._TEST_COMPAT_force_explicit = True
def test_basic_intersection(self):
inds = self.a.intersect(self.b, return_indices=True)
self.assertEqual((0, 1, 2, 3, 4, 5, 6, 7), tuple(inds))
c = self.a.intersect(self.b)
- c._TEST_COMPAT_force_explicit = True
- c._TEST_COMPAT_override_axis = 'foobar'
self.assertXMLElement(c, ('coord_api', 'intersection.xml'))
def test_intersection_reverse(self):
@@ -113,8 +109,6 @@ def test_intersection_reverse(self):
self.assertEqual((7, 6, 5, 4, 3, 2, 1, 0), tuple(inds))
c = self.a.intersect(self.b[::-1])
- c._TEST_COMPAT_force_explicit = True
- c._TEST_COMPAT_override_axis = 'foobar'
self.assertXMLElement(c, ('coord_api', 'intersection_reversed.xml'))
def test_no_intersection_on_points(self):
@@ -125,7 +119,6 @@ def test_no_intersection_on_points(self):
def test_intersection_one_fewer_upper_bound_than_lower(self):
self.b.bounds[4, 1] = self.b.bounds[0, 1]
c = self.a.intersect(self.b)
- c._TEST_COMPAT_override_axis = 'foobar'
self.assertXMLElement(c, ('coord_api', 'intersection_missing.xml'))
def test_no_intersection_on_bounds(self):
@@ -157,32 +150,19 @@ def test_commutative(self):
class TestCoordXML(unittest.TestCase):
def test_aux_xml(self):
doc = Document()
-
-
coord = iris.coords.AuxCoord(numpy.arange(10, dtype=numpy.int32), long_name='test', units='meter')
- coord._TEST_COMPAT_override_axis = 'test'
- coord._TEST_COMPAT_force_explicit = True
-
coord_xml_element = coord.xml_element(doc)
-
doc.appendChild(coord_xml_element)
-
r = '\n\n'
t = doc.toprettyxml(indent=" ")
self.assertEqual(r, t)
def test_dim_xml(self):
doc = Document()
-
coord = iris.coords.DimCoord(numpy.arange(4, dtype=numpy.float32) * 2, long_name='test', units='meter')
coord.guess_bounds(0.5)
- coord._TEST_COMPAT_override_axis = 'test'
- coord._TEST_COMPAT_definitive = False
-
coord_xml_element = coord.xml_element(doc)
-
doc.appendChild(coord_xml_element)
-
r = '\n\n'
t = doc.toprettyxml(indent=" ")
self.assertEqual(r, t)
@@ -452,27 +432,12 @@ def _build_coord(self, start=None, step=None, count=None):
self.lon = iris.coords.AuxCoord(points, 'latitude', units='degrees', bounds=bounds)
self.rlon = iris.coords.AuxCoord(numpy.deg2rad(points), 'latitude', units='radians', bounds=numpy.deg2rad(bounds))
- # compatibility attributes
- self.lon._TEST_COMPAT_override_axis = 'X'
- self.rlon._TEST_COMPAT_override_axis = 'X'
- self.lon._TEST_COMPAT_force_explicit = True
- self.rlon._TEST_COMPAT_force_explicit = True
- self.lon._TEST_COMPAT_value_type = 'float32'
- self.rlon._TEST_COMPAT_value_type = 'float32'
-
def setUp(self):
self.start = 0
self.step = 2.3
self.count = 20
self._build_coord()
- def assertXMLElement(self, coord, reference_filename):
- coord._TEST_COMPAT_force_explicit = True
- coord.points = coord.points.astype(numpy.float32)
- if coord.bounds is not None:
- coord.bounds = coord.bounds.astype(numpy.float32)
- tests.IrisTest.assertXMLElement(self, coord, reference_filename)
-
class TestCoordTrig(TestCoordMaths):
def test_sin(self):
@@ -508,10 +473,7 @@ def test_cos(self):
cos_of_coord_radians._points = numpy.array([1], dtype=numpy.float32)
cos_of_coord_radians._bounds = None
- cos_of_coord._TEST_COMPAT_override_axis = 'x'
self.assertXMLElement(cos_of_coord, ('coord_api', 'coord_maths', 'cos_simple.xml'))
-
- cos_of_coord_radians._TEST_COMPAT_override_axis = 'x'
self.assertXMLElement(cos_of_coord_radians, ('coord_api', 'coord_maths', 'cos_simple_radians.xml'))
@@ -586,9 +548,7 @@ def test_multiply_float(self):
class TestCoordCollapsed(tests.IrisTest):
def create_1d_coord(self, bounds=None, points=None, units='meter'):
coord = iris.coords.DimCoord(points, long_name='test', units=units,
- bounds=bounds
- )
- coord._TEST_COMPAT_definitive = True
+ bounds=bounds)
return coord
def test_explicit(self):
diff --git a/lib/iris_tests/test_coord_categorisation.py b/lib/iris_tests/test_coord_categorisation.py
index 5fb2bb49f9..99ed5e764a 100644
--- a/lib/iris_tests/test_coord_categorisation.py
+++ b/lib/iris_tests/test_coord_categorisation.py
@@ -71,11 +71,6 @@ def _month_in_quarter(coord, pt_value):
for coord_name in ['month_number', 'month_in_quarter', 'weekday_number', 'season_number', 'year_ofseason', 'year', 'day']:
cube.coord(coord_name).points = cube.coord(coord_name).points.astype(np.int64)
- # XXX Fake the axes for the CML
- for coord in cube.coords():
- coord._TEST_COMPAT_override_axis = 't'
- cube.coord('time')._TEST_COMPAT_force_explicit = True
-
#check values
self.assertCML(cube, ('categorisation', 'quickcheck.cml'))
diff --git a/lib/iris_tests/test_ff.py b/lib/iris_tests/test_ff.py
index 7f7c8f5782..f1b9ccf9e4 100644
--- a/lib/iris_tests/test_ff.py
+++ b/lib/iris_tests/test_ff.py
@@ -128,29 +128,6 @@ class TestFF2PP2Cube(tests.IrisTest):
def setUp(self):
self.filename = tests.get_data_path(('ssps', 'qtgl.ssps_006'))
- def assertCML(self, cube, path, *args, **kwargs):
- try:
- coord = cube.coord('forecast_period')
- coord._TEST_COMPAT_force_explicit = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('time')
- coord._TEST_COMPAT_force_explicit = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('model_level_number')
- coord._TEST_COMPAT_force_explicit = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('height')
- coord._TEST_COMPAT_override_axis = 'z'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- super(TestFF2PP2Cube, self).assertCML(cube, path, *args, **kwargs)
-
def test_unit_pass_0(self):
"""Test FieldsFile to PPFields cube load."""
# Adding the surface_altitude to all 4000(?) fields causes a
diff --git a/lib/iris_tests/test_file_load.py b/lib/iris_tests/test_file_load.py
index 8c16341de0..d27523311d 100644
--- a/lib/iris_tests/test_file_load.py
+++ b/lib/iris_tests/test_file_load.py
@@ -26,44 +26,6 @@
@iris.tests.skip_data
class TestFileload_strict(tests.IrisTest):
- def assertCML(self, cube, path, *args, **kwargs):
- if isinstance(cube, iris.cube.Cube):
- cubes = [cube]
- else:
- cubes = cube
- for cube in cubes:
- try:
- coord = cube.coord('forecast_reference_time')
- coord._TEST_COMPAT_override_axis = 'rt'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('sigma')
- coord._TEST_COMPAT_override_axis = 'z'
- coord._TEST_COMPAT_definitive = False
- coord._TEST_COMPAT_hybrid = 'None'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('model_level_number')
- coord.rename('model_level')
- coord._TEST_COMPAT_force_explicit = True
- coord._TEST_COMPAT_override_axis = 'z'
- coord._TEST_COMPAT_hybrid = 'None'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('level_height')
- coord._TEST_COMPAT_hybrid = 'None'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('time')
- coord._TEST_COMPAT_points = False
- except iris.exceptions.CoordinateNotFoundError:
- pass
- super(TestFileload_strict, self).assertCML(cubes, path, *args, **kwargs)
-
def _test_file(self, src_path, reference_filename):
"""
Checks the result of loading the given file spec, or creates the
@@ -72,7 +34,6 @@ def _test_file(self, src_path, reference_filename):
NB. The direct use of :func:`iris._load_common` bypasses the cube merge process.
"""
-
cubes = iris._load_common(tests.get_data_path(src_path), constraints=None, strict=False, unique=True, merge=False)
self.assertCML(cubes, ['file_load', reference_filename])
diff --git a/lib/iris_tests/test_grib_load.py b/lib/iris_tests/test_grib_load.py
index d1ad071fc4..a8397a2e5f 100644
--- a/lib/iris_tests/test_grib_load.py
+++ b/lib/iris_tests/test_grib_load.py
@@ -37,52 +37,17 @@ class TestGribLoad(tests.GraphicsTest):
def test_load(self):
cubes = iris.load(tests.get_data_path(('GRIB', 'rotated_uk', "uk_wrongparam.grib1")))
- cubes[0].coord("forecast_period")._TEST_COMPAT_override_axis = "forecast_period"
- cubes[0].coord("forecast_period")._TEST_COMPAT_definitive = True
- cubes[0].coord("originating_centre")._TEST_COMPAT_override_axis = "originating_centre"
- cubes[0].coord("originating_centre")._TEST_COMPAT_definitive = False
- cubes[0].coord("pressure")._TEST_COMPAT_definitive = False
self.assertCML(cubes, ("grib_load", "rotated.cml"))
cubes = iris.load(tests.get_data_path(('GRIB', "time_processed", "time_bound.grib2")))
- cubes[0].coord("forecast_period")._TEST_COMPAT_override_axis = "forecast_period"
- cubes[0].coord("forecast_period")._TEST_COMPAT_definitive = False
- cubes[0].coord("originating_centre")._TEST_COMPAT_override_axis = "originating_centre"
- cubes[0].coord("originating_centre")._TEST_COMPAT_definitive = False
- cubes[0].coord("pressure")._TEST_COMPAT_definitive = False
- cubes[0].coord("time")._TEST_COMPAT_definitive = False
self.assertCML(cubes, ("grib_load", "time_bound.cml"))
cubes = iris.load(tests.get_data_path(('GRIB', "3_layer_viz", "3_layer.grib2")))
cubes = iris.cube.CubeList([cubes[1], cubes[0], cubes[2]])
- cubes[0].coord("forecast_period")._TEST_COMPAT_override_axis = "forecast_period"
- cubes[0].coord("forecast_period")._TEST_COMPAT_definitive = False
- cubes[0].coord("originating_centre")._TEST_COMPAT_override_axis = "originating_centre"
- cubes[0].coord("originating_centre")._TEST_COMPAT_definitive = False
- cubes[0].coord("pressure")._TEST_COMPAT_definitive = False
- cubes[0].coord("time")._TEST_COMPAT_definitive = False
- cubes[1].coord("forecast_period")._TEST_COMPAT_override_axis = "forecast_period"
- cubes[1].coord("forecast_period")._TEST_COMPAT_definitive = False
- cubes[1].coord("originating_centre")._TEST_COMPAT_override_axis = "originating_centre"
- cubes[1].coord("originating_centre")._TEST_COMPAT_definitive = False
- cubes[1].coord("pressure")._TEST_COMPAT_definitive = False
- cubes[1].coord("time")._TEST_COMPAT_definitive = False
- cubes[2].coord("forecast_period")._TEST_COMPAT_override_axis = "forecast_period"
- cubes[2].coord("forecast_period")._TEST_COMPAT_definitive = False
- cubes[2].coord("originating_centre")._TEST_COMPAT_override_axis = "originating_centre"
- cubes[2].coord("originating_centre")._TEST_COMPAT_definitive = False
- cubes[2].coord("pressure")._TEST_COMPAT_definitive = False
- cubes[2].coord("time")._TEST_COMPAT_definitive = False
self.assertCML(cubes, ("grib_load", "3_layer.cml"))
def test_y_fastest(self):
cubes = iris.load(tests.get_data_path(("GRIB", "y_fastest", "y_fast.grib2")))
- cubes[0].coord("forecast_period")._TEST_COMPAT_override_axis = "forecast_period"
- cubes[0].coord("forecast_period")._TEST_COMPAT_definitive = False
- cubes[0].coord("originating_centre")._TEST_COMPAT_override_axis = "originating_centre"
- cubes[0].coord("originating_centre")._TEST_COMPAT_definitive = False
- cubes[0].coord("pressure")._TEST_COMPAT_definitive = False
- cubes[0].coord("time")._TEST_COMPAT_definitive = False
self.assertCML(cubes, ("grib_load", "y_fastest.cml"))
iplt.contourf(cubes[0])
iplt.gcm(cubes[0]).drawcoastlines()
@@ -93,12 +58,6 @@ def test_ij_directions(self):
def old_compat_load(name):
cube = iris.load(tests.get_data_path(('GRIB', 'ij_directions', name)))[0]
- cube.coord("forecast_period")._TEST_COMPAT_override_axis = "forecast_period"
- cube.coord("forecast_period")._TEST_COMPAT_definitive = False
- cube.coord("originating_centre")._TEST_COMPAT_override_axis = "originating_centre"
- cube.coord("originating_centre")._TEST_COMPAT_definitive = False
- cube.coord("pressure")._TEST_COMPAT_definitive = False
- cube.coord("time")._TEST_COMPAT_definitive = False
return [cube]
cubes = old_compat_load("ipos_jpos.grib2")
@@ -133,12 +92,6 @@ def test_shape_of_earth(self):
def old_compat_load(name):
cube = iris.load(tests.get_data_path(('GRIB', 'shape_of_earth', name)))[0]
- cube.coord("forecast_period")._TEST_COMPAT_override_axis = "forecast_period"
- cube.coord("forecast_period")._TEST_COMPAT_definitive = False
- cube.coord("originating_centre")._TEST_COMPAT_override_axis = "originating_centre"
- cube.coord("originating_centre")._TEST_COMPAT_definitive = False
- cube.coord("pressure")._TEST_COMPAT_definitive = False
- cube.coord("time")._TEST_COMPAT_definitive = False
return cube
#pre-defined sphere
@@ -175,8 +128,6 @@ def old_compat_load(name):
#grib1 - same as grib2 shape 6, above
cube = old_compat_load("global.grib1")
- cube.coord("forecast_period")._TEST_COMPAT_definitive = True
- cube.coord("time")._TEST_COMPAT_definitive = True
self.assertCML(cube, ("grib_load", "earth_shape_grib1.cml"))
def test_custom_rules(self):
diff --git a/lib/iris_tests/test_interpolation.py b/lib/iris_tests/test_interpolation.py
index 056d46de8c..6793a61999 100644
--- a/lib/iris_tests/test_interpolation.py
+++ b/lib/iris_tests/test_interpolation.py
@@ -63,48 +63,6 @@ def setUp(self):
c4.add_dim_coord(g, 1)
self.simple2d_cube_circular = c4
- def assertCML(self, cube, path, *args, **kwargs):
- try:
- coord = cube.coord('shared_x_coord')
- coord._TEST_COMPAT_force_explicit = True
- coord._TEST_COMPAT_definitive = False
- coord._TEST_COMPAT_override_axis = 'x'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('an_other')
- coord._TEST_COMPAT_definitive = False
- coord._TEST_COMPAT_override_axis = 't'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('dim1')
- coord._TEST_COMPAT_override_axis = 'y'
- if isinstance(coord, iris.coords.AuxCoord):
- coord._TEST_COMPAT_force_explicit = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('dim2')
- coord._TEST_COMPAT_override_axis = 'x'
- coord._TEST_COMPAT_definitive = False
- coord._TEST_COMPAT_force_explicit = coord.shape == (2,)
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('r')
- coord._TEST_COMPAT_override_axis = 'r'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('theta')
- coord._TEST_COMPAT_force_explicit = True
- coord._TEST_COMPAT_definitive = False
- coord._TEST_COMPAT_override_axis = 'theta'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- super(TestLinear1dInterpolation, self).assertCML(cube, path, *args, **kwargs)
-
def test_integer_interpol(self):
c = self.simple2d_cube
c.data = c.data.astype(numpy.int16)
@@ -230,25 +188,6 @@ def setUp(self):
file = tests.get_data_path(('PP', 'globClim1', 'theta.pp'))
self.cube = iris.load_strict(file)
- def assertCML(self, cube, path, *args, **kwargs):
- try:
- coord = cube.coord('forecast_reference_time')
- coord._TEST_COMPAT_override_axis = 'rt'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('model_level_number')
- coord._TEST_COMPAT_force_explicit = True
- coord._TEST_COMPAT_override_axis = 'z'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('sigma')
- coord._TEST_COMPAT_override_axis = 'z'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- super(TestNearestLinearInterpolRealData, self).assertCML(cube, path, *args, **kwargs)
-
def test_slice(self):
r = iris.analysis.interpolate.linear(self.cube, [('latitude', 0)])
self.assertCML(r, ('analysis', 'interpolation', 'linear', 'real_2dslice.cml'))
@@ -275,26 +214,6 @@ def setUp(self):
coord_to_add = iris.coords.DimCoord(points, long_name='i', units='meters')
self.cube.add_aux_coord(coord_to_add, 0)
- def assertCML(self, cube, path, *args, **kwargs):
- try:
- coord = cube.coord('i')
- coord._TEST_COMPAT_override_axis = 'y'
- coord._TEST_COMPAT_value_type = 'float32'
- coord._TEST_COMPAT_force_regular_scalar = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('latitude')
- coord._TEST_COMPAT_force_regular_scalar = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('longitude')
- coord._TEST_COMPAT_force_regular_scalar = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
- super(TestNearestNeighbour, self).assertCML(cube, path, *args, **kwargs)
-
def test_nearest_neighbour(self):
point_spec = [('latitude', 40), ('longitude', 39)]
diff --git a/lib/iris_tests/test_intersect.py b/lib/iris_tests/test_intersect.py
index 0cd869c538..a912cafb4f 100644
--- a/lib/iris_tests/test_intersect.py
+++ b/lib/iris_tests/test_intersect.py
@@ -43,11 +43,6 @@ def test_simple_intersect(self):
cube.add_dim_coord(iris.coords.DimCoord(numpy.arange(5, dtype=numpy.float32) * 90 - 180, 'longitude', units='degrees', coord_system=lonlat_cs), 1)
cube.add_dim_coord(iris.coords.DimCoord(numpy.arange(5, dtype=numpy.float32) * 45 - 90, 'latitude', units='degrees', coord_system=lonlat_cs), 0)
cube.add_aux_coord(iris.coords.DimCoord(points=numpy.int32(11), long_name='pressure', units='Pa'))
-
- cube.coord("longitude")._TEST_COMPAT_definitive = True
- cube.coord("longitude")._TEST_COMPAT_force_explicit = True
- cube.coord("pressure")._TEST_COMPAT_definitive = False
-
cube.rename("temperature")
cube.units = "K"
@@ -62,11 +57,6 @@ def test_simple_intersect(self):
cube2.add_dim_coord(iris.coords.DimCoord(numpy.arange(5, dtype=numpy.float32) * 90, 'longitude', units='degrees', coord_system=lonlat_cs), 1)
cube2.add_dim_coord(iris.coords.DimCoord(numpy.arange(5, dtype=numpy.float32) * 45 - 90, 'latitude', units='degrees', coord_system=lonlat_cs), 0)
cube2.add_aux_coord(iris.coords.DimCoord(points=numpy.int32(11), long_name='pressure', units='Pa'))
-
- cube2.coord("longitude")._TEST_COMPAT_definitive = True
- cube2.coord("longitude")._TEST_COMPAT_force_explicit = True
- cube2.coord("pressure")._TEST_COMPAT_definitive = False
-
cube2.rename("")
r = iris.analysis.maths.intersection_of_cubes(cube, cube2)
diff --git a/lib/iris_tests/test_merge.py b/lib/iris_tests/test_merge.py
index 97b6673aa1..f2c95a79ca 100644
--- a/lib/iris_tests/test_merge.py
+++ b/lib/iris_tests/test_merge.py
@@ -43,14 +43,6 @@ def test_normal_cubes(self):
self.assertEqual(len(cubes), self._num_cubes)
names = ['forecast_period', 'forecast_reference_time', 'level_height', 'model_level_number', 'sigma', 'source']
axes = ['forecast_period', 'rt', 'z', 'z', 'z', 'source']
- for cube in cubes:
- for name, axis in zip(names, axes):
- cube.coord(name)._TEST_COMPAT_override_axis = axis
-
- cube.coord('model_level_number')._TEST_COMPAT_force_explicit = True
- cube.coord('source')._TEST_COMPAT_definitive = False
- cube.coord('time')._TEST_COMPAT_points = False
-
self.assertCML(cubes, ['merge', self._prefix + '.cml'])
def test_remerge(self):
@@ -107,21 +99,6 @@ def setUp(self):
def test_colpex(self):
cubes = iris.load(self._data_path)
self.assertEqual(len(cubes), 2)
- names = ['forecast_period', 'level_height', 'model_level_number', 'sigma', 'source', 'time']
- axes = ['forecast_period', 'z', 'z', 'z', 'source', 't']
- for name, axis in zip(names, axes):
- cubes[0].coord(name)._TEST_COMPAT_force_explicit = True
- cubes[0].coord(name)._TEST_COMPAT_override_axis = axis
- cubes[0].coord('source')._TEST_COMPAT_definitive = False
- cubes[0].coord('surface_altitude')._TEST_COMPAT_points = False
-
- names = ['forecast_period', 'source', 'time']
- axes = ['forecast_period', 'source', 't']
- for name, axis in zip(names, axes):
- cubes[1].coord(name)._TEST_COMPAT_force_explicit = True
- cubes[1].coord(name)._TEST_COMPAT_override_axis = axis
- cubes[1].coord('source')._TEST_COMPAT_definitive = False
-
self.assertCML(cubes, ('COLPEX', 'uwind_and_orog.cml'))
@@ -139,12 +116,6 @@ def test_extended_proxy_data(self):
# Merge the two halves
cubes = iris.cube.CubeList([cube1, cube2]).merge(True)
- names = ['forecast_period', 'model_level_number', 'sigma', 'time']
- axes = ['forecast_period', 'z', 'z', 't']
- for cube in cubes:
- for name, axis in zip(names, axes):
- cube.coord(name)._TEST_COMPAT_force_explicit = True
- cube.coord(name)._TEST_COMPAT_override_axis = axis
self.assertCML(cubes, ('merge', 'theta_two_forecast_periods.cml'))
# Make sure we get the same result directly from load
@@ -158,14 +129,6 @@ def test_real_data(self):
for cube in cubes:
data = cube.data
cubes = cubes.merge()
- names = ['forecast_period', 'forecast_reference_time', 'level_height', 'model_level_number', 'sigma', 'source']
- axes = ['forecast_period', 'rt', 'z', 'z', 'z', 'source']
- for cube in cubes:
- for name, axis in zip(names, axes):
- cube.coord(name)._TEST_COMPAT_override_axis = axis
- cube.coord('model_level_number')._TEST_COMPAT_force_explicit = True
- cube.coord('source')._TEST_COMPAT_definitive = False
- cube.coord('time')._TEST_COMPAT_points = False
self.assertCML(cubes, ['merge', 'theta.cml'])
@@ -191,12 +154,6 @@ def test_single_split(self):
cubes.append(self._make_cube(2, 0, 4, 4))
cubes.append(self._make_cube(2, 1, 5, 5))
cube = iris.cube.CubeList(cubes).merge()
-
- for name in 'abcxy':
- cube[0].coord(name)._TEST_COMPAT_force_explicit = True
- cube[0].coord(name)._TEST_COMPAT_override_axis = name
- cube[0].coord(name)._TEST_COMPAT_definitive = False
-
self.assertCML(cube, ('merge', 'single_split.cml'))
def test_multi_split(self):
@@ -215,12 +172,6 @@ def test_multi_split(self):
cubes.append(self._make_cube(2, 1, 0, 10))
cubes.append(self._make_cube(2, 1, 1, 11))
cube = iris.cube.CubeList(cubes).merge()
-
- for name in 'abcxy':
- cube[0].coord(name)._TEST_COMPAT_force_explicit = True
- cube[0].coord(name)._TEST_COMPAT_override_axis = name
- cube[0].coord(name)._TEST_COMPAT_definitive = False
-
self.assertCML(cube, ('merge', 'multi_split.cml'))
@@ -236,18 +187,9 @@ def _make_cube(self, a, b, c, data=0):
cube.add_aux_coord(DimCoord(numpy.array([c], dtype=numpy.int32), standard_name='time', units='1'))
return cube
- def _test_compat(self, cube):
- names = ['forecast_period', 'forecast_reference_time', 'time', 'x', 'y']
- axes = ['forecast_period', 'rt', 't', 'x', 'y']
- for name, axis in zip(names, axes):
- cube.coord(name)._TEST_COMPAT_force_explicit = True
- cube.coord(name)._TEST_COMPAT_override_axis = axis
- cube.coord(name)._TEST_COMPAT_definitive = False
-
def _test_triples(self, triples, filename):
cubes = [self._make_cube(fp, rt, t) for fp, rt, t in triples]
cube = iris.cube.CubeList(cubes).merge()
- self._test_compat(cube[0])
self.assertCML(cube, ('merge', 'time_triple_' + filename + '.cml'), checksum=False)
def test_single_forecast(self):
@@ -325,8 +267,6 @@ def test_duplicate_data(self):
iris.cube.CubeList([cube1, cube2, cube3]).merge()
cubes = iris.cube.CubeList([cube1, cube2, cube3]).merge(unique=False)
- for cube in cubes:
- self._test_compat(cube)
self.assertCML(cubes, ('merge', 'time_triple_duplicate_data.cml'), checksum=False)
def test_simple1(self):
@@ -334,7 +274,6 @@ def test_simple1(self):
cube2 = self._make_cube(1, 20, 1)
cube3 = self._make_cube(2, 20, 0)
cube = iris.cube.CubeList([cube1, cube2, cube3]).merge()
- self._test_compat(cube[0])
self.assertCML(cube, ('merge', 'time_triple_merging1.cml'), checksum=False)
def test_simple2(self):
@@ -347,12 +286,10 @@ def test_simple2(self):
self._make_cube(2, 1, 5),
])
cube = cubes.merge()[0]
- self._test_compat(cube)
self.assertCML(cube, ('merge', 'time_triple_merging2.cml'), checksum=False)
self.assertIsNone(cube.assert_valid())
cube = iris.cube.CubeList(cubes[:-1]).merge()[0]
- self._test_compat(cube)
self.assertCML(cube, ('merge', 'time_triple_merging3.cml'), checksum=False)
self.assertIsNone(cube.assert_valid())
@@ -366,12 +303,10 @@ def test_simple3(self):
self._make_cube(1, 2, 5),
])
cube = cubes.merge()[0]
- self._test_compat(cube)
self.assertCML(cube, ('merge', 'time_triple_merging4.cml'), checksum=False)
self.assertIsNone(cube.assert_valid())
cube = iris.cube.CubeList(cubes[:-1]).merge()[0]
- self._test_compat(cube)
self.assertCML(cube, ('merge', 'time_triple_merging5.cml'), checksum=False)
self.assertIsNone(cube.assert_valid())
@@ -385,7 +320,6 @@ def test_simple_bounds_merge(self):
cube2.add_aux_coord(DimCoord(numpy.int32(11), long_name='pressure', units='Pa'))
r = iris.cube.CubeList([cube1, cube2]).merge()
- r[0].coord('pressure')._TEST_COMPAT_force_explicit = True
self.assertCML(r, ('cube_merge', 'test_simple_bound_merge.cml'))
def test_simple_multidim_merge(self):
@@ -396,14 +330,12 @@ def test_simple_multidim_merge(self):
cube2.add_aux_coord(DimCoord(numpy.int32(11), long_name='pressure', units='Pa'))
r = iris.cube.CubeList([cube1, cube2]).merge()[0]
- r.coord('pressure')._TEST_COMPAT_force_explicit = True
self.assertCML(r, ('cube_merge', 'multidim_coord_merge.cml'))
# try transposing the cubes first
cube1.transpose([1, 0])
cube2.transpose([1, 0])
r = iris.cube.CubeList([cube1, cube2]).merge()[0]
- r.coord('pressure')._TEST_COMPAT_force_explicit = True
self.assertCML(r, ('cube_merge', 'multidim_coord_merge_transpose.cml'))
def test_simple_points_merge(self):
@@ -414,7 +346,6 @@ def test_simple_points_merge(self):
cube2.add_aux_coord(DimCoord(numpy.int32(11), long_name='pressure', units='Pa'))
r = iris.cube.CubeList([cube1, cube2]).merge()
- r[0].coord('pressure')._TEST_COMPAT_force_explicit = True
self.assertCML(r, ('cube_merge', 'test_simple_merge.cml'))
# check that the unique merging raises a Duplicate data error
@@ -439,7 +370,6 @@ def test_simple_points_merge(self):
cube2.attributes['my_attr1'] = 'foo'
r = iris.cube.CubeList([cube1, cube2]).merge()
# result should be 1 cube
- r[0].coord('pressure')._TEST_COMPAT_force_explicit = True
self.assertCML(r, ('cube_merge', 'test_simple_attributes3.cml'))
diff --git a/lib/iris_tests/test_netcdf.py b/lib/iris_tests/test_netcdf.py
index 6890a5b409..a8cfa653d3 100644
--- a/lib/iris_tests/test_netcdf.py
+++ b/lib/iris_tests/test_netcdf.py
@@ -35,73 +35,19 @@
@iris.tests.skip_data
class TestNetCDFLoad(tests.IrisTest):
- def setUp(self):
- pass
-
- def apply_TEST_COMPAT_attributes(self, cube):
- def apply_TEST_COMPAT_coord_attributes(coord):
- try:
- cube.coord(coord)._TEST_COMPAT_force_explicit = True
- cube.coord(coord)._TEST_COMPAT_definitive = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
-
- coords = ['time', 'longitude', 'longitude', 'latitude', 'levelist', 'grid_longitude', 'grid_latitude', 'model_level_number']
- for coord in coords:
- apply_TEST_COMPAT_coord_attributes(coord)
- # Special cases
- try:
- cube.coord('source')._TEST_COMPAT_override_axis = 'source'
- cube.coord('source')._TEST_COMPAT_definitive = False
- except iris.exceptions.CoordinateNotFoundError:
- pass
-
- try:
- cube.coord('levelist')._TEST_COMPAT_override_axis = 'levelist'
- #cube.coord('levelist')._TEST_COMPAT_definitive = False
- except iris.exceptions.CoordinateNotFoundError:
- pass
-
- try:
- cube.coord('model_level_number')._TEST_COMPAT_override_axis = 'model_level_number'
- except iris.exceptions.CoordinateNotFoundError:
- pass
-
- if cube.coords('grid_longitude'):
- try:
- cube.coord('latitude')._TEST_COMPAT_override_axis = 'lat'
- cube.coord('latitude')._TEST_COMPAT_definitive = False
- cube.coord('longitude')._TEST_COMPAT_override_axis = 'lon'
- cube.coord('longitude')._TEST_COMPAT_definitive = False
- except iris.exceptions.CoordinateNotFoundError:
- pass
-
- if cube.coords('height'):
- try:
- cube.coord('height')._TEST_COMPAT_override_axis = 'z'
- except iris.exceptions.CoordinateNotFoundError:
- pass
-
-
-
-
def test_load_global_xyt_total(self):
# Test loading single xyt CF-netCDF file.
cube = iris.load_strict(tests.get_data_path(('NetCDF', 'global', 'xyt', 'SMALL_total_column_co2.nc')))
- self.apply_TEST_COMPAT_attributes(cube)
self.assertCML(cube, ('netcdf', 'netcdf_global_xyt_total.cml'))
def test_load_global_xyt_hires(self):
# Test loading another single xyt CF-netCDF file.
cube = iris.load_strict(tests.get_data_path(('NetCDF', 'global', 'xyt', 'SMALL_hires_wind_u_for_ipcc4.nc')))
- self.apply_TEST_COMPAT_attributes(cube)
self.assertCML(cube, ('netcdf', 'netcdf_global_xyt_hires.cml'))
def test_load_global_xyzt_gems(self):
# Test loading single xyzt CF-netCDF file (multi-cube).
cubes = iris.load(tests.get_data_path(('NetCDF', 'global', 'xyz_t', 'GEMS_CO2_Apr2006.nc')))
- for cube in cubes:
- self.apply_TEST_COMPAT_attributes(cube)
self.assertCML(cubes, ('netcdf', 'netcdf_global_xyzt_gems.cml'))
# Check the masked array fill value is propogated through the data manager loading.
@@ -112,28 +58,22 @@ def test_load_global_xyzt_gems(self):
def test_load_global_xyzt_gems_iter(self):
# Test loading stepped single xyzt CF-netCDF file (multi-cube).
for i, cube in enumerate(iris.load(tests.get_data_path(('NetCDF', 'global', 'xyz_t', 'GEMS_CO2_Apr2006.nc')))):
- self.apply_TEST_COMPAT_attributes(cube)
self.assertCML(cube, ('netcdf', 'netcdf_global_xyzt_gems_iter_%d.cml' % i))
def test_load_rotated_xy_land(self):
# Test loading single xy rotated pole CF-netCDF file.
cube = iris.load_strict(tests.get_data_path(('NetCDF', 'rotated', 'xy', 'rotPole_landAreaFraction.nc')))
- self.apply_TEST_COMPAT_attributes(cube)
self.assertCML(cube, ('netcdf', 'netcdf_rotated_xy_land.cml'))
def test_load_rotated_xyt_precipitation(self):
# Test loading single xyt rotated pole CF-netCDF file.
cube = iris.load_strict(tests.get_data_path(('NetCDF', 'rotated', 'xyt', 'new_rotPole_precipitation.nc')))
- self.apply_TEST_COMPAT_attributes(cube)
self.assertCML(cube, ('netcdf', 'netcdf_rotated_xyt_precipitation.cml'))
def test_cell_methods(self):
# Test exercising CF-netCDF cell method parsing.
cubes = iris.load(tests.get_data_path(('NetCDF', 'testing', 'cell_methods.nc')))
- for cube in cubes:
- self.apply_TEST_COMPAT_attributes(cube)
-
# TEST_COMPAT mod - new cube merge doesn't sort in the same way - test can pass by manual sorting...
cubes = iris.cube.CubeList(sorted(cubes, key=lambda cube:cube.name()))
@@ -143,8 +83,6 @@ def test_deferred_loading(self):
# Test exercising CF-netCDF deferred loading and deferred slicing.
# shape (31, 161, 320)
cube = iris.load_strict(tests.get_data_path(('NetCDF', 'global', 'xyt', 'SMALL_total_column_co2.nc')))
- self.apply_TEST_COMPAT_attributes(cube)
-
# Consecutive index on same dimension.
self.assertCML(cube[0], ('netcdf', 'netcdf_deferred_index_0.cml'))
@@ -160,8 +98,6 @@ def test_deferred_loading(self):
self.assertCML(cube[(0, 8, 4, 2, 14, 12), ], ('netcdf', 'netcdf_deferred_tuple_0.cml'))
self.assertCML(cube[(0, 8, 4, 2, 14, 12), ][(0, 2, 4, 1), ], ('netcdf', 'netcdf_deferred_tuple_1.cml'))
subcube = cube[(0, 8, 4, 2, 14, 12), ][(0, 2, 4, 1), ][(1, 3), ]
- subcube.coord('time')._TEST_COMPAT_force_explicit = True
- subcube.coord('time')._TEST_COMPAT_definitive = True
self.assertCML(subcube, ('netcdf', 'netcdf_deferred_tuple_2.cml'))
# Consecutive mixture on same dimension.
@@ -295,22 +231,12 @@ def test_netcdf_hybrid_height(self):
# Read netCDF file.
cube = iris.load_strict(file_out)
coord = cube.coord('time')
- coord._TEST_COMPAT_force_explicit = True
coord = cube.coord('forecast_period')
- coord._TEST_COMPAT_force_explicit = True
- coord._TEST_COMPAT_override_axis = 'forecast_period'
coord = cube.coord('source')
- coord._TEST_COMPAT_override_axis = 'source'
- coord._TEST_COMPAT_definitive = False
coord = cube.coord('sigma')
- coord._TEST_COMPAT_override_axis = 'z'
coord = cube.coord('atmosphere_hybrid_height_coordinate')
- coord._TEST_COMPAT_override_axis = 'z'
coord = cube.coord('model_level_number')
- coord._TEST_COMPAT_override_axis = 'z'
- coord._TEST_COMPAT_force_explicit = True
coord = cube.coord('surface_altitude')
- coord._TEST_COMPAT_points = False
# Check the PP read, netCDF write, netCDF read mechanism.
self.assertCML(cube, ('netcdf', 'netcdf_save_load_hybrid_height.cml'))
@@ -334,14 +260,6 @@ def test_netcdf_save_ndim_auxiliary(self):
cube = iris.load_strict(file_out)
# Check the netCDF read, write, read mechanism.
- cube.coord('time')._TEST_COMPAT_force_explicit = True
- cube.coord('grid_latitude')._TEST_COMPAT_force_explicit = True
- cube.coord('grid_longitude')._TEST_COMPAT_force_explicit = True
- cube.coord('latitude')._TEST_COMPAT_override_axis = 'latitude'
- cube.coord('longitude')._TEST_COMPAT_override_axis = 'longitude'
- cube.coord('source')._TEST_COMPAT_override_axis = 'source'
- cube.coord('source')._TEST_COMPAT_definitive = False
-
self.assertCML(cube, ('netcdf', 'netcdf_save_load_ndim_auxiliary.cml'))
os.remove(file_out)
diff --git a/lib/iris_tests/test_pickling.py b/lib/iris_tests/test_pickling.py
index 33bc72da9a..9c03ecaa3b 100644
--- a/lib/iris_tests/test_pickling.py
+++ b/lib/iris_tests/test_pickling.py
@@ -31,45 +31,6 @@
class TestPickle(tests.IrisTest):
- def assertCML(self, cube, path, *args, **kwargs):
- if isinstance(cube, iris.cube.Cube):
- cubes = [cube]
- else:
- cubes = cube
- for cube in cubes:
- try:
- coord = cube.coord('forecast_reference_time')
- coord._TEST_COMPAT_override_axis = 'rt'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('time')
- coord._TEST_COMPAT_force_explicit = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('grid_latitude')
- coord._TEST_COMPAT_force_explicit = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('grid_longitude')
- coord._TEST_COMPAT_force_explicit = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('model_level_number')
- coord._TEST_COMPAT_override_axis = 'z'
- coord._TEST_COMPAT_force_explicit = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('sigma')
- coord._TEST_COMPAT_override_axis = 'z'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- super(TestPickle, self).assertCML(cubes, path, *args, **kwargs)
-
def pickle_then_unpickle(self, obj):
"""Returns a generator of ("cpickle protocol number", object) tuples."""
for protocol in xrange(1 + cPickle.HIGHEST_PROTOCOL):
diff --git a/lib/iris_tests/test_pp_cf.py b/lib/iris_tests/test_pp_cf.py
index 555ec3d934..f76de0bb3d 100644
--- a/lib/iris_tests/test_pp_cf.py
+++ b/lib/iris_tests/test_pp_cf.py
@@ -95,64 +95,6 @@ def _test_file(self, name):
else:
fname_name = name
- for cube in cubes:
- if cube.coords('forecast_period'):
- cube.coord('forecast_period')._TEST_COMPAT_force_explicit = True
- cube.coord('forecast_period')._TEST_COMPAT_override_axis = 'forecast_period'
- if cube.coords('forecast_reference_time'):
- cube.coord('forecast_reference_time')._TEST_COMPAT_override_axis = 'rt'
- if cube.coords('pseudo_level'):
- cube.coord('pseudo_level')._TEST_COMPAT_force_explicit = True
- cube.coord('pseudo_level')._TEST_COMPAT_override_axis = 'pseudo_level'
- cube.coord('pseudo_level')._TEST_COMPAT_definitive = False
- if cube.coords('source'):
- cube.coord('source')._TEST_COMPAT_override_axis = 'source'
- cube.coord('source')._TEST_COMPAT_definitive = False
- if cube.coords('time'):
- cube.coord('time')._TEST_COMPAT_force_explicit = True
- if name != 'aaxzc_time_press.b.pp' and name != '008000000000.44.101.000128.1890.09.01.00.00.b.pp' and name != 'HadCM2_ts_SAT_ann_18602100.b.pp':
- cube.coord('time')._TEST_COMPAT_points = False
- if cube.coords('longitude'):
- if name == 'st30211.b.pp':
- cube.coord('longitude')._TEST_COMPAT_definitive = False
- cube.coord('longitude')._TEST_COMPAT_force_regular_scalar = True
- elif name == '001000000000.00.000.000000.1860.01.01.00.00.f.b.pp':
- cube.coord('longitude')._TEST_COMPAT_definitive = True
- cube.coord('longitude')._TEST_COMPAT_force_explicit = True
- elif name == 'HadCM2_ts_SAT_ann_18602100.b.pp':
- cube.coord('longitude')._TEST_COMPAT_definitive = True
- cube.coord('longitude')._TEST_COMPAT_force_explicit = True
- cube.coord('longitude')._TEST_COMPAT_points= False
- if cube.coords('latitude'):
- if name == 'HadCM2_ts_SAT_ann_18602100.b.pp':
- cube.coord('latitude')._TEST_COMPAT_definitive = True
- cube.coord('latitude')._TEST_COMPAT_force_explicit = True
- cube.coord('latitude')._TEST_COMPAT_points = False
-
-
- if cube.coords('depth'):
- cube.coord('depth')._TEST_COMPAT_override_axis = 'z'
- if cube.coords('height'):
- cube.coord('height')._TEST_COMPAT_override_axis = 'z'
- if cube.coords('pressure'):
- if name == 'model.b.pp' or name == 'aaxzc_lon_lat_press_orig.b.pp' or name == '000003000000.16.202.000128.1860.09.01.00.00.b.pp':
- cube.coord('pressure')._TEST_COMPAT_definitive = True
- else:
- cube.coord('pressure')._TEST_COMPAT_definitive = False
- cube.coord('pressure')._TEST_COMPAT_override_axis = 'z'
- if cube.coords('site_number'):
- if name == 'aaxzc_tseries.b.pp':
- cube.coord('site_number')._TEST_COMPAT_definitive = False
- cube.coord('site_number')._TEST_COMPAT_override_axis = 'site_number'
- cube.coord('site_number')._TEST_COMPAT_force_regular_scalar = True
- if cube.coords('model_level_number'):
- cube.coord('model_level_number')._TEST_COMPAT_definitive = True
- cube.coord('model_level_number')._TEST_COMPAT_override_axis = 'z'
- cube.coord('model_level_number')._TEST_COMPAT_force_explicit = True
- if cube.coords('sigma'):
- cube.coord('sigma')._TEST_COMPAT_override_axis = 'z'
-
-
self.assertCML(cubes, self._ref_dir + ('from_pp', fname_name + '.cml',))
# 2) Save the Cube and check the netCDF
@@ -199,48 +141,6 @@ def _test_file(self, name):
for index, nc_filename in enumerate(nc_filenames):
# Read netCDF to Cube.
cube = iris.load_strict(nc_filename)
-
- if cube.coords('forecast_period'):
- cube.coord('forecast_period')._TEST_COMPAT_force_explicit = True
- cube.coord('forecast_period')._TEST_COMPAT_override_axis = 'forecast_period'
- if cube.coords('forecast_reference_time'):
- cube.coord('forecast_reference_time')._TEST_COMPAT_override_axis = 'rt'
- if cube.coords('pseudo_level'):
- cube.coord('pseudo_level')._TEST_COMPAT_force_explicit = True
- cube.coord('pseudo_level')._TEST_COMPAT_override_axis = 'pseudo_level'
- if cube.coords('source'):
- cube.coord('source')._TEST_COMPAT_override_axis = 'source'
- cube.coord('source')._TEST_COMPAT_definitive = False
- if cube.coords('time'):
- cube.coord('time')._TEST_COMPAT_force_explicit = True
- if cube.coords('latitude'):
- cube.coord('latitude')._TEST_COMPAT_force_explicit = True
- if os.path.basename(nc_filename) == 'HadCM2_ts_SAT_ann_18602100.b_0.nc':
- cube.coord('latitude')._TEST_COMPAT_override_axis = 'site_number'
- if cube.coords('longitude'):
- cube.coord('longitude')._TEST_COMPAT_force_explicit = True
- if os.path.basename(nc_filename) == 'HadCM2_ts_SAT_ann_18602100.b_0.nc':
- cube.coord('longitude')._TEST_COMPAT_override_axis = 'site_number'
- if cube.coords('grid_latitude'):
- cube.coord('grid_latitude')._TEST_COMPAT_force_explicit = True
- if cube.coords('depth'):
- cube.coord('depth')._TEST_COMPAT_override_axis = 'z'
- if cube.coords('height'):
- cube.coord('height')._TEST_COMPAT_override_axis = 'z'
- if cube.coords('site_number'):
- cube.coord('site_number')._TEST_COMPAT_override_axis = 'site_number'
- if os.path.basename(nc_filename) == 'HadCM2_ts_SAT_ann_18602100.b_0.nc':
- cube.coord('site_number')._TEST_COMPAT_force_explicit = True
- cube.coord('site_number')._TEST_COMPAT_definitive = True
- if cube.coords('model_level_number'):
- cube.coord('model_level_number')._TEST_COMPAT_definitive = True
- cube.coord('model_level_number')._TEST_COMPAT_override_axis = 'z'
- cube.coord('model_level_number')._TEST_COMPAT_force_explicit = True
- if cube.coords('sigma'):
- cube.coord('sigma')._TEST_COMPAT_override_axis = 'z'
- if cube.coords('level_height'):
- cube.coord('level_height')._TEST_COMPAT_override_axis = 'z'
-
self.assertCML(cube, self._ref_dir + ('from_netcdf', '%s_%d.cml' % (fname_name, index)))
os.remove(nc_filename)
diff --git a/lib/iris_tests/test_pp_to_cube.py b/lib/iris_tests/test_pp_to_cube.py
index 93fafb21c7..b512453c41 100644
--- a/lib/iris_tests/test_pp_to_cube.py
+++ b/lib/iris_tests/test_pp_to_cube.py
@@ -54,9 +54,6 @@ def test_lbproc(self):
# Set up standard name and T+24 constraint
constraint = iris.Constraint('air_temperature', forecast_period=24)
cubes = iris.load(data_path, constraint)
- for cube in cubes:
- if cube.coords("height"):
- cube.coord("height")._TEST_COMPAT_override_axis = "z"
cubes = iris.cube.CubeList([cubes[0], cubes[3], cubes[1], cubes[2], cubes[4]])
self.assertCML(cubes, ('pp_rules', 'lbproc_mean_max_min.cml'))
diff --git a/lib/iris_tests/test_regrid.py b/lib/iris_tests/test_regrid.py
index 84375baf7e..8fa4828526 100644
--- a/lib/iris_tests/test_regrid.py
+++ b/lib/iris_tests/test_regrid.py
@@ -29,25 +29,22 @@
from iris.coord_systems import LatLonCS, GeoPosition
-def old_style(cube):
- cube.coord("model_level_number")._TEST_COMPAT_override_axis = "z"
- cube.coord("model_level_number")._TEST_COMPAT_definitive = True
- cube.coord("model_level_number")._TEST_COMPAT_force_explicit = True
- cube.coord("sigma")._TEST_COMPAT_override_axis = "z"
- cube.coord("sigma")._TEST_COMPAT_definitive = False
- cube.coord("grid_latitude")._TEST_COMPAT_definitive = True
- cube.coord("grid_latitude")._TEST_COMPAT_force_explicit = True
- cube.coord("grid_longitude")._TEST_COMPAT_definitive = True
- cube.coord("grid_longitude")._TEST_COMPAT_force_explicit = True
- # TODO: Workaround until regrid can handle factories
- cube.remove_aux_factory(cube.aux_factories[0])
- cube.remove_coord("surface_altitude")
-
- return cube
-
-
@iris.tests.skip_data
class TestRegrid(tests.IrisTest):
+ @staticmethod
+ def patch_data(cube):
+ # Workaround until regrid can handle factories
+ for factory in cube.aux_factories:
+ cube.remove_aux_factory(factory)
+
+ # Remove coords that share lat/lon dimensions
+ dim = cube.coord_dims(cube.coord('grid_longitude'))[0]
+ for coord in cube.coords(contains_dimension=dim, dim_coords=False):
+ cube.remove_coord(coord)
+ dim = cube.coord_dims(cube.coord('grid_latitude'))[0]
+ for coord in cube.coords(contains_dimension=dim, dim_coords=False):
+ cube.remove_coord(coord)
+
def setUp(self):
self.theta_path = tests.get_data_path(('PP', 'COLPEX', 'theta_and_orog.pp'))
self.uwind_path = tests.get_data_path(('PP', 'COLPEX', 'uwind_and_orog.pp'))
@@ -56,13 +53,13 @@ def setUp(self):
self.level_constraint = iris.Constraint(model_level_number=1)
self.multi_level_constraint = iris.Constraint(model_level_number=lambda c: 1 <= c < 6)
self.forecast_constraint = iris.Constraint(forecast_period=1.5)
-
+
def test_regrid_low_dimensional(self):
theta = load_strict(self.theta_path, self.theta_constraint & self.level_constraint & self.forecast_constraint)
uwind = load_strict(self.uwind_path, self.uwind_constraint & self.level_constraint & self.forecast_constraint)
- theta = old_style(theta)
- uwind = old_style(uwind)
-
+ TestRegrid.patch_data(theta)
+ TestRegrid.patch_data(uwind)
+
# 0-dimensional
theta0 = theta[0, 0]
uwind0 = uwind[0, 0]
@@ -84,8 +81,8 @@ def test_regrid_low_dimensional(self):
def test_regrid_3d(self):
theta = load_strict(self.theta_path, self.theta_constraint & self.multi_level_constraint & self.forecast_constraint)
uwind = load_strict(self.uwind_path, self.uwind_constraint & self.multi_level_constraint & self.forecast_constraint)
- theta = old_style(theta)
- uwind = old_style(uwind)
+ TestRegrid.patch_data(theta)
+ TestRegrid.patch_data(uwind)
theta = theta[:, 1:3, 1:4]
uwind = uwind[:, 0:4, 0:4]
@@ -97,28 +94,16 @@ def test_regrid_max_resolution(self):
cs = LatLonCS('datum', 'pm', GeoPosition(90, 0), 0)
low.add_dim_coord(DimCoord(numpy.array([-1, 0, 1], dtype=numpy.int32), 'latitude', units='degrees', coord_system=cs), 0)
low.add_dim_coord(DimCoord(numpy.array([-1, 0, 1, 2], dtype=numpy.int32), 'longitude', units='degrees', coord_system=cs), 1)
- low.coord("latitude")._TEST_COMPAT_force_explicit = True
- low.coord("latitude")._TEST_COMPAT_definitive = True
- low.coord("longitude")._TEST_COMPAT_force_explicit = True
- low.coord("longitude")._TEST_COMPAT_definitive = True
med = Cube(numpy.arange(20).reshape((4, 5)))
cs = LatLonCS('datum', 'pm', GeoPosition(90, 0), 0)
med.add_dim_coord(DimCoord(numpy.array([-1, 0, 1, 2], dtype=numpy.int32), 'latitude', units='degrees', coord_system=cs), 0)
med.add_dim_coord(DimCoord(numpy.array([-2, -1, 0, 1, 2], dtype=numpy.int32), 'longitude', units='degrees', coord_system=cs), 1)
- med.coord("latitude")._TEST_COMPAT_force_explicit = True
- med.coord("latitude")._TEST_COMPAT_definitive = True
- med.coord("longitude")._TEST_COMPAT_force_explicit = True
- med.coord("longitude")._TEST_COMPAT_definitive = True
high = Cube(numpy.arange(30).reshape((5, 6)))
cs = LatLonCS('datum', 'pm', GeoPosition(90, 0), 0)
high.add_dim_coord(DimCoord(numpy.array([-2, -1, 0, 1, 2], dtype=numpy.int32), 'latitude', units='degrees', coord_system=cs), 0)
high.add_dim_coord(DimCoord(numpy.array([-2, -1, 0, 1, 2, 3], dtype=numpy.int32), 'longitude', units='degrees', coord_system=cs), 1)
- high.coord("latitude")._TEST_COMPAT_force_explicit = True
- high.coord("latitude")._TEST_COMPAT_definitive = True
- high.coord("longitude")._TEST_COMPAT_force_explicit = True
- high.coord("longitude")._TEST_COMPAT_definitive = True
cubes = regrid_to_max_resolution([low, med, high], mode='nearest')
self.assertCMLApproxData(cubes, ('regrid', 'low_med_high.cml'))
@@ -133,10 +118,6 @@ def setUp(self):
cube.units = '1'
cube.add_dim_coord(DimCoord(numpy.array([1, 2, 3]), 'latitude', units='degrees', coord_system=self.cs), 0)
cube.add_dim_coord(DimCoord(numpy.array([1, 2, 3, 4]), 'longitude', units='degrees', coord_system=self.cs), 1)
- cube.coord("latitude")._TEST_COMPAT_force_explicit = True
- cube.coord("latitude")._TEST_COMPAT_definitive = True
- cube.coord("longitude")._TEST_COMPAT_force_explicit = True
- cube.coord("longitude")._TEST_COMPAT_definitive = True
self.source = cube
# Cube with a smaller grid in latitude and longitude than the source grid by taking the coordinate mid-points.
@@ -144,10 +125,6 @@ def setUp(self):
cube.units = '1'
cube.add_dim_coord(DimCoord(numpy.array([1.5, 2.5]), 'latitude', units='degrees', coord_system=self.cs), 0)
cube.add_dim_coord(DimCoord(numpy.array([1.5, 2.5, 3.5]), 'longitude', units='degrees', coord_system=self.cs), 1)
- cube.coord("latitude")._TEST_COMPAT_force_explicit = True
- cube.coord("latitude")._TEST_COMPAT_definitive = True
- cube.coord("longitude")._TEST_COMPAT_force_explicit = True
- cube.coord("longitude")._TEST_COMPAT_definitive = True
self.smaller = cube
# Cube with a larger grid in latitude and longitude than the source grid by taking the coordinate mid-points and extrapolating at extremes.
@@ -155,10 +132,6 @@ def setUp(self):
cube.units = '1'
cube.add_dim_coord(DimCoord(numpy.array([0.5, 1.5, 2.5, 3.5]), 'latitude', units='degrees', coord_system=self.cs), 0)
cube.add_dim_coord(DimCoord(numpy.array([0.5, 1.5, 2.5, 3.5, 4.5]), 'longitude', units='degrees', coord_system=self.cs), 1)
- cube.coord("latitude")._TEST_COMPAT_force_explicit = True
- cube.coord("latitude")._TEST_COMPAT_definitive = True
- cube.coord("longitude")._TEST_COMPAT_force_explicit = True
- cube.coord("longitude")._TEST_COMPAT_definitive = True
self.larger = cube
def test_bilinear_smaller_lon_left(self):
diff --git a/lib/iris_tests/test_trajectory.py b/lib/iris_tests/test_trajectory.py
index 5c07cc9825..84c974a7a8 100644
--- a/lib/iris_tests/test_trajectory.py
+++ b/lib/iris_tests/test_trajectory.py
@@ -36,36 +36,6 @@ def test_invalid_coord(self):
class TestTrajectory(tests.IrisTest):
- def assertCML(self, cube, path, *args, **kwargs):
- try:
- coord = cube.coord('model_level_number')
- coord._TEST_COMPAT_force_explicit = True
- coord._TEST_COMPAT_override_axis = 'z'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('sigma')
- coord._TEST_COMPAT_override_axis = 'z'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('grid_latitude')
- coord._TEST_COMPAT_force_explicit = True
- coord._TEST_COMPAT_definitive = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('time')
- coord._TEST_COMPAT_force_explicit = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('surface_altitude')
- coord._TEST_COMPAT_points = False
- except iris.exceptions.CoordinateNotFoundError:
- pass
- super(TestTrajectory, self).assertCML(cube, path, *args, **kwargs)
-
def test_trajectory_definition(self):
# basic 2-seg line along x
waypoints = [ {'lat':0, 'lon':0}, {'lat':0, 'lon':1}, {'lat':0, 'lon':2} ]
@@ -149,12 +119,6 @@ def test_tri_polar(self):
# extract
sampled_cube = iris.analysis.trajectory.interpolate(cube, sample_points)
- coord = sampled_cube.coord('longitude')
- coord._TEST_COMPAT_override_axis = 'nav_lon'
- coord = sampled_cube.coord('latitude')
- coord._TEST_COMPAT_override_axis = 'nav_lat'
- coord = sampled_cube.coord('depth')
- coord._TEST_COMPAT_override_axis = 'z'
self.assertCML(sampled_cube, ('trajectory', 'tri_polar_latitude_slice.cml'))
# turn it upside down for the visualisation
diff --git a/lib/iris_tests/test_trui.py b/lib/iris_tests/test_trui.py
index 8e49e4f168..43eb926835 100644
--- a/lib/iris_tests/test_trui.py
+++ b/lib/iris_tests/test_trui.py
@@ -30,14 +30,6 @@
@iris.tests.skip_data
class TestTrui(IrisPPTest):
- def assertCML(self, cube, path, *args, **kwargs):
- try:
- coord = cube.coord('time')
- coord._TEST_COMPAT_force_explicit = True
- except iris.exceptions.CoordinateNotFoundError:
- pass
- super(TestTrui, self).assertCML(cube, path, *args, **kwargs)
-
def test_mean_save(self):
files = ['200812011200', '200812021200', '200812031200', '200812041200',
'200812051200', '200812061200', '200812071200', '200812081200']
diff --git a/lib/iris_tests/test_uri_callback.py b/lib/iris_tests/test_uri_callback.py
index e0b48e308b..e0994e8138 100644
--- a/lib/iris_tests/test_uri_callback.py
+++ b/lib/iris_tests/test_uri_callback.py
@@ -58,49 +58,6 @@ def truipp_filename_callback(cube, field, filename):
@iris.tests.skip_data
class TestCallbacks(tests.IrisTest):
- def assertCML(self, cube, path, *args, **kwargs):
- try:
- coord = cube.coord('pressure')
- #coord._TEST_COMPAT_definitive = False
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('time')
- #coord._TEST_COMPAT_definitive = False
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('experiment_id')
- coord._TEST_COMPAT_override_axis = 'experiment_id'
- coord._TEST_COMPAT_definitive = False
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('forecast_period')
- coord._TEST_COMPAT_force_explicit = True
- coord._TEST_COMPAT_override_axis = 'forecast_period'
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('random element')
- coord._TEST_COMPAT_override_axis = 'random element'
- coord._TEST_COMPAT_definitive = False
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('source')
- coord._TEST_COMPAT_override_axis = 'source'
- coord._TEST_COMPAT_definitive = False
- except iris.exceptions.CoordinateNotFoundError:
- pass
- try:
- coord = cube.coord('originating_centre')
- coord._TEST_COMPAT_override_axis = 'originating_centre'
- coord._TEST_COMPAT_definitive = False
- except iris.exceptions.CoordinateNotFoundError:
- pass
- super(TestCallbacks, self).assertCML(cube, path, *args, **kwargs)
-
def test_invalid_signature_callback(self):
def invalid_callback(cube, ):
# should never get here
diff --git a/lib/iris_tests/test_xml.py b/lib/iris_tests/test_xml.py
index ff8a2abf9a..5e14c4721b 100644
--- a/lib/iris_tests/test_xml.py
+++ b/lib/iris_tests/test_xml.py
@@ -31,24 +31,12 @@
import iris.unit
-def old_style_coords_TEST_COMPAT(c, *coord_names):
- for coord_name in coord_names:
- c.coord(coord_name)._TEST_COMPAT_override_axis = coord_name
- if coord_name == "pressure":
- c.coord(coord_name)._TEST_COMPAT_override_axis = "z"
- if coord_name in ["source", "pressure", "time", "forecast_period"]:
- c.coord(coord_name)._TEST_COMPAT_definitive = False
-
-
class TestXML(tests.IrisTest):
@iris.tests.skip_data
def test_pp(self):
# Test xml output of a cube loaded from pp.
cubes = iris.cube.CubeList([iris.tests.stock.simple_pp()])
- old_style_coords_TEST_COMPAT(cubes[0], "forecast_period", "source")
- cubes[0].coord("forecast_period")._TEST_COMPAT_definitive = True
-
self.assertCML(cubes, ('xml', 'pp.cml'))
def test_handmade(self):
@@ -82,21 +70,17 @@ def test_handmade(self):
cube.add_dim_coord(coords.DimCoord(numpy.array([-90, -45, 0, 45, 90], dtype=ll_dtype),
'latitude', units='degrees', coord_system=lonlat_cs), 0)
- if ll_dtype == numpy.int32:
- cube.coord("latitude")._TEST_COMPAT_force_explicit = True
- cube.coord("longitude")._TEST_COMPAT_force_explicit = True
-
# height
cube.add_aux_coord(coords.AuxCoord(numpy.array([1000], dtype=numpy.int32),
long_name='pressure', units='Pa'))
-
+
# phenom
cube.rename("temperature")
cube.units = "K"
-
+
# source
cube.add_aux_coord(coords.AuxCoord(points=["itbb"], long_name='source', units="no_unit"))
-
+
# forecast dates
if forecast_or_time_mean == "forecast":
unit = iris.unit.Unit('hours since epoch', calendar=iris.unit.CALENDAR_GREGORIAN)
@@ -105,7 +89,7 @@ def test_handmade(self):
standard_name='forecast_period', units='hours'))
cube.add_aux_coord(coords.AuxCoord(numpy.array([unit.date2num(dt)], dtype=numpy.float64),
standard_name='time', units=unit))
-
+
# time mean dates
if forecast_or_time_mean == "time_mean":
unit = iris.unit.Unit('hours since epoch', calendar=iris.unit.CALENDAR_GREGORIAN)
@@ -119,12 +103,7 @@ def test_handmade(self):
bounds=numpy.array([unit.date2num(dt1), unit.date2num(dt2)],
dtype=numpy.float64)))
cube.add_cell_method(coords.CellMethod('mean', cube.coord('forecast_period')))
-
- old_style_coords_TEST_COMPAT(cube, "forecast_period", "source", "time", "pressure")
-
- cube.coord("latitude")._TEST_COMPAT_definitive = False
- cube.coord("longitude")._TEST_COMPAT_definitive = False
-
+
cubes.append(cube)
# Now we've made all sorts of cube, check the xml...