Skip to content

Commit

Permalink
Merge branch 'load_factory_dims' into load_factory_dims_rearrange_1
Browse files Browse the repository at this point in the history
  • Loading branch information
pp-mo committed Oct 23, 2024
2 parents b3e8104 + 4e265f2 commit 3a6fedf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 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/io/loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,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 @@ -349,11 +351,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

0 comments on commit 3a6fedf

Please sign in to comment.