satpy.composites.aux_data module

Compositors using auxiliary data.

class satpy.composites.aux_data.StaticImageCompositor(name, filename=None, url=None, known_hash=None, area=None, **kwargs)[source]

Bases: GenericCompositor, DataDownloadMixin

A compositor that loads a static image from disk.

Environment variables in the filename are automatically expanded.

Collect custom configuration values.

Parameters:
  • filename (str) – Name to use when storing and referring to the file in the data_dir cache. If url is provided (preferred), then this is used as the filename in the cache and will be appended to <data_dir>/composites/<class_name>/. If url is provided and filename is not then the filename will be guessed from the url. If url is not provided, then it is assumed filename refers to a local file. If the filename does not come with an absolute path, data_dir will be used as the directory path. Environment variables are expanded.

  • url (str) – URL to remote file. When the composite is created the file will be downloaded and cached in Satpy’s data_dir. Environment variables are expanded.

  • known_hash (str or None) – Hash of the remote file used to verify a successful download. If not provided then the download will not be verified. See satpy.aux_download.register_file() for more information.

  • area (str) – Name of area definition for the image. Optional for images with built-in area definitions (geotiff).

Use cases:
  1. url + no filename: Satpy determines the filename based on the filename in the URL, then downloads the URL, and saves it to <data_dir>/<filename>. If the file already exists and known_hash is also provided, then the pooch library compares the hash of the file to the known_hash. If it does not match, then the URL is re-downloaded. If it matches then no download.

  2. url + relative filename: Same as case 1 but filename is already provided so download goes to <data_dir>/<filename>. Same hashing behavior. This does not check for an absolute path.

  3. No url + absolute filename: No download, filename is passed directly to generic_image reader. No hashing is done.

  4. No url + relative filename: Check if <data_dir>/<filename> exists. If it does then make filename an absolute path. If it doesn’t, then keep it as is and let the exception at the bottom of the method get raised.

__init__(name, filename=None, url=None, known_hash=None, area=None, **kwargs)[source]

Collect custom configuration values.

Parameters:
  • filename (str) – Name to use when storing and referring to the file in the data_dir cache. If url is provided (preferred), then this is used as the filename in the cache and will be appended to <data_dir>/composites/<class_name>/. If url is provided and filename is not then the filename will be guessed from the url. If url is not provided, then it is assumed filename refers to a local file. If the filename does not come with an absolute path, data_dir will be used as the directory path. Environment variables are expanded.

  • url (str) – URL to remote file. When the composite is created the file will be downloaded and cached in Satpy’s data_dir. Environment variables are expanded.

  • known_hash (str or None) – Hash of the remote file used to verify a successful download. If not provided then the download will not be verified. See satpy.aux_download.register_file() for more information.

  • area (str) – Name of area definition for the image. Optional for images with built-in area definitions (geotiff).

Use cases:
  1. url + no filename: Satpy determines the filename based on the filename in the URL, then downloads the URL, and saves it to <data_dir>/<filename>. If the file already exists and known_hash is also provided, then the pooch library compares the hash of the file to the known_hash. If it does not match, then the URL is re-downloaded. If it matches then no download.

  2. url + relative filename: Same as case 1 but filename is already provided so download goes to <data_dir>/<filename>. Same hashing behavior. This does not check for an absolute path.

  3. No url + absolute filename: No download, filename is passed directly to generic_image reader. No hashing is done.

  4. No url + relative filename: Check if <data_dir>/<filename> exists. If it does then make filename an absolute path. If it doesn’t, then keep it as is and let the exception at the bottom of the method get raised.

_check_filename(filename, url)[source]
static _check_relative_filename(filename)[source]
_check_url(url, filename)[source]
_get_cache_filename_and_url(filename, url)[source]
_retrieve_data_file()[source]
register_data_files(data_files)[source]

Tell Satpy about files we may want to download.