Skip to content

Commit c7bfbde

Browse files
committed
Resolve merge conflicts
1 parent ef294b9 commit c7bfbde

5 files changed

Lines changed: 68 additions & 20 deletions

File tree

docs/iris/src/whatsnew/contributions_2.3.0/bugfix_2019-Sep-25_transpose_cell_measures.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

docs/iris/src/whatsnew/contributions_2.3.0/newfeature_2019-Sep-09_cf_ancillary_data.txt renamed to docs/iris/src/whatsnew/contributions_3.0.0/newfeature_2019-Oct-14_cf_ancillary_data.txt

File renamed without changes.

lib/iris/coords.py

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def convert_units(self, unit):
417417
if self.units.is_unknown():
418418
raise iris.exceptions.UnitConversionError(
419419
'Cannot convert from unknown units. '
420-
'The "coord.units" attribute may be set directly.')
420+
'The ".units" attribute may be set directly.')
421421

422422
# Set up a delayed conversion for use if either values or bounds (if
423423
# present) are lazy.
@@ -636,11 +636,10 @@ def __init__(self, data, standard_name=None, long_name=None,
636636
def _data(self):
637637
return self._values
638638

639-
@property.setter
639+
@_data.setter
640640
def _data(self, data):
641641
self._values_setter(values=data)
642642

643-
644643
def lazy_data(self):
645644
"""
646645
Return a lazy array representing the ancillary variable's data.
@@ -1133,7 +1132,7 @@ def contains_point(self, point):
11331132

11341133
class Coord(_DimensionalMetadata):
11351134
"""
1136-
Abstract superclass for coordinates.
1135+
Superclass for coordinates.
11371136
11381137
"""
11391138
def __init__(self, points, standard_name=None, long_name=None,
@@ -2135,21 +2134,6 @@ def _xml_id_extra(self, unique_value):
21352134
return unique_value
21362135

21372136

2138-
class AuxCoord(Coord):
2139-
"""
2140-
A CF auxiliary coordinate.
2141-
.. note::
2142-
There are currently no specific properties of :class:`AuxCoord`,
2143-
everything is inherited from :class:`Coord`.
2144-
"""
2145-
# Logically, :class:`Coord` is an abstract class and all actual coords must
2146-
# be members of some concrete subclass, i.e. an :class:`AuxCoord` or
2147-
# a :class:`DimCoord`.
2148-
# So we retain :class:`AuxCoord` as a distinct concrete subclass.
2149-
# This provides clarity, backwards compatibility, and so we can add
2150-
# AuxCoord-specific code if needed in future.
2151-
2152-
21532137
class DimCoord(Coord):
21542138
"""
21552139
A coordinate that is 1D, numeric, and strictly monotonic.
@@ -2416,6 +2400,24 @@ def xml_element(self, doc):
24162400
return element
24172401

24182402

2403+
class AuxCoord(Coord):
2404+
"""
2405+
A CF auxiliary coordinate.
2406+
2407+
.. note::
2408+
2409+
There are currently no specific properties of :class:`AuxCoord`,
2410+
everything is inherited from :class:`Coord`.
2411+
2412+
"""
2413+
# Logically, :class:`Coord` is an abstract class and all actual coords must
2414+
# be members of some concrete subclass, i.e. an :class:`AuxCoord` or
2415+
# a :class:`DimCoord`.
2416+
# So we retain :class:`AuxCoord` as a distinct concrete subclass.
2417+
# This provides clarity, backwards compatibility, and so we can add
2418+
# AuxCoord-specific code if needed in future.
2419+
2420+
24192421
class CellMethod(iris.util._OrderedHashable):
24202422
"""
24212423
Represents a sub-cell pre-processing operation.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# (C) British Crown Copyright 2019, Met Office
2+
#
3+
# This file is part of Iris.
4+
#
5+
# Iris is free software: you can redistribute it and/or modify it under
6+
# the terms of the GNU Lesser General Public License as published by the
7+
# Free Software Foundation, either version 3 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# Iris is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public License
16+
# along with Iris. If not, see <http://www.gnu.org/licenses/>.
17+
"""Unit tests for the :class:`iris.coords.AncillaryVariable` class."""
18+
19+
# Import iris.tests first so that some things can be initialised before
20+
# importing anything else.
21+
import iris.tests as tests
22+
23+
import numpy as np
24+
25+
from iris.coords import AncillaryVariable
26+
27+
28+
class Test(tests.IrisTest):
29+
def setUp(self):
30+
self.values = np.array((2, 3, 5, 8))
31+
self.measure = AncillaryVariable(
32+
self.values, units='1',
33+
standard_name='status_flag',
34+
long_name='location of bad data',
35+
var_name='status_flag',
36+
attributes={'notes': 'Additional data mask'})
37+
38+
def test_data_values(self):
39+
self.assertEqual(self.measure.data, self.values)

lib/iris/tests/unit/cube/test_Cube.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,6 +1905,14 @@ def test_cell_measures(self):
19051905
self.assertEqual(self.cube._cell_measures_and_dims,
19061906
[(area_cm, (2, 0))])
19071907

1908+
def test_ancillary_variables(self):
1909+
ancill_var = AncillaryVariable(data=np.arange(8).reshape(2, 4),
1910+
long_name='instrument error')
1911+
self.cube.add_ancillary_variable(ancill_var, (1, 2))
1912+
self.cube.transpose()
1913+
self.assertEqual(self.cube._ancillary_variables_and_dims,
1914+
[(ancill_var, (2, 1))])
1915+
19081916

19091917
class Test_convert_units(tests.IrisTest):
19101918
def test_convert_unknown_units(self):

0 commit comments

Comments
 (0)