iris.common.lenient

Provides the infrastructure to support lenient client/service behaviour.

In this module:

iris.common.lenient.LENIENT

(Public) Instance that manages all Iris run-time lenient features.

↑ top ↑

Thread-local data

class iris.common.lenient.Lenient(**kwargs)[source]

A container for managing the run-time lenient features and options.

Kwargs:

  • kwargs (dict)

    Mapping of lenient key/value options to enable/disable. Note that, only the lenient “maths” options is available, which controls lenient/strict cube arithmetic.

For example:

Lenient(maths=False)

Note that, the values of these options are thread-specific.

context(**kwargs)[source]

Return a context manager which allows temporary modification of the lenient option state within the scope of the context manager.

On entry to the context manager, all provided keyword arguments are applied. On exit from the context manager, the previous lenient option state is restored.

For example::
with iris.common.Lenient.context(maths=False):

pass