satpy.composites.resolution module

Sharpening compositors.

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

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

Bases: 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

In some cases, there could be multiple high resolution bands:

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

To avoid the green band getting involved in calculating ratio or sharpening, add “neutral_resolution_band: green” in the YAML config file. This way only the blue band will get sharpened:

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

Instanciate the ration sharpener.

__init__(*args, **kwargs)[source]

Instanciate the ration sharpener.

_combined_sharpened_info(info, new_attrs)[source]
_get_and_sharpen_rgb_data_arrays_and_meta(datasets, optional_datasets)[source]
_sharpen_bands_with_high_res(bands, high_res)[source]
class satpy.composites.resolution.SandwichCompositor(name, common_channel_mask=True, **kwargs)[source]

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

Bases: 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.

satpy.composites.resolution._get_sharpening_ratio(high_res, low_res)[source]
satpy.composites.resolution._mean4(data, offset=(0, 0), block_id=None)[source]