Composites are defined as arrays of data that are created by processing and/or combining one or multiple data arrays (prerequisites) together.

Composites are generated in satpy using Compositor classes. The attributes of the resulting composites are usually a combination of the prerequisites’ attributes and the key/values of the DataID used to identify it.

Built-in Compositors

There are several built-in compositors available in SatPy. All of them use the GenericCompositor base class which handles various image modes (L, LA, RGB, and RGBA at the moment) and updates attributes.

The below sections summarize the composites that come with SatPy and show basic examples of creating and using them with an existing Scene object. It is recommended that any composites that are used repeatedly be configured in YAML configuration files. General-use compositor code dealing with visible or infrared satellite data can be put in a configuration file called visir.yaml. Composites that are specific to an instrument can be placed in YAML config files named accordingly (e.g., seviri.yaml or viirs.yaml). See the satpy repository for more examples.


GenericCompositor class can be used to create basic single channel and RGB composites. For example, building an overview composite can be done manually within Python code with:

>>> from satpy.composites import GenericCompositor
>>> compositor = GenericCompositor("overview")
>>> composite = compositor([local_scene[0.6],
...                         local_scene[0.8],
...                         local_scene[10.8]])

One important thing to notice is that there is an internal difference between a composite and an image. A composite is defined as a special dataset which may have several bands (like R, G and B bands). However, the data isn’t stretched, or clipped or gamma filtered until an image is generated. To get an image out of the above composite:

>>> from satpy.writers import to_image
>>> img = to_image(composite)
>>> img.invert([False, False, True])
>>> img.stretch("linear")
>>> img.gamma(1.7)

This part is called enhancement, and is covered in more detail in Enhancements.


DifferenceCompositor calculates a difference of two datasets:

>>> from satpy.composites import DifferenceCompositor
>>> compositor = DifferenceCompositor("diffcomp")
>>> composite = compositor([local_scene[10.8], local_scene[12.0]])


FillingCompositor:: fills the missing values in three datasets with the values of another dataset::

>>> from satpy.composites import FillingCompositor
>>> compositor = FillingCompositor("fillcomp")
>>> filler = local_scene[0.6]
>>> data_with_holes_1 = local_scene['ch_a']
>>> data_with_holes_2 = local_scene['ch_b']
>>> data_with_holes_3 = local_scene['ch_c']
>>> composite = compositor([filler, data_with_holes_1, data_with_holes_2,
...                         data_with_holes_3])


PaletteCompositor creates a color version of a single channel categorical dataset using a colormap:

>>> from satpy.composites import PaletteCompositor
>>> compositor = PaletteCompositor("palcomp")
>>> composite = compositor([local_scene['cma'], local_scene['cma_pal']])

The palette should have a single entry for all the (possible) values in the dataset mapping the value to an RGB triplet. Typically the palette comes with the categorical (e.g. cloud mask) product that is being visualized.


DayNightCompositor merges two different composites. The first composite will be placed on the day-side of the scene, and the second one on the night side. The transition from day to night is done by calculating solar zenith angle (SZA) weighed average of the two composites. The SZA can optionally be given as third dataset, and if not given, the angles will be calculated. Three arguments are used to generate the image (default values shown in the example below). They can be defined when initializing the compositor:

- lim_low (float): lower limit of Sun zenith angle for the
                   blending of the given channels
- lim_high (float): upper limit of Sun zenith angle for the
                    blending of the given channels
                    Together with `lim_low` they define the width
                    of the blending zone
- day_night (string): "day_night" means both day and night portions will be kept
                      "day_only" means only day portion will be kept
                      "night_only" means only night portion will be kept

Usage (with default values):

>>> from satpy.composites import DayNightCompositor
>>> compositor = DayNightCompositor("dnc", lim_low=85., lim_high=88., day_night="day_night")
>>> composite = compositor([local_scene['true_color'],
...                         local_scene['night_fog']])

As above, with day_night flag it is also available to use only a day product or only a night product and mask out (make transparent) the opposite portion of the image (night or day). The example below provides only a day product with night portion masked-out:

>>> from satpy.composites import DayNightCompositor
>>> compositor = DayNightCompositor("dnc", lim_low=85., lim_high=88., day_night="day_only")
>>> composite = compositor([local_scene['true_color'])


RealisticColors compositor is a special compositor that is used to create realistic near-true-color composite from MSG/SEVIRI data:

>>> from satpy.composites import RealisticColors
>>> compositor = RealisticColors("realcols", lim_low=85., lim_high=95.)
>>> composite = compositor([local_scene['VIS006'],
...                         local_scene['VIS008'],
...                         local_scene['HRV']])


CloudCompositor can be used to threshold the data so that “only” clouds are visible. These composites can be used as an overlay on top of e.g. static terrain images to show a rough idea where there are clouds. The data are thresholded using three variables:

- `transition_min`: values below or equal to this are clouds -> opaque white
- `transition_max`: values above this are cloud free -> transparent
- `transition_gamma`: gamma correction applied to clarify the clouds

Usage (with default values):

>>> from satpy.composites import CloudCompositor
>>> compositor = CloudCompositor("clouds", transition_min=258.15,
...                              transition_max=298.15,
...                              transition_gamma=3.0)
>>> composite = compositor([local_scene[10.8]])

Support for using this compositor for VIS data, where the values for high/thick clouds tend to be in reverse order to brightness temperatures, is to be added.




SelfSharpenedRGB sharpens the RGB with ratio of a band with a strided version of itself.


LuminanceSharpeningCompositor replaces the luminance from an RGB composite with luminance created from reflectance data. If the resolutions of the reflectance data _and_ of the target area definition are higher than the base RGB, more details can be retrieved. This compositor can be useful also with matching resolutions, e.g. to highlight shadowing at cloudtops in colorized infrared composite.

>>> from satpy.composites import LuminanceSharpeningCompositor
>>> compositor = LuminanceSharpeningCompositor("vis_sharpened_ir")
>>> vis_data = local_scene['HRV']
>>> colorized_ir_clouds = local_scene['colorized_ir_clouds']
>>> composite = compositor([vis_data, colorized_ir_clouds])


Similar to LuminanceSharpeningCompositor, SandwichCompositor uses reflectance data to bring out more details out of infrared or low-resolution composites. SandwichCompositor multiplies the RGB channels with (scaled) reflectance.

>>> from satpy.composites import SandwichCompositor
>>> compositor = SandwichCompositor("ir_sandwich")
>>> vis_data = local_scene['HRV']
>>> colorized_ir_clouds = local_scene['colorized_ir_clouds']
>>> composite = compositor([vis_data, colorized_ir_clouds])


StaticImageCompositor can be used to read an image from disk and used just like satellite data, including resampling and using as a part of other composites.

>>> from satpy.composites import StaticImageCompositor
>>> compositor = StaticImageCompositor("static_image", filename="image.tif")
>>> composite = compositor()


BackgroundCompositor can be used to stack two composites together. If the composites don’t have alpha channels, the background is used where foreground has no data. If foreground has alpha channel, the alpha values are used to weight when blending the two composites.

>>> from satpy import Scene
>>> from satpy.composites import BackgroundCompositor
>>> compositor = BackgroundCompositor()
>>> clouds = local_scene['ir_cloud_day']
>>> background = local_scene['overview']
>>> composite = compositor([clouds, background])


CategoricalDataCompositor can be used to recategorize categorical data. This is for example useful to combine comparable categories into a common category. The category remapping from data to composite is done using a look-up-table (lut):

composite = [[lut[data[0,0]], lut[data[0,1]], lut[data[0,Nj]]],
             [[lut[data[1,0]], lut[data[1,1]], lut[data[1,Nj]],
             [[lut[data[Ni,0]], lut[data[Ni,1]], lut[data[Ni,Nj]]]

Hence, lut must have a length that is greater than the maximum value in data in orer to avoid an IndexError. Below is an example on how to create a binary clear-sky/cloud mask from a pseodu cloud type product with six categories representing clear sky (cat1/cat5), cloudy features (cat2-cat4) and missing/undefined data (cat0):

>>> cloud_type = local_scene['cloud_type']  # 0 - cat0, 1 - cat1, 2 - cat2, 3 - cat3, 4 - cat4, 5 - cat5,
# categories: 0    1  2  3  4  5
>>> lut = [np.nan, 0, 1, 1, 1, 0]
>>> compositor = CategoricalDataCompositor('binary_cloud_mask', lut=lut)
>>> composite = compositor([cloud_type])  # 0 - cat1/cat5, 1 - cat2/cat3/cat4, nan - cat0

Creating composite configuration files

To save the custom composite, follow the Component Configuration documentation. Once your component configuration directory is created you can create your custom composite YAML configuration files. Compositors that can be used for multiple instruments can be placed in the generic $SATPY_CONFIG_PATH/composites/visir.yaml file. Composites that are specific to one sensor should be placed in $SATPY_CONFIG_PATH/composites/<sensor>.yaml. Custom enhancements for your new composites can be stored in $SATPY_CONFIG_PATH/enhancements/generic.yaml or $SATPY_CONFIG_PATH/enhancements/<sensor>.yaml.

With that, you should be able to load your new composite directly. Example configuration files can be found in the satpy repository as well as a few simple examples below.

Simple RGB composite

This is the overview composite shown in the first code example above using GenericCompositor:

sensor_name: visir

    compositor: !!python/name:satpy.composites.GenericCompositor
    - 0.6
    - 0.8
    - 10.8
    standard_name: overview

For an instrument specific version (here MSG/SEVIRI), we should use the channel _names_ instead of wavelengths. Note also that the sensor_name is now combination of visir and seviri, which means that it extends the generic visir composites:

sensor_name: visir/seviri


    compositor: !!python/name:satpy.composites.GenericCompositor
    - VIS006
    - VIS008
    - IR_108
    standard_name: overview

In the following examples only the composite receipes are shown, and the header information (sensor_name, composites) and intendation needs to be added.

Using modifiers

In many cases the basic datasets that go into the composite need to be adjusted, e.g. for Solar zenith angle normalization. These modifiers can be applied in the following way:

  compositor: !!python/name:satpy.composites.GenericCompositor
  - name: VIS006
    modifiers: [sunz_corrected]
  - name: VIS008
    modifiers: [sunz_corrected]
  - IR_108
  standard_name: overview

Here we see two changes:

  1. channels with modifiers need to have either name or wavelength added in front of the channel name or wavelength, respectively

  2. a list of modifiers attached to the dictionary defining the channel

The modifier above is a built-in that normalizes the Solar zenith angle to Sun being directly at the zenith.

More examples can be found in Satpy source code directory satpy/etc/composites.

See the Modifiers documentation for more information on available built-in modifiers.

Using other composites

Often it is handy to use other composites as a part of the composite. In this example we have one composite that relies on solar channels on the day side, and another for the night side:

  compositor: !!python/name:satpy.composites.DayNightCompositor
    - natural_color
    - night_fog
  standard_name: natural_with_night_fog

This compositor has three additional keyword arguments that can be defined (shown with the default values, thus identical result as above):

  compositor: !!python/name:satpy.composites.DayNightCompositor
    - natural_color
    - night_fog
  lim_low: 85.0
  lim_high: 88.0
  day_night: "day_night"
  standard_name: natural_with_night_fog

Defining other composites in-line

It is also possible to define sub-composites in-line. This example is the built-in airmass composite:

  compositor: !!python/name:satpy.composites.GenericCompositor
  - compositor: !!python/name:satpy.composites.DifferenceCompositor
    - wavelength: 6.2
    - wavelength: 7.3
  - compositor: !!python/name:satpy.composites.DifferenceCompositor
      - wavelength: 9.7
      - wavelength: 10.8
  - wavelength: 6.2
  standard_name: airmass

Using a pre-made image as a background

Below is an example composite config using StaticImageCompositor, DayNightCompositor, CloudCompositor and BackgroundCompositor to show how to create a composite with a blended day/night imagery as background for clouds. As the images are in PNG format, and thus not georeferenced, the name of the area definition for the background images are given. When using GeoTIFF images the area parameter can be left out.


The background blending uses the current time if there is no timestamps in the image filenames.

  compositor: !!python/name:satpy.composites.BackgroundCompositor
  standard_name: clouds_with_background
    - ir_cloud_day
    - compositor: !!python/name:satpy.composites.DayNightCompositor
        - static_day
        - static_night

  compositor: !!python/name:satpy.composites.StaticImageCompositor
  standard_name: static_day
  filename: /path/to/day_image.png
  area: euro4

  compositor: !!python/name:satpy.composites.StaticImageCompositor
  standard_name: static_night
  filename: /path/to/night_image.png
  area: euro4

To ensure that the images aren’t auto-stretched and possibly altered, the following should be added to enhancement config (assuming 8-bit image) for both of the static images:

  standard_name: static_day
  - name: stretch
    method: !!python/name:satpy.enhancements.stretch
      stretch: crude
      min_stretch: [0, 0, 0]
      max_stretch: [255, 255, 255]

Enhancing the images

After the composite is defined and created, it needs to be converted to an image. To do this, it is necessary to describe how the data values are mapped to values stored in the image format. This procedure is called stretching, and in SatPy it is implemented by enhancements.

The first step is to convert the composite to an XRImage object:

>>> from satpy.writers import to_image
>>> img = to_image(composite)

Now it is possible to apply enhancements available in the class:

>>> img.invert([False, False, True])
>>> img.stretch("linear")
>>> img.gamma(1.7)

And finally either show or save the image:


As pointed out in the composite section, it is better to define frequently used enhancements in configuration files under $SATPY_CONFIG_PATH/enhancements/. The enhancements can either be in generic.yaml or instrument-specific file (e.g., seviri.yaml).

The above enhancement can be written (with the headers necessary for the file) as:

    standard_name: overview
      - name: inverse
        method: !!python/name:satpy.enhancements.invert
        args: [False, False, True]
      - name: stretch
        method: !!python/name:satpy.enhancements.stretch
          stretch: linear
      - name: gamma
        method: !!python/name:satpy.enhancements.gamma
          gamma: [1.7, 1.7, 1.7]

More examples can be found in SatPy source code directory satpy/etc/enhancements/generic.yaml.

See the Enhancements documentation for more information on available built-in enhancements.


Modifiers are filters applied to datasets prior to computing composites. They take at least one input (a dataset) and have exactly one output (the same dataset, modified). They can take additional input datasets or parameters.

Modifiers are defined in composites files in etc/composites within $SATPY_CONFIG_PATH.

The instruction to use a certain modifier can be contained in a composite definition or in a reader definition. If it is defined in a composite definition, it is applied upon constructing the composite.

When using built-in composites, Satpy users do not need to understand the mechanics of modifiers, as they are applied automatically. The Composites documentation contains information on how to apply modifiers when creating new composites.

Some readers read data where certain modifiers are already applied. Here, the reader definition will refer to the Satpy modifier. This marking adds the modifier to the metadata to prevent it from being applied again upon composite calculation.

Commonly used modifiers are listed in the table below. Further details on those modifiers can be found in the linked API documentation.

Commonly used modifiers






Modifies solar channels for the solar zenith angle to provide smoother images.



Modifies solar channels for atmospheric path length of solar radiation.



Calculates reflective part of channels at the edge of solar and terrestrial radiation (3.7 µm or 3.9 µm).



Calculates emissive part of channels at the edge of solar and terrestrial radiation (3.7 µm or 3.9 µm)



Modifies solar channels to filter out the visual impact of rayleigh scattering.

A complete list can be found in the etc/composites source code and in the modifiers module documentation.