Satpy has two levels of configuration that allow to control how Satpy and its various components behave. There are a series of “settings” that change the global Satpy behavior. There are also a series of “component configuration” YAML files for controlling the complex functionality in readers, compositors, writers, and other Satpy components that can’t be controlled with traditional keyword arguments.
There are configuration parameters in Satpy that are not specific to one component and control more global behavior of Satpy. These parameters can be set in one of three ways:
At runtime with
This functionality is provided by the donfig library. The currently available settings are described below. Each option is available from all three methods. If specified as an environment variable or specified in the YAML file on disk, it must be set before Satpy is imported.
YAML files that include these parameters can be in any of the following locations:
<python environment prefix>/etc/satpy/satpy.yaml
<SATPY_CONFIG_PATH>/satpy.yaml(see Component Configuration Path below)
user_config_dir is provided by the
appdirs package and
differs by operating system. Typical user config directories are:
All YAML files found from the above paths will be merged into one
configuration object (accessed via
The YAML contents should be a simple mapping of configuration key to its
value. For example:
cache_dir: "/tmp" data_dir: "/tmp"
Lastly, it is possible to specify an additional config path to the above
options by setting the environment variable
SATPY_CONFIG. The file
specified with this environment variable will be added last after all of the
above paths have been merged together.
After import, the values can be customized at runtime by doing:
import satpy satpy.config.set(cache_dir="/my/new/cache/path") # ... normal satpy code ...
Or for specific blocks of code:
import satpy with satpy.config.set(cache_dir="/my/new/cache/path"): # ... some satpy code ... # ... code using the original cache_dir
Similarly, if you need to access one of the values you can
Default: See below
Directory where any files cached by Satpy will be stored. This directory is not necessarily cleared out by Satpy, but is rarely used without explicitly being enabled by the user. This defaults to a different path depending on your operating system following the appdirs “user cache dir”.
Component Configuration Path¶
Base directory, or directories, where Satpy component YAML configuration files
are stored. Satpy expects configuration files for specific component types to
be in appropriate subdirectories (ex.
writers, etc), but
these subdirectories should not be included in the
For example, if you have custom composites configured in
/my/config/dir/etc for Satpy to find this configuration file
when searching for composites. This option replaces the legacy
PPP_CONFIG_DIR environment variable.
Note that this value must be a list. In Python, this could be set by doing:
If setting an environment variable then it must be a colon-separated string and must be set before calling/importing Satpy. If the environment variable is a single path it will be converted to a list when Satpy is imported.
Satpy will always include the builtin configuration files that it is distributed with regardless of this setting. When a component supports merging of configuration files, they are merged in reverse order. This means “base” configuration paths should be at the end of the list and custom/user paths should be at the beginning of the list.
Default: See below
Directory where any data Satpy needs to perform certain operations will be
stored. This replaces the legacy
SATPY_ANCPATH environment variable. This
defaults to a different path depending on your operating system following the
“user data dir”.
Download Auxiliary Data¶
Whether to allow downloading of auxiliary files for certain Satpy operations.
See Auxiliary Data Download for more information. If
True then Satpy
will download and cache any necessary data files to Data Directory
when needed. If
False then pre-downloaded files will be used, but any
other files will not be downloaded or checked for validity.
Much of the functionality of Satpy comes from the various components it uses, like readers, writers, compositors, and enhancements. These components are configured for reuse from YAML files stored inside Satpy or in custom user configuration files. Custom directories can be provided by specifying the config_path setting mentioned above.
To create and use your own custom component configuration you should:
Create a directory to store your new custom YAML configuration files. The files for each component will go in a subdirectory specific to that component (ex.
Set the Satpy config_path to point to your new directory. This could be done by setting the environment variable
SATPY_CONFIG_PATHto your custom directory (don’t include the component sub-directory) or one of the other methods for setting this path.
Create YAML configuration files with your custom YAML files. In most cases there is no need to copy configuration from the builtin Satpy files as these will be merged with your custom files.
If your custom configuration uses custom Python code, this code must be importable by Python. This means your code must either be installed in your Python environment or you must set your
PYTHONPATHto the location of the modules.
Run your Satpy code and access your custom components like any of the builtin components.