satpy.composites.lookup module

Compositors using lookup tables.

class satpy.composites.lookup.CategoricalDataCompositor(name, lut=None, **kwargs)[source]

Bases: CompositeBase

Compositor used to recategorize categorical data using a look-up-table.

Each value in the data array will be recategorized to a new category defined in the look-up-table using the original value as an index for that look-up-table.

Example

data = [[1, 3, 2], [4, 2, 0]] lut = [10, 20, 30, 40, 50] res = [[20, 40, 30], [50, 30, 10]]

Get look-up-table used to recategorize data.

Parameters:

lut (list) – a list of new categories. The lenght must be greater than the maximum value in the data array that should be recategorized.

__init__(name, lut=None, **kwargs)[source]

Get look-up-table used to recategorize data.

Parameters:

lut (list) – a list of new categories. The lenght must be greater than the maximum value in the data array that should be recategorized.

static _getitem(block, lut)[source]
_update_attrs(new_attrs)[source]

Modify name and add LUT.

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

Bases: ColormapCompositor

A compositor colorizing the data, interpolating the palette colors when needed.

Warning

Deprecated since Satpy 0.39. See the ColormapCompositor docstring for documentation on the alternative.

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.

static _apply_colormap(colormap, data, palette)[source]
class satpy.composites.lookup.ColormapCompositor(name, common_channel_mask=True, **kwargs)[source]

Bases: GenericCompositor

A compositor that uses colormaps.

Warning

Deprecated since Satpy 0.39.

This compositor is deprecated. To apply a colormap, use a satpy.composites.core.SingleBandCompositor composite with a colorize() or palettize() enhancement instead. For example, to make a cloud_top_height composite based on a dataset ctth_alti palettized by ctth_alti_pal, the composite would be:

cloud_top_height:
  compositor: !!python/name:satpy.composites.core.SingleBandCompositor
  prerequisites:
  - ctth_alti
  tandard_name: cloud_top_height

and the enhancement:

cloud_top_height:
  standard_name: cloud_top_height
  operations:
  - name: palettize
    method: !!python/name:satpy.enhancements.colormap.palettize
    kwargs:
      palettes:
        - dataset: ctth_alti_pal
          color_scale: 255
          min_value: 0
          max_value: 255

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.

_create_composite_from_channels(channels, template)[source]
static _create_masked_dataarray_like(array, template, mask)[source]
static _get_mask_from_data(data)[source]
static build_colormap(palette, dtype, info)[source]

Create the colormap from the raw_palette and the valid_range.

Colormaps come in different forms, but they are all supposed to have color values between 0 and 255. The following cases are considered:

  • Palettes comprised of only a list of colors. If dtype is uint8, the values of the colormap are the enumeration of the colors. Otherwise, the colormap values will be spread evenly from the min to the max of the valid_range provided in info.

  • Palettes that have a palette_meanings attribute. The palette meanings will be used as values of the colormap.

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

Bases: ColormapCompositor

A compositor colorizing the data, not interpolating the palette colors.

Warning

Deprecated since Satpy 0.39. See the ColormapCompositor docstring for documentation on the alternative.

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.

static _apply_colormap(colormap, data, palette)[source]
satpy.composites.lookup._insert_palette_colors(channels, palette)[source]