Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
`iris.fileformats.pp_rules` has been renamed to `iris.fileformats.pp_load_rules`.
This has been done for the sake of clarity following the introduction of `iris.fileformats.pp_save_rules`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

7 changes: 4 additions & 3 deletions lib/iris/fileformats/pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from iris._deprecation import warn_deprecated
from iris._lazy_data import as_concrete_data, as_lazy_data, is_lazy_data
import iris.config
import iris.fileformats.pp_rules
import iris.fileformats.pp_load_rules
from iris.fileformats.pp_save_rules import verify

# NOTE: this is for backwards-compatitibility *ONLY*
Expand Down Expand Up @@ -1930,7 +1930,8 @@ def load_pairs_from_fields(pp_fields):

"""
load_pairs_from_fields = iris.fileformats.rules.load_pairs_from_fields
return load_pairs_from_fields(pp_fields, iris.fileformats.pp_rules.convert)
return load_pairs_from_fields(pp_fields,
iris.fileformats.pp_load_rules.convert)


def _load_cubes_variable_loader(filenames, callback, loading_function,
Expand All @@ -1957,7 +1958,7 @@ def _load_cubes_variable_loader(filenames, callback, loading_function,
else:
loader = iris.fileformats.rules.Loader(
loading_function, loading_function_kwargs or {},
iris.fileformats.pp_rules.convert)
iris.fileformats.pp_load_rules.convert)

result = iris.fileformats.rules.load_cubes(filenames, callback, loader,
pp_filter)
Expand Down
File renamed without changes.
11 changes: 6 additions & 5 deletions lib/iris/fileformats/um/_fast_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,12 @@ def _convert_collation(collation):

"""
from iris.fileformats.rules import ConversionMetadata
from iris.fileformats.pp_rules import (_convert_time_coords,
_convert_vertical_coords,
_convert_scalar_realization_coords,
_convert_scalar_pseudo_level_coords,
_all_other_rules)
from iris.fileformats.pp_load_rules import \
(_convert_time_coords,
_convert_vertical_coords,
_convert_scalar_realization_coords,
_convert_scalar_pseudo_level_coords,
_all_other_rules)

# For all the scalar conversions, all fields in the collation will
# give the same result, so the choice is arbitrary.
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/fileformats/um/_fast_load_structured_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def group_structured_fields(field_iterator):
* the same for all fields,
* completely irrelevant, or
* used by a vectorised rule function (such as
:func:`iris.fileformats.pp_rules._convert_vector_time_coords`).
:func:`iris.fileformats.pp_load_rules._convert_time_coords`).

Returns:
A generator of FieldCollation objects, each of which contains a single
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/tests/integration/test_pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from iris.coords import AuxCoord, CellMethod, DimCoord
from iris.cube import Cube
import iris.fileformats.pp
import iris.fileformats.pp_rules
import iris.fileformats.pp_load_rules
from iris.fileformats.pp_save_rules import verify
from iris.exceptions import IgnoreCubeException
from iris.tests import mock
Expand Down
4 changes: 2 additions & 2 deletions lib/iris/tests/integration/test_pp_constrained_load_cubes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2014 - 2015, Met Office
# (C) British Crown Copyright 2014 - 2017, Met Office
#
# This file is part of Iris.
#
Expand All @@ -25,7 +25,7 @@

import iris
from iris.fileformats import pp
from iris.fileformats.pp_rules import convert
from iris.fileformats.pp_load_rules import convert
from iris.fileformats.rules import load_cubes


Expand Down
2 changes: 1 addition & 1 deletion lib/iris/tests/test_coding_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class StandardReportWithExclusions(pep8.StandardReport):
'*/iris/fileformats/dot.py',
'*/iris/fileformats/grib/_grib_cf_map.py',
'*/iris/fileformats/grib/_grib1_load_rules.py',
'*/iris/fileformats/pp_rules.py',
'*/iris/fileformats/pp_load_rules.py',
'*/iris/fileformats/rules.py',
'*/iris/fileformats/um_cf_map.py',
'*/iris/fileformats/_pyke_rules/compiled_krb/compiled_pyke_files.py',
Expand Down
16 changes: 8 additions & 8 deletions lib/iris/tests/test_pp_to_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import iris
import iris.fileformats.pp
import iris.fileformats.pp_rules
import iris.fileformats.pp_load_rules
import iris.fileformats.rules
import iris.io
import iris.util
Expand All @@ -41,7 +41,7 @@ def setUp(self):

def _field_to_cube(self, field):
cube, _, _ = iris.fileformats.rules._make_cube(
field, iris.fileformats.pp_rules.convert)
field, iris.fileformats.pp_load_rules.convert)
return cube

def test_lbtim_2(self):
Expand All @@ -52,7 +52,7 @@ def test_lbtim_2(self):
cube = self._field_to_cube(field)
self.subcubes.append(cube)
cube = self.subcubes.merge()[0]
self.assertCML(cube, ('pp_rules', 'lbtim_2.cml'))
self.assertCML(cube, ('pp_load_rules', 'lbtim_2.cml'))

def _ocean_depth(self, bounded=False):
lbuser = list(self.template.lbuser)
Expand All @@ -76,12 +76,12 @@ def _ocean_depth(self, bounded=False):
def test_ocean_depth(self):
self._ocean_depth()
cube = self.subcubes.merge()[0]
self.assertCML(cube, ('pp_rules', 'ocean_depth.cml'))
self.assertCML(cube, ('pp_load_rules', 'ocean_depth.cml'))

def test_ocean_depth_bounded(self):
self._ocean_depth(bounded=True)
cube = self.subcubes.merge()[0]
self.assertCML(cube, ('pp_rules', 'ocean_depth_bounded.cml'))
self.assertCML(cube, ('pp_load_rules', 'ocean_depth_bounded.cml'))


class TestReferences(tests.IrisTest):
Expand Down Expand Up @@ -133,19 +133,19 @@ def test_pp_load_rules(self):
# Test PP loading and rule evaluation.

cube = iris.tests.stock.simple_pp()
self.assertCML(cube, ('pp_rules', 'global.cml'))
self.assertCML(cube, ('pp_load_rules', 'global.cml'))

data_path = tests.get_data_path(('PP', 'rotated_uk', 'rotated_uk.pp'))
cube = iris.load(data_path)[0]
self.assertCML(cube, ('pp_rules', 'rotated_uk.cml'))
self.assertCML(cube, ('pp_load_rules', 'rotated_uk.cml'))

def test_lbproc(self):
data_path = tests.get_data_path(('PP', 'meanMaxMin', '200806081200__qwpb.T24.pp'))
# Set up standard name and T+24 constraint
constraint = iris.Constraint('air_temperature', forecast_period=24)
cubes = iris.load(data_path, constraint)
cubes = iris.cube.CubeList([cubes[0], cubes[3], cubes[1], cubes[2], cubes[4]])
self.assertCML(cubes, ('pp_rules', 'lbproc_mean_max_min.cml'))
self.assertCML(cubes, ('pp_load_rules', 'lbproc_mean_max_min.cml'))

def test_cell_methods(self):
# Test cell methods are created for correct values of lbproc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with Iris. If not, see <http://www.gnu.org/licenses/>.
"""Unit tests for the :mod:`iris.fileformats.pp_rules` module."""
"""Unit tests for the :mod:`iris.fileformats.pp_load_rules` module."""

from __future__ import (absolute_import, division, print_function)
from six.moves import (filter, input, map, range, zip) # noqa
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2014 - 2016, Met Office
# (C) British Crown Copyright 2014 - 2017, Met Office
#
# This file is part of Iris.
#
Expand All @@ -14,7 +14,10 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with Iris. If not, see <http://www.gnu.org/licenses/>.
"""Unit tests for the `iris.fileformats.pp_rules._all_other_rules` function."""
"""
Unit tests for the `iris.fileformats.pp_load_rules._all_other_rules` function.

"""

from __future__ import (absolute_import, division, print_function)
from six.moves import (filter, input, map, range, zip) # noqa
Expand All @@ -29,14 +32,14 @@

import cartopy.crs as ccrs
import iris
from iris.fileformats.pp_rules import _all_other_rules
from iris.fileformats.pp_load_rules import _all_other_rules
from iris.fileformats.pp import SplittableInt
from iris.coords import CellMethod, DimCoord, AuxCoord
from iris.tests import mock
from iris.tests.unit.fileformats import TestField


# iris.fileformats.pp_rules._all_other_rules() returns a tuple of
# iris.fileformats.pp_load_rules._all_other_rules() returns a tuple of
# of various metadata. This constant is the index into this
# tuple to obtain the cell methods.
CELL_METHODS_INDEX = 5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2014 - 2015, Met Office
# (C) British Crown Copyright 2014 - 2017, Met Office
#
# This file is part of Iris.
#
Expand All @@ -16,7 +16,7 @@
# along with Iris. If not, see <http://www.gnu.org/licenses/>.
"""
Unit tests for
:func:`iris.fileformats.pp_rules._collapse_degenerate_points_and_bounds`.
:func:`iris.fileformats.pp_load_rules._collapse_degenerate_points_and_bounds`.

"""

Expand All @@ -29,7 +29,8 @@

import numpy as np

from iris.fileformats.pp_rules import _collapse_degenerate_points_and_bounds
from iris.fileformats.pp_load_rules import \
_collapse_degenerate_points_and_bounds


class Test(tests.IrisTest):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2014 - 2015, Met Office
# (C) British Crown Copyright 2014 - 2017, Met Office
#
# This file is part of Iris.
#
Expand All @@ -16,7 +16,7 @@
# along with Iris. If not, see <http://www.gnu.org/licenses/>.
"""
Unit tests for
:func:`iris.fileformats.pp_rules._convert_pseudo_level_coords`.
:func:`iris.fileformats.pp_load_rules._convert_pseudo_level_coords`.

"""

Expand All @@ -30,7 +30,7 @@
from iris.coords import DimCoord
from iris.tests.unit.fileformats import TestField

from iris.fileformats.pp_rules import _convert_scalar_pseudo_level_coords
from iris.fileformats.pp_load_rules import _convert_scalar_pseudo_level_coords


class Test(TestField):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2014 - 2015, Met Office
# (C) British Crown Copyright 2014 - 2017, Met Office
#
# This file is part of Iris.
#
Expand All @@ -16,7 +16,7 @@
# along with Iris. If not, see <http://www.gnu.org/licenses/>.
"""
Unit tests for
:func:`iris.fileformats.pp_rules._convert_scalar_realization_coords`.
:func:`iris.fileformats.pp_load_rules._convert_scalar_realization_coords`.

"""

Expand All @@ -30,7 +30,7 @@
from iris.coords import DimCoord
from iris.tests.unit.fileformats import TestField

from iris.fileformats.pp_rules import _convert_scalar_realization_coords
from iris.fileformats.pp_load_rules import _convert_scalar_realization_coords


class Test(TestField):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2014 - 2016, Met Office
# (C) British Crown Copyright 2014 - 2017, Met Office
#
# This file is part of Iris.
#
Expand All @@ -16,7 +16,7 @@
# along with Iris. If not, see <http://www.gnu.org/licenses/>.
"""
Unit tests for
:func:`iris.fileformats.pp_rules._convert_time_coords`.
:func:`iris.fileformats.pp_load_rules._convert_time_coords`.

"""

Expand All @@ -33,7 +33,7 @@

from iris.coords import DimCoord, AuxCoord
from iris.fileformats.pp import SplittableInt
from iris.fileformats.pp_rules import _convert_time_coords
from iris.fileformats.pp_load_rules import _convert_time_coords
from iris.tests import mock
from iris.tests.unit.fileformats import TestField

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2014 - 2015, Met Office
# (C) British Crown Copyright 2014 - 2017, Met Office
#
# This file is part of Iris.
#
Expand All @@ -16,7 +16,7 @@
# along with Iris. If not, see <http://www.gnu.org/licenses/>.
"""
Unit tests for
:func:`iris.fileformats.pp_rules._convert_vertical_coords`.
:func:`iris.fileformats.pp_load_rules._convert_vertical_coords`.

"""

Expand All @@ -32,7 +32,7 @@
from iris.coords import DimCoord, AuxCoord
from iris.aux_factory import HybridPressureFactory, HybridHeightFactory
from iris.fileformats.pp import SplittableInt, STASH
from iris.fileformats.pp_rules import Reference, _convert_vertical_coords
from iris.fileformats.pp_load_rules import Reference, _convert_vertical_coords
from iris.tests.unit.fileformats import TestField


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2014 - 2015, Met Office
# (C) British Crown Copyright 2014 - 2017, Met Office
#
# This file is part of Iris.
#
Expand All @@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with Iris. If not, see <http://www.gnu.org/licenses/>.
"""Unit tests for :func:`iris.fileformats.pp_rules._dim_or_aux`."""
"""Unit tests for :func:`iris.fileformats.pp_load_rules._dim_or_aux`."""

from __future__ import (absolute_import, division, print_function)
from six.moves import (filter, input, map, range, zip) # noqa
Expand All @@ -24,7 +24,7 @@
import iris.tests as tests

from iris.coords import DimCoord, AuxCoord
from iris.fileformats.pp_rules import _dim_or_aux
from iris.fileformats.pp_load_rules import _dim_or_aux


class Test(tests.IrisTest):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2014 - 2015, Met Office
# (C) British Crown Copyright 2014 - 2017, Met Office
#
# This file is part of Iris.
#
Expand All @@ -14,7 +14,10 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with Iris. If not, see <http://www.gnu.org/licenses/>.
"""Unit tests for :func:`iris.fileformats.pp_rules._model_level_number`."""
"""
Unit tests for :func:`iris.fileformats.pp_load_rules._model_level_number`.

"""

from __future__ import (absolute_import, division, print_function)
from six.moves import (filter, input, map, range, zip) # noqa
Expand All @@ -23,7 +26,7 @@
# importing anything else.
import iris.tests as tests

from iris.fileformats.pp_rules import _model_level_number
from iris.fileformats.pp_load_rules import _model_level_number


class Test_9999(tests.IrisTest):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) British Crown Copyright 2014 - 2015, Met Office
# (C) British Crown Copyright 2014 - 2017, Met Office
#
# This file is part of Iris.
#
Expand All @@ -16,7 +16,7 @@
# along with Iris. If not, see <http://www.gnu.org/licenses/>.
"""
Unit tests for
:func:`iris.fileformats.pp_rules._reduce_points_and_bounds`.
:func:`iris.fileformats.pp_load_rules._reduce_points_and_bounds`.

"""

Expand All @@ -29,7 +29,7 @@

import numpy as np

from iris.fileformats.pp_rules import _reduce_points_and_bounds
from iris.fileformats.pp_load_rules import _reduce_points_and_bounds


class Test(tests.IrisTest):
Expand Down
Loading