Skip to content

Commit 857a4f5

Browse files
committed
Review changes: docs explain not to assign to iris.COMBINE_POLICY.
1 parent 58103ed commit 857a4f5

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

lib/iris/_combine.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,18 @@ class CombineOptions(threading.local):
132132
133133
.. Note::
134134
135-
The name ``iris.LOAD_POLICY`` refers to the same thing as
136-
``iris.COMBINE_POLICY``, and is still usable, but no longer recommended.
135+
The ``iris.COMBINE_POLICY`` can be adjusted by either:
136+
137+
1. calling ``iris.COMBINE_POLICY.set(<something>)``, or
138+
2. using ``with COMBINE_POLICY.context(<something>): ...``, or
139+
3. assigning a property ``COMBINE_POLICY.<option> = <value>``, such as
140+
``COMBINE_POLICY.merge_concat_sequence="cm"``
141+
142+
What you should **not** ever do is to assign :data:`iris.COMBINE_POLICY` itself,
143+
e.g. ``iris.COMBINE_POLICY = CombineOptions("legacy")``, since in that case the
144+
original object still exists, and is still the one in control of load/combine
145+
operations. Here, the correct approach would be
146+
``iris.COMBINE_POLICY.set("legacy")``.
137147
138148
>>> COMBINE_POLICY.set("legacy")
139149
>>> print(COMBINE_POLICY)
@@ -153,6 +163,12 @@ class CombineOptions(threading.local):
153163
>>>
154164
>>> print(COMBINE_POLICY)
155165
CombineOptions(equalise_cubes_kwargs=None, merge_concat_sequence='cm', merge_unique=False, repeat_until_unchanged=False, support_multiple_references=True)
166+
167+
.. Note::
168+
169+
The name ``iris.LOAD_POLICY`` refers to the same thing as
170+
``iris.COMBINE_POLICY``, and is still usable, but is no longer recommended.
171+
156172
"""
157173

158174
# Useful constants

0 commit comments

Comments
 (0)