satpy.composites.fill module

Compositors filling one composite with others.

class satpy.composites.fill.BackgroundCompositor(name, common_channel_mask=True, **kwargs)[source]

Bases: GenericCompositor

A compositor that overlays one composite on top of another.

The output image mode will be determined by both foreground and background. Generally, when the background has an alpha band, the output image will also have one.

Foreground

Background

Result

L

L

L

L

LA

LA

L

RGB

RGB

L

RGBA

RGBA

LA

L

L

LA

LA

LA

LA

RGB

RGB

LA

RGBA

RGBA

RGB

L

RGB

RGB

LA

RGBA

RGB

RGB

RGB

RGB

RGBA

RGBA

RGBA

L

RGB

RGBA

LA

RGBA

RGBA

RGB

RGB

RGBA

RGBA

RGBA

Collect custom configuration values.

Parameters:

common_channel_mask (bool) – If True, mask all the channels with a mask that combines all the invalid areas of the given data.

_combine_metadata_with_mode_and_sensor(foreground, background)[source]
Return type:

dict

static _get_merged_image_data(foreground, background, initial_bg_alpha)[source]
Return type:

list[DataArray]

static _simple_overlay(foreground, background)[source]
Return type:

list[DataArray]

class satpy.composites.fill.DayNightCompositor(name, lim_low=85.0, lim_high=88.0, day_night='day_night', include_alpha=True, **kwargs)[source]

Bases: GenericCompositor

A compositor that blends day data with night data.

Using the day_night flag it is also possible to provide only a day product or only a night product and mask out (make transparent) the opposite portion of the image (night or day). See the documentation below for more details.

Collect custom configuration values.

Parameters:
  • 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

  • day_night (str) – “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

  • include_alpha (bool) – This only affects the “day only” or “night only” result. True means an alpha band will be added to the output image for transparency. False means the output is a single-band image with undesired pixels being masked out (replaced with NaNs).

__init__(name, lim_low=85.0, lim_high=88.0, day_night='day_night', include_alpha=True, **kwargs)[source]

Collect custom configuration values.

Parameters:
  • 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

  • day_night (str) – “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

  • include_alpha (bool) – This only affects the “day only” or “night only” result. True means an alpha band will be added to the output image for transparency. False means the output is a single-band image with undesired pixels being masked out (replaced with NaNs).

_fill_weights(weights)[source]
_get_coszen_blending_weights(projectables)[source]
Return type:

DataArray

_get_data_for_combined_product(day_data, night_data)[source]
_get_data_for_single_side_product(foreground_data, weights)[source]
Return type:

tuple[DataArray, DataArray, DataArray]

_get_day_night_data_for_single_side_product(foreground_data)[source]
_is_weightable(band)[source]
_mask_weights(weights)[source]
_mask_weights_with_data(weights, day_data, night_data)[source]
Return type:

DataArray

_merge_bands_with_weights(day_data, night_data, weights, attrs)[source]
_weight_data(day_data, night_data, weights, attrs)[source]
Return type:

list[DataArray]

class satpy.composites.fill.Filler(name, common_channel_mask=True, **kwargs)[source]

Bases: GenericCompositor

Fix holes in projectable 1 with data from projectable 2.

Collect custom configuration values.

Parameters:

common_channel_mask (bool) – If True, mask all the channels with a mask that combines all the invalid areas of the given data.

class satpy.composites.fill.FillingCompositor(name, common_channel_mask=True, **kwargs)[source]

Bases: GenericCompositor

Make a regular RGB, filling the RGB bands with the first provided dataset’s values.

Collect custom configuration values.

Parameters:

common_channel_mask (bool) – If True, mask all the channels with a mask that combines all the invalid areas of the given data.

class satpy.composites.fill.MultiFiller(name, prerequisites=None, optional_prerequisites=None, **kwargs)[source]

Bases: SingleBandCompositor

Fix holes in projectable 1 with data from the next projectables.

Initialise the compositor.

satpy.composites.fill._get_alpha(dataset)[source]
satpy.composites.fill._get_band_names(day_data, night_data)[source]
satpy.composites.fill._get_single_band_data(data, band)[source]
satpy.composites.fill._get_single_channel(data)[source]
Return type:

DataArray

satpy.composites.fill._get_weight_mask_for_daynight_product(weights, data_a, data_b)[source]
satpy.composites.fill._get_weight_mask_for_single_side_product(data_a, data_b)[source]
satpy.composites.fill.add_alpha_bands(data)[source]

Only used for DayNightCompositor.

Add an alpha band to L or RGB composite as prerequisites for the following band matching to make the masked-out area transparent.

satpy.composites.fill.zero_missing_data(data1, data2)[source]

Replace NaN values with zeros in data1 if the data is valid in data2.