Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pp-mo committed Oct 23, 2024
1 parent 6d04d49 commit 4e265f2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
8 changes: 6 additions & 2 deletions docs/src/further_topics/controlling_merge.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,5 +200,9 @@ Once merged, we can now concatenate all these cubes into a single result cube, w
source 'Data from Met Office Unified Model'
um_version '12.1'

.. todo::
Mention the work done in #6168
See Also
--------
* :func:`iris.combine_cubes` can perform similar operations automatically
* :data:`iris.LOAD_POLICY` controls the application of :func:`~iris.combine_cubes`
during the load operations, i.e. :func:`~iris.load`, :func:`~iris.load_cube` and
:func:`~iris.load_cubes`.
19 changes: 15 additions & 4 deletions lib/iris/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,9 @@ class LoadPolicy(threading.local):
of matching dimension and scalar coordinates. This may be supported at
some later date, but for now is not possible without specific user actions.
TODO: reference the newer advice on "new_axis" usage.
.. Note ::
See also : :ref:`controlling_merge`.
Examples
--------
Expand Down Expand Up @@ -519,11 +521,20 @@ def context(self, settings=None, **kwargs):
import iris
from iris import LOAD_POLICY, sample_data_path
path = sample_data_path("hybrid_height.nc")
>>> with LOAD_POLICY.context("comprehensive"):
>>> path = sample_data_path("time_varying_hybrid_height", "*.pp")
>>> with LOAD_POLICY.context("legacy"):
... cubes = iris.load(path)
>>> print(cubes)
0: surface_altitude / (m) (time: 15; latitude: 144; longitude: 192)
1: x_wind / (m s-1) (time: 2; model_level_number: 5; latitude: 144; longitude: 192)
2: x_wind / (m s-1) (time: 12; model_level_number: 5; latitude: 144; longitude: 192)
3: x_wind / (m s-1) (model_level_number: 5; latitude: 144; longitude: 192)
>>> with LOAD_POLICY.context("recommended"):
... cube = iris.load_cube(path, "x_wind")
>>> cube
<iris 'Cube' of x_wind / (m s-1) (model_level_number: 5; time: 15; latitude: 144; longitude: 192)>
"""
# Save the current state
saved_settings = self.settings()
Expand Down
2 changes: 0 additions & 2 deletions lib/iris/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ class _CubeFilter:
"""A constraint, paired with a list of cubes matching that constraint."""

def __init__(self, constraint, cubes=None):
from iris.cube import CubeList

self.constraint = constraint
if cubes is None:
cubes = CubeList()
Expand Down

0 comments on commit 4e265f2

Please sign in to comment.