iris.config¶
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
.
- iris.config.TEST_DATA_DIR¶
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()
.
- iris.config.PALETTE_PATH¶
The full path to the Iris palette configuration directory
- iris.config.IMPORT_LOGGER¶
The [optional] name of the logger to notify when first imported.
In this module:
- iris.config.netcdf¶
Control Iris NetCDF options.
- 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.
- iris.config.get_logger(name, datefmt=None, fmt=None, level=None, propagate=None)[source]¶
Create a
logging.Logger
with alogging.StreamHandler
and customlogging.Formatter
.Args:
- name:
The name of the logger. Typically this is the module filename that owns the logger.
Kwargs:
- 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 thelogging.Logger
, which determines whether events logged to this logger will be passed to the handlers of higher level loggers. Defaults toFalse
.
- 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.
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 iris.save('my_cube', 'my_dataset.nc') iris.save('my_second_cube', 'my_second_dataset.nc')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): iris.save('my_cube', 'my_dataset.nc')