From 4e265f2400bde57b8fe60578351ea27326c67e89 Mon Sep 17 00:00:00 2001 From: Patrick Peglar Date: Wed, 23 Oct 2024 20:06:30 +0100 Subject: [PATCH] Review changes --- docs/src/further_topics/controlling_merge.rst | 8 ++++++-- lib/iris/__init__.py | 19 +++++++++++++++---- lib/iris/cube.py | 2 -- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/docs/src/further_topics/controlling_merge.rst b/docs/src/further_topics/controlling_merge.rst index 3f788a8493..6f223048ea 100644 --- a/docs/src/further_topics/controlling_merge.rst +++ b/docs/src/further_topics/controlling_merge.rst @@ -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`. diff --git a/lib/iris/__init__.py b/lib/iris/__init__.py index 497aaed323..5255c5cc46 100644 --- a/lib/iris/__init__.py +++ b/lib/iris/__init__.py @@ -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 -------- @@ -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 + """ # Save the current state saved_settings = self.settings() diff --git a/lib/iris/cube.py b/lib/iris/cube.py index 389ef5f981..30ac3432b7 100644 --- a/lib/iris/cube.py +++ b/lib/iris/cube.py @@ -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()