satpy.composites package

Submodules

satpy.composites.abi module

Composite classes for the ABI instrument.

class satpy.composites.abi.SimulatedGreen(name, fractions=0.465, 0.465, 0.07, **kwargs)[source]

Bases: satpy.composites.GenericCompositor

A single-band dataset resembling a Green (0.55 µm) band.

This compositor creates a single band product by combining three other bands in various amounts. The general formula with dependencies (d) and fractions (f) is:

result = d1 * f1 + d2 * f2 + d3 * f3

See the fractions keyword argument for more information. Common used fractions for ABI data with C01, C02, and C03 inputs include:

  • SatPy default (historical): (0.465, 0.465, 0.07)

  • CIMSS (Kaba): (0.45, 0.45, 0.10)

  • EDC: (0.45706946, 0.48358168, 0.06038137)

Initialize fractions for input channels.

Parameters
  • name (str) – Name of this composite

  • fractions (iterable) – Fractions of each input band to include in the result.

satpy.composites.ahi module

Composite classes for the AHI instrument.

class satpy.composites.ahi.GreenCorrector(*args, **kwargs)[source]

Bases: satpy.composites.GenericCompositor

Corrector of the AHI green band to compensate for the deficit of chlorophyll signal.

Set default keyword argument values.

satpy.composites.cloud_products module

Compositors for cloud products.

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

Bases: satpy.composites.ColormapCompositor

Colorize with a palette, put cloud-free pixels as black.

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 build_colormap(palette, info)[source]

Create the colormap from the raw_palette and the valid_range.

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

Bases: satpy.composites.GenericCompositor

Precipitation clouds compositor.

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.

satpy.composites.crefl_utils module

Shared utilities for correcting reflectance data using the ‘crefl’ algorithm.

Original code written by Ralph Kuehn with modifications by David Hoese and Martin Raspaud. Ralph’s code was originally based on the C crefl code distributed for VIIRS and MODIS.

satpy.composites.crefl_utils.G_calc(zenith, a_coeff)[source]
satpy.composites.crefl_utils.atm_variables_finder(mus, muv, phi, height, tau, tO3, tH2O, taustep4sphalb, tO2=1.0)[source]
satpy.composites.crefl_utils.chand(phi, muv, mus, taur)[source]
satpy.composites.crefl_utils.csalbr(tau)[source]
satpy.composites.crefl_utils.find_coefficient_index(sensor, wavelength_range, resolution=0)[source]

Return index in to coefficient arrays for this band’s wavelength.

This function search through the COEFF_INDEX_MAP dictionary and finds the first key where the nominal wavelength of wavelength_range falls between the minimum wavelength and maximum wavelength of the key. wavelength_range can also be the standard name of the band. For example, “M05” for VIIRS or “1” for MODIS.

Parameters
  • sensor – sensor of band to be corrected

  • wavelength_range – 3-element tuple of (min wavelength, nominal wavelength, max wavelength)

  • resolution – resolution of the band to be corrected

Returns

index in to coefficient arrays like aH2O, aO3, etc. None is returned if no matching wavelength is found

satpy.composites.crefl_utils.get_atm_variables(mus, muv, phi, height, ah2o, bh2o, ao3, tau)[source]
satpy.composites.crefl_utils.get_atm_variables_abi(mus, muv, phi, height, G_O3, G_H2O, G_O2, ah2o, ao2, ao3, tau)[source]
satpy.composites.crefl_utils.get_coefficients(sensor, wavelength_range, resolution=0)[source]
Parameters
  • sensor – sensor of the band to be corrected

  • wavelength_range – 3-element tuple of (min wavelength, nominal wavelength, max wavelength)

  • resolution – resolution of the band to be corrected

Returns

aH2O, bH2O, aO3, taur0 coefficient values

satpy.composites.crefl_utils.run_crefl(refl, coeffs, lon, lat, sensor_azimuth, sensor_zenith, solar_azimuth, solar_zenith, avg_elevation=None, percent=False, use_abi=False)[source]

Run main crefl algorithm.

All input parameters are per-pixel values meaning they are the same size and shape as the input reflectance data, unless otherwise stated.

Parameters
  • reflectance_bands – tuple of reflectance band arrays

  • coefficients – tuple of coefficients for each band (see get_coefficients)

  • lon – input swath longitude array

  • lat – input swath latitude array

  • sensor_azimuth – input swath sensor azimuth angle array

  • sensor_zenith – input swath sensor zenith angle array

  • solar_azimuth – input swath solar azimuth angle array

  • solar_zenith – input swath solar zenith angle array

  • avg_elevation – average elevation (usually pre-calculated and stored in CMGDEM.hdf)

  • percent – True if input reflectances are on a 0-100 scale instead of 0-1 scale (default: False)

satpy.composites.sar module

Composite classes for the VIIRS instrument.

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

Bases: satpy.composites.GenericCompositor

The SAR Ice composite.

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.sar.SARIceLegacy(name, common_channel_mask=True, **kwargs)[source]

Bases: satpy.composites.GenericCompositor

The SAR Ice composite, legacy version with dynamic stretching.

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.sar.SARQuickLook(name, common_channel_mask=True, **kwargs)[source]

Bases: satpy.composites.GenericCompositor

The SAR QuickLook composite.

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.sar.SARRGB(name, common_channel_mask=True, **kwargs)[source]

Bases: satpy.composites.GenericCompositor

The SAR RGB composite.

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.

satpy.composites.sar.overlay(top, bottom, maxval=None)[source]

Blending two layers.

from: https://docs.gimp.org/en/gimp-concepts-layer-modes.html

satpy.composites.viirs module

Composite classes for the VIIRS instrument.

class satpy.composites.viirs.AdaptiveDNB(*args, **kwargs)[source]

Bases: satpy.composites.viirs.HistogramDNB

Adaptive histogram equalized DNB composite.

The logic for this code was taken from Polar2Grid and was originally developed by Eva Schiffer (SSEC).

This composite separates the DNB data in to 3 main regions: Day, Night, and Mixed. Each region is equalized separately to bring out the most information from the region due to the high dynamic range of the DNB data. Optionally, the mixed region can be separated in to multiple smaller regions by using the mixed_degree_step keyword.

Initialize the compositor with values from the user or from the configuration file.

Adaptive histogram equalization and regular histogram equalization can be configured independently for each region: day, night, or mixed. A region can be set to use adaptive equalization “always”, or “never”, or only when there are multiple regions in a single scene “multiple” via the adaptive_X keyword arguments (see below).

Parameters
  • adaptive_day – one of (“always”, “multiple”, “never”) meaning when adaptive equalization is used.

  • adaptive_mixed – one of (“always”, “multiple”, “never”) meaning when adaptive equalization is used.

  • adaptive_night – one of (“always”, “multiple”, “never”) meaning when adaptive equalization is used.

class satpy.composites.viirs.ERFDNB(*args, **kwargs)[source]

Bases: satpy.composites.CompositeBase

Equalized DNB composite using the error function (erf).

The logic for this code was taken from Polar2Grid and was originally developed by Curtis Seaman and Steve Miller. The original code was written in IDL and is included as comments in the code below.

Initialize ERFDNB specific keyword arguments.

class satpy.composites.viirs.HistogramDNB(*args, **kwargs)[source]

Bases: satpy.composites.CompositeBase

Histogram equalized DNB composite.

The logic for this code was taken from Polar2Grid and was originally developed by Eva Schiffer (SSEC).

This composite separates the DNB data in to 3 main regions: Day, Night, and Mixed. Each region is equalized separately to bring out the most information from the region due to the high dynamic range of the DNB data. Optionally, the mixed region can be separated in to multiple smaller regions by using the mixed_degree_step keyword.

Initialize the compositor with values from the user or from the configuration file.

Parameters
  • high_angle_cutoff – solar zenith angle threshold in degrees, values above this are considered “night”

  • low_angle_cutoff – solar zenith angle threshold in degrees, values below this are considered “day”

  • mixed_degree_step – Step interval to separate “mixed” region in to multiple parts by default does whole mixed region

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

Bases: satpy.composites.CompositeBase

Equalized DNB composite using the Zinke algorithm 1.

References

1

Stephan Zinke (2017),

A simplified high and near-constant contrast approach for the display of VIIRS day/night band imagery DOI:10.1080/01431161.2017.1338838

Initialise the compositor.

gain_factor(theta)[source]

Compute gain factor in a dask-friendly manner.

class satpy.composites.viirs.ReflectanceCorrector(*args, **kwargs)[source]

Bases: satpy.composites.CompositeBase

Corrected Reflectance (crefl) modifier.

Uses a python rewrite of the C CREFL code written for VIIRS and MODIS.

Initialize the compositor with values from the user or from the configuration file.

If dem_filename can’t be found or opened then correction is done assuming TOA or sealevel options.

Parameters
  • dem_filename – path to the ancillary ‘averaged heights’ file default: CMGDEM.hdf environment override: os.path.join(<SATPY_ANCPATH>, <CREFL_ANCFILENAME>)

  • dem_sds – variable name to load from the ancillary file

get_angles(vis)[source]

Get sun and satellite angles to use in crefl calculations.

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

Bases: satpy.composites.GenericCompositor

Create RGB snow product.

Product is based on method presented at the second CSPP/IMAPP users’ meeting at Eumetsat in Darmstadt on 14-16 April 2015

# Bernard Bellec snow Look-Up Tables V 1.0 (c) Meteo-France # These Look-up Tables allow you to create the RGB snow product # for SUOMI-NPP VIIRS Imager according to the algorithm # presented at the second CSPP/IMAPP users’ meeting at Eumetsat # in Darmstadt on 14-16 April 2015 # The algorithm and the product are described in this # presentation : # http://www.ssec.wisc.edu/meetings/cspp/2015/Agenda%20PDF/Wednesday/Roquet_snow_product_cspp2015.pdf # For further information you may contact # Bernard Bellec at Bernard.Bellec@meteo.fr # or # Pascale Roquet at Pascale.Roquet@meteo.fr

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.viirs.VIIRSFog(name, prerequisites=None, optional_prerequisites=None, **kwargs)[source]

Bases: satpy.composites.CompositeBase

A simple temperature difference composite for showing fog.

Initialise the compositor.

satpy.composites.viirs.histogram_equalization(data, mask_to_equalize, number_of_bins=1000, std_mult_cutoff=4.0, do_zerotoone_normalization=True, valid_data_mask=None, clip_limit=None, slope_limit=None, do_log_scale=False, log_offset=None, local_radius_px=None, out=None)[source]

Perform a histogram equalization on the data.

Data is selected by the mask_to_equalize mask. The data will be separated into number_of_bins levels for equalization and outliers beyond +/- std_mult_cutoff*std will be ignored.

If do_zerotoone_normalization is True the data selected by mask_to_equalize will be returned in the 0 to 1 range. Otherwise the data selected by mask_to_equalize will be returned in the 0 to number_of_bins range.

Note: the data will be changed in place.

satpy.composites.viirs.local_histogram_equalization(data, mask_to_equalize, valid_data_mask=None, number_of_bins=1000, std_mult_cutoff=3.0, do_zerotoone_normalization=True, local_radius_px=300, clip_limit=60.0, slope_limit=3.0, do_log_scale=True, log_offset=1e-05, out=None)[source]

Equalize the provided data (in the mask_to_equalize) using adaptive histogram equalization.

Tiles of width/height (2 * local_radius_px + 1) will be calculated and results for each pixel will be bilinearly interpolated from the nearest 4 tiles when pixels fall near the edge of the image (there is no adjacent tile) the resultant interpolated sum from the available tiles will be multiplied to account for the weight of any missing tiles:

pixel total interpolated value = pixel available interpolated value / (1 - missing interpolation weight)

If do_zerotoone_normalization is True the data will be scaled so that all data in the mask_to_equalize falls between 0 and 1; otherwise the data in mask_to_equalize will all fall between 0 and number_of_bins.

Returns: The equalized data

satpy.composites.viirs.make_day_night_masks(solarZenithAngle, good_mask, highAngleCutoff, lowAngleCutoff, stepsDegrees=None)[source]

Generate masks for day, night, and twilight regions.

Masks are created from the provided solar zenith angle data.

Optionally provide the highAngleCutoff and lowAngleCutoff that define the limits of the terminator region (if no cutoffs are given the DEFAULT_HIGH_ANGLE and DEFAULT_LOW_ANGLE will be used).

Optionally provide the stepsDegrees that define how many degrees each “mixed” mask in the terminator region should be (if no stepsDegrees is given, the whole terminator region will be one mask).

Module contents

Base classes for composite objects.

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

Bases: satpy.composites.GenericCompositor

A compositor that overlays one composite on top of another.

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.CO2Corrector(name, prerequisites=None, optional_prerequisites=None, **kwargs)[source]

Bases: satpy.composites.CompositeBase

Correct for CO2.

Initialise the compositor.

class satpy.composites.CloudCompositor(name, transition_min=258.15, transition_max=298.15, transition_gamma=3.0, **kwargs)[source]

Bases: satpy.composites.GenericCompositor

Detect clouds based on thresholding and use it as a mask for compositing.

Collect custom configuration values.

Parameters
  • transition_min (float) – Values below or equal to this are clouds -> opaque white

  • transition_max (float) – Values above this are cloud free -> transparent

  • transition_gamma (float) – Gamma correction to apply at the end

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

Bases: satpy.composites.ColormapCompositor

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

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.ColormapCompositor(name, common_channel_mask=True, **kwargs)[source]

Bases: satpy.composites.GenericCompositor

A compositor that uses colormaps.

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 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 on colors. If dtype is uint8,

the values of the colormap are the enumaration 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.CompositeBase(name, prerequisites=None, optional_prerequisites=None, **kwargs)[source]

Bases: satpy.dataset.MetadataObject

Base class for all compositors and modifiers.

Initialise the compositor.

apply_modifier_info(origin, destination)[source]

Apply the modifier info from origin to destination.

check_areas(data_arrays)[source]

Check that the areas of the data_arrays are compatible.

check_geolocation(data_arrays)[source]

Check that the geolocations of the data_arrays are compatible.

drop_coordinates(data_arrays)[source]

Drop neglible non-dimensional coordinates.

match_data_arrays(data_arrays)[source]

Match data arrays so that they can be used together in a composite.

class satpy.composites.CompositorLoader(ppp_config_dir=None)[source]

Bases: object

Read composites using the configuration files on disk.

Initialize the compositor loader.

get_compositor(key, sensor_names)[source]

Get the modifier for sensor_names.

get_modifier(key, sensor_names)[source]

Get the modifier for sensor_names.

load_compositors(sensor_names)[source]

Load all compositor configs for the provided sensors.

Parameters

sensor_names (list of strings) – Sensor names that have matching sensor_name.yaml config files.

Returns

Where comps is a dictionary:

sensor_name -> composite ID -> compositor object

And mods is a dictionary:

sensor_name -> modifier name -> (modifier class, modifiers options)

Note that these dictionaries are copies of those cached in this object.

Return type

(comps, mods)

load_sensor_composites(sensor_name)[source]

Load all compositor configs for the provided sensor.

class satpy.composites.DayNightCompositor(name, lim_low=85.0, lim_high=88.0, **kwargs)[source]

Bases: satpy.composites.GenericCompositor

A compositor that blends a day data with night data.

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

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

Bases: satpy.composites.CompositeBase

Make the difference of two data arrays.

Initialise the compositor.

class satpy.composites.EffectiveSolarPathLengthCorrector(correction_limit=88.0, **kwargs)[source]

Bases: satpy.composites.SunZenithCorrectorBase

Special sun zenith correction with the method proposed by Li and Shibata.

(2006): https://doi.org/10.1175/JAS3682.1

In addition to adjusting the provided reflectances by the cosine of the solar zenith angle, this modifier forces all reflectances beyond a solar zenith angle of max_sza to 0 to reduce noise in the final data. It also gradually reduces the amount of correction done between correction_limit and max_sza. If max_sza is None then a constant correction is applied to zenith angles beyond correction_limit.

To set max_sza to None in a YAML configuration file use:

effective_solar_pathlength_corrected:
  compositor: !!python/name:satpy.composites.EffectiveSolarPathLengthCorrector
  max_sza: !!null
  optional_prerequisites:
  - solar_zenith_angle

Collect custom configuration values.

Parameters
  • correction_limit (float) – Maximum solar zenith angle to apply the correction in degrees. Pixels beyond this limit have a constant correction applied. Default 88.

  • max_sza (float) – Maximum solar zenith angle in degrees that is considered valid and correctable. Default 95.0.

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

Bases: satpy.composites.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.FillingCompositor(name, common_channel_mask=True, **kwargs)[source]

Bases: satpy.composites.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.GenericCompositor(name, common_channel_mask=True, **kwargs)[source]

Bases: satpy.composites.CompositeBase

Basic colored composite builder.

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.

classmethod infer_mode(data_arr)[source]

Guess at the mode for a particular DataArray.

modes = {1: 'L', 2: 'LA', 3: 'RGB', 4: 'RGBA'}
exception satpy.composites.IncompatibleAreas[source]

Bases: Exception

Error raised upon compositing things of different shapes.

exception satpy.composites.IncompatibleTimes[source]

Bases: Exception

Error raised upon compositing things from different times.

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

Bases: satpy.composites.GenericCompositor

Create a high resolution composite by sharpening a low resolution using high resolution luminance.

This is done by converting to YCbCr colorspace, replacing Y, and convertin back to RGB.

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.MaskingCompositor(name, transparency=None, conditions=None, **kwargs)[source]

Bases: satpy.composites.GenericCompositor

A compositor that masks e.g. IR 10.8 channel data using cloud products from NWC SAF.

Collect custom configuration values.

Kwargs:
transparency (dict): transparency for each cloud type as

key-value pairs in a dictionary. Will be converted to conditions. DEPRECATED.

conditions (list): list of three items determining the masking

settings.

Each condition in conditions consists of of three items: - method: Numpy method name. The following are supported

operations: less, less_equal, equal, greater_equal, greater, not_equal, isnan, isfinite, isinf,

isneginf, isposinf

  • value: threshold value of the mask applied with the operator. Can be a string, in which case the corresponding value will be determined from flag_meanings and flag_values attributes of the mask. NOTE: the value should not be given to ‘is*` methods.

  • transparency: transparency from interval [0 … 100] used for the method/threshold. Value of 100 is fully transparent.

Example:

>>> conditions = [{'method': 'greater_equal', 'value': 0,
                   'transparency': 100},
                  {'method': 'greater_equal', 'value': 1,
                   'transparency': 80},
                  {'method': 'greater_equal', 'value': 2,
                   'transparency': 0},
                  {'method': 'isnan',
                   'transparency': 100}]
>>> compositor = MaskingCompositor("masking compositor",
                                   transparency=transparency)
>>> result = compositor([data, mask])

This will set transparency of data based on the values in the mask dataset. Locations where mask has values of 0 will be fully transparent, locations with 1 will be semi-transparent and locations with 2 will be fully visible in the resulting image. In the end all NaN areas in the mask are set to full transparency. All the unlisted locations will be visible.

The transparency is implemented by adding an alpha layer to the composite. The locations with transparency of 100 will be set to NaN in the data. If the input data contains an alpha channel, it will be discarded.

satpy.composites.NEGLIBLE_COORDS = ['time']

Keywords identifying non-dimensional coordinates to be ignored during composite generation.

class satpy.composites.NIREmissivePartFromReflectance(sunz_threshold=None, **kwargs)[source]

Bases: satpy.composites.NIRReflectance

Get the emissive part of NIR bands.

Collect custom configuration values.

Parameters

sunz_threshold – The threshold sun zenith angle used when deriving the near infrared reflectance. Above this angle the derivation will assume this sun-zenith everywhere. Default None, in which case the default threshold defined in Pyspectral will be used.

class satpy.composites.NIRReflectance(sunz_threshold=None, **kwargs)[source]

Bases: satpy.composites.CompositeBase

Get the reflective part of NIR bands.

Collect custom configuration values.

Parameters

sunz_threshold – The threshold sun zenith angle used when deriving the near infrared reflectance. Above this angle the derivation will assume this sun-zenith everywhere. Default None, in which case the default threshold defined in Pyspectral will be used.

class satpy.composites.NaturalEnh(name, ch16_w=1.3, ch08_w=2.5, ch06_w=2.2, *args, **kwargs)[source]

Bases: satpy.composites.GenericCompositor

Enhanced version of natural color composite by Simon Proud.

Parameters
  • ch16_w (float) – weight for red channel (1.6 um). Default: 1.3

  • ch08_w (float) – weight for green channel (0.8 um). Default: 2.5

  • ch06_w (float) – weight for blue channel (0.6 um). Default: 2.2

Initialize the class.

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

Bases: satpy.composites.CompositeBase

Correct for atmospheric effects.

Initialise the compositor.

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

Bases: satpy.composites.CompositeBase

Pyspectral-based rayleigh corrector for visible channels.

Initialise the compositor.

get_angles(vis)[source]

Get the sun and satellite angles from the current dataarray.

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

Bases: satpy.composites.ColormapCompositor

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

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.RGBCompositor(name, common_channel_mask=True, **kwargs)[source]

Bases: satpy.composites.GenericCompositor

Make a composite from three color bands (deprecated).

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.RatioSharpenedRGB(*args, **kwargs)[source]

Bases: satpy.composites.GenericCompositor

Sharpen RGB bands with ratio of a high resolution band to a lower resolution version.

Any pixels where the ratio is computed to be negative or infinity, it is reset to 1. Additionally, the ratio is limited to 1.5 on the high end to avoid high changes due to small discrepancies in instrument detector footprint. Note that the input data to this compositor must already be resampled so all data arrays are the same shape.

Example:

R_lo -  1000m resolution - shape=(2000, 2000)
G - 1000m resolution - shape=(2000, 2000)
B - 1000m resolution - shape=(2000, 2000)
R_hi -  500m resolution - shape=(4000, 4000)

ratio = R_hi / R_lo
new_R = R_hi
new_G = G * ratio
new_B = B * ratio

Instanciate the ration sharpener.

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

Bases: satpy.composites.GenericCompositor

Create a realistic colours composite for SEVIRI.

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.SandwichCompositor(name, common_channel_mask=True, **kwargs)[source]

Bases: satpy.composites.GenericCompositor

Make a sandwich product.

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.SelfSharpenedRGB(*args, **kwargs)[source]

Bases: satpy.composites.RatioSharpenedRGB

Sharpen RGB with ratio of a band with a strided-version of itself.

Example:

R -  500m resolution - shape=(4000, 4000)
G - 1000m resolution - shape=(2000, 2000)
B - 1000m resolution - shape=(2000, 2000)

ratio = R / four_element_average(R)
new_R = R
new_G = G * ratio
new_B = B * ratio

Instanciate the ration sharpener.

static four_element_average_dask(d)[source]

Average every 4 elements (2x2) in a 2D array.

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

Bases: satpy.composites.CompositeBase

Basic single-band composite builder.

This preserves all the attributes of the dataset it is derived from.

Initialise the compositor.

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

Bases: satpy.composites.GenericCompositor

A compositor that loads a static image from disk.

If the filename passed to this compositor is not valid then the SATPY_ANCPATH environment variable will be checked to see if the image is located there

Collect custom configuration values.

Parameters
  • filename (str) – Filename of the image to load

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

class satpy.composites.SunZenithCorrector(correction_limit=88.0, **kwargs)[source]

Bases: satpy.composites.SunZenithCorrectorBase

Standard sun zenith correction using 1 / cos(sunz).

In addition to adjusting the provided reflectances by the cosine of the solar zenith angle, this modifier forces all reflectances beyond a solar zenith angle of max_sza to 0. It also gradually reduces the amount of correction done between correction_limit and max_sza. If max_sza is None then a constant correction is applied to zenith angles beyond correction_limit.

To set max_sza to None in a YAML configuration file use:

sunz_corrected:
  compositor: !!python/name:satpy.composites.SunZenithCorrector
  max_sza: !!null
  optional_prerequisites:
  - solar_zenith_angle

Collect custom configuration values.

Parameters
  • correction_limit (float) – Maximum solar zenith angle to apply the correction in degrees. Pixels beyond this limit have a constant correction applied. Default 88.

  • max_sza (float) – Maximum solar zenith angle in degrees that is considered valid and correctable. Default 95.0.

class satpy.composites.SunZenithCorrectorBase(max_sza=95.0, **kwargs)[source]

Bases: satpy.composites.CompositeBase

Base class for sun zenith correction.

Collect custom configuration values.

Parameters

max_sza (float) – Maximum solar zenith angle in degrees that is considered valid and correctable. Default 95.0.

coszen = <WeakValueDictionary>
satpy.composites.add_bands(data, bands)[source]

Add bands so that they match bands.

satpy.composites.check_times(projectables)[source]

Check that projectables have compatible times.

satpy.composites.enhance2dataset(dset)[source]

Return the enhancemened to dataset dset as an array.

satpy.composites.sub_arrays(proj1, proj2)[source]

Substract two DataArrays and combine their attrs.

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

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