You are viewing the latest unreleased documentation v3.1.dev0. You may prefer a stable version.


Provides access to Iris-specific configuration values.

The default configuration values can be overridden by creating the file iris/etc/site.cfg. If it exists, this file must conform to the format defined by ConfigParser.


Local directory where test data exists. Defaults to “test_data” sub-directory of the Iris package install directory. The test data directory supports the subset of Iris unit tests that require data. Directory contents accessed via iris.tests.get_data_path().


The full path to the Iris palette configuration directory


The [optional] name of the logger to notify when first imported.

In this module:


Control Iris NetCDF options.

↑ top ↑

iris.config.get_dir_option(section, option, default=None)[source]

Returns the directory path from the given option and section, or returns the given default value if the section/option is not present or does not represent a valid directory.

↑ top ↑

iris.config.get_logger(name, datefmt=None, fmt=None, level=None, propagate=None)[source]

Create a logging.Logger with a logging.StreamHandler and custom logging.Formatter.


  • name:

    The name of the logger. Typically this is the module filename that owns the logger.


  • datefmt:

    The date format string of the logging.Formatter. Defaults to %d-%m-%Y %H:%M:%S.

  • fmt:

    The additional format string of the logging.Formatter. This is appended to the default format string %(asctime)s %(name)s %(levelname)s - %(message)s.

  • level:

    The threshold level of the logger. Defaults to INFO.

  • propagate:

    Sets the propagate attribute of the logging.Logger, which determines whether events logged to this logger will be passed to the handlers of higher level loggers. Defaults to False.

↑ top ↑

iris.config.get_option(section, option, default=None)[source]

Returns the option value for the given section, or the default value if the section/option is not present.

↑ top ↑

Control Iris NetCDF options.

class iris.config.NetCDF(conventions_override=None)[source]

Set up NetCDF processing options for Iris.

Currently accepted kwargs:

  • conventions_override (bool):

    Define whether the CF Conventions version (e.g. CF-1.6) set when saving a cube to a NetCDF file should be defined by Iris (the default) or the cube being saved.

    If False (the default), specifies that Iris should set the CF Conventions version when saving cubes as NetCDF files. If True, specifies that the cubes being saved to NetCDF should set the CF Conventions version for the saved NetCDF files.

Example usages:

  • Specify, for the lifetime of the session, that we want all cubes written to NetCDF to define their own CF Conventions versions:

    iris.config.netcdf.conventions_override = True'my_cube', '')'my_second_cube', '')
  • Specify, with a context manager, that we want a cube written to NetCDF to define its own CF Conventions version:

    with iris.config.netcdf.context(conventions_override=True):'my_cube', '')

Allow temporary modification of the options via a context manager. Accepted kwargs are the same as can be supplied to the Option.