satpy.tests.test_composites module

Tests for compositors in composites/__init__.py.

class satpy.tests.test_composites.TestAddBands(methodName='runTest')[source]

Bases: TestCase

Test case for the add_bands function.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
test_add_bands_l_rgb()[source]

Test adding bands.

test_add_bands_l_rgba()[source]

Test adding bands.

test_add_bands_la_rgb()[source]

Test adding bands.

test_add_bands_p_l()[source]

Test adding bands.

test_add_bands_rgb_rbga()[source]

Test adding bands.

class satpy.tests.test_composites.TestBackgroundCompositor[source]

Bases: object

Test case for the background compositor.

classmethod setup_class()[source]

Create shared input data arrays.

test_call(foreground_bands, background_bands, exp_bands, exp_result)[source]

Test the background compositing.

test_multiple_sensors()[source]

Test the background compositing from multiple sensor data.

class satpy.tests.test_composites.TestCategoricalDataCompositor(methodName='runTest')[source]

Bases: TestCase

Test composiotor for recategorization of categorical data.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
setUp()[source]

Create test data.

test_basic_recategorization()[source]

Test general functionality of compositor incl. attributes.

test_too_many_datasets()[source]

Test that ValueError is raised if more than one dataset is provided.

class satpy.tests.test_composites.TestCloudCompositorCommonMask[source]

Bases: object

Test the CloudCompositorCommonMask.

setup_method()[source]

Set up the test case.

test_bad_call()[source]

Test the CloudCompositorCommonMask without mask.

test_call_dask()[source]

Test the CloudCompositorCommonMask with dask.

test_call_numpy()[source]

Test the CloudCompositorCommonMask with numpy.

class satpy.tests.test_composites.TestCloudCompositorWithoutCloudfree[source]

Bases: object

Test the CloudCompositorWithoutCloudfree.

setup_method()[source]

Set up the test case.

test_bad_indata()[source]

Test the CloudCompositorWithoutCloudfree composite generation without status.

test_call_bad_optical_conditions()[source]

Test the CloudCompositorWithoutCloudfree composite generation.

test_call_dask_with_invalid_value_in_status()[source]

Test the CloudCompositorWithoutCloudfree composite generation.

test_call_numpy_with_invalid_value_in_status()[source]

Test the CloudCompositorWithoutCloudfree composite generation.

class satpy.tests.test_composites.TestColorizeCompositor(methodName='runTest')[source]

Bases: TestCase

Test the ColorizeCompositor.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
test_colorize_no_fill()[source]

Test colorizing.

test_colorize_with_interpolation()[source]

Test colorizing with interpolation.

class satpy.tests.test_composites.TestColormapCompositor(methodName='runTest')[source]

Bases: TestCase

Test the ColormapCompositor.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
setUp()[source]

Set up the test case.

test_build_colormap_with_int_data_and_with_meanings()[source]

Test colormap building.

test_build_colormap_with_int_data_and_without_meanings()[source]

Test colormap building.

class satpy.tests.test_composites.TestDayNightCompositor(methodName='runTest')[source]

Bases: TestCase

Test DayNightCompositor.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
setUp()[source]

Create test data.

test_day_only_area_with_alpha()[source]

Test compositor with day portion with alpha_band when SZA data is not provided.

test_day_only_area_with_alpha_and_missing_data()[source]

Test compositor with day portion with alpha_band when SZA data is not provided and there is missing data.

test_day_only_area_without_alpha()[source]

Test compositor with day portion without alpha_band when SZA data is not provided.

test_day_only_sza_with_alpha()[source]

Test compositor with day portion with alpha band when SZA data is included.

test_day_only_sza_without_alpha()[source]

Test compositor with day portion without alpha band when SZA data is included.

test_daynight_area()[source]

Test compositor both day and night portions when SZA data is not provided.

test_daynight_sza()[source]

Test compositor with both day and night portions when SZA data is included.

test_night_only_area_with_alpha()[source]

Test compositor with night portion with alpha band when SZA data is not provided.

test_night_only_area_without_alpha()[source]

Test compositor with night portion without alpha band when SZA data is not provided.

test_night_only_sza_with_alpha()[source]

Test compositor with night portion with alpha band when SZA data is included.

test_night_only_sza_without_alpha()[source]

Test compositor with night portion without alpha band when SZA data is included.

class satpy.tests.test_composites.TestDifferenceCompositor(methodName='runTest')[source]

Bases: TestCase

Test case for the difference compositor.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
setUp()[source]

Create test data.

test_bad_areas_diff()[source]

Test that a difference where resolutions are different fails.

test_basic_diff()[source]

Test that a basic difference composite works.

class satpy.tests.test_composites.TestEnhance2Dataset(methodName='runTest')[source]

Bases: TestCase

Test the enhance2dataset utility.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
test_enhance_l(get_enhanced_image)[source]

Test enhancing a paletted dataset in P mode.

test_enhance_p(get_enhanced_image)[source]

Test enhancing a paletted dataset in P mode.

test_enhance_p_to_rgb(get_enhanced_image)[source]

Test enhancing a paletted dataset in RGB mode.

test_enhance_p_to_rgba(get_enhanced_image)[source]

Test enhancing a paletted dataset in RGBA mode.

class satpy.tests.test_composites.TestFillingCompositor(methodName='runTest')[source]

Bases: TestCase

Test case for the filling compositor.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
test_fill()[source]

Test filling.

class satpy.tests.test_composites.TestGenericCompositor(methodName='runTest')[source]

Bases: TestCase

Test generic compositor.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
setUp()[source]

Create test data.

test_call()[source]

Test calling generic compositor.

test_call_with_mock(match_data_arrays, check_times, combine_metadata, get_sensors)[source]

Test calling generic compositor.

test_concat_datasets()[source]

Test concatenation of datasets.

test_deprecation_warning()[source]

Test deprecation warning for dcprecated composite recipes.

test_get_sensors()[source]

Test getting sensors from the dataset attributes.

test_masking()[source]

Test masking in generic compositor.

class satpy.tests.test_composites.TestHighCloudCompositor[source]

Bases: object

Test HighCloudCompositor.

setup_method()[source]

Create test data.

test_high_cloud_compositor()[source]

Test general default functionality of compositor.

test_high_cloud_compositor_dtype()[source]

Test that the datatype is not altered by the compositor.

test_high_cloud_compositor_multiple_calls()[source]

Test that the modified init variables are reset properly when calling the compositor multiple times.

test_high_cloud_compositor_validity_checks()[source]

Test that errors are raised for invalid input data and settings.

class satpy.tests.test_composites.TestInferMode(methodName='runTest')[source]

Bases: TestCase

Test the infer_mode utility.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
test_band_size_is_used()[source]

Test that the band size is used.

test_bands_coords_is_used()[source]

Test that the bands coord is used.

test_mode_is_used()[source]

Test that the mode attribute is used.

test_no_bands_is_l()[source]

Test that default (no band) is L.

class satpy.tests.test_composites.TestInlineComposites(methodName='runTest')[source]

Bases: TestCase

Test inline composites.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
test_inline_composites()[source]

Test that inline composites are working.

class satpy.tests.test_composites.TestLongitudeMaskingCompositor(methodName='runTest')[source]

Bases: TestCase

Test case for the LongitudeMaskingCompositor compositor.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
test_masking()[source]

Test longitude masking.

class satpy.tests.test_composites.TestLowCloudCompositor[source]

Bases: object

Test LowCloudCompositor.

setup_method()[source]

Create test data.

test_low_cloud_compositor()[source]

Test general default functionality of compositor.

test_low_cloud_compositor_dtype()[source]

Test that the datatype is not altered by the compositor.

test_low_cloud_compositor_validity_checks()[source]

Test that errors are raised for invalid input data and settings.

class satpy.tests.test_composites.TestLuminanceSharpeningCompositor(methodName='runTest')[source]

Bases: TestCase

Test luminance sharpening compositor.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
test_compositor()[source]

Test luminance sharpening compositor.

class satpy.tests.test_composites.TestMaskingCompositor[source]

Bases: object

Test case for the simple masking compositor.

conditions_v1()[source]

Masking conditions with string values.

conditions_v2()[source]

Masking conditions with numerical values.

reference_alpha()[source]

Get reference alpha to use in masking compositor tests.

reference_data(test_data, test_ct_data)[source]

Get reference data to use in masking compositor tests.

test_call_named_fields(conditions_v2, test_data, test_ct_data, reference_data, reference_alpha)[source]

Test with named fields.

test_call_named_fields_string(conditions_v2, test_data, test_ct_data, reference_data, reference_alpha)[source]

Test with named fields which are as a string in the mask attributes.

test_call_numerical_transparency_data(conditions_v1, test_data, test_ct_data, reference_data, reference_alpha, mode)[source]

Test call the compositor with numerical transparency data.

Use parameterisation to test different image modes.

test_ct_data()[source]

Test 2D CT data array.

test_ct_data_v3(test_ct_data)[source]

Set ct data to NaN where it originally is 1.

test_data()[source]

Test data to use with masking compositors.

test_get_flag_value()[source]

Test reading flag value from attributes based on a name.

test_incorrect_method(test_data, test_ct_data)[source]

Test incorrect method.

test_incorrect_mode(conditions_v1)[source]

Test initiating with unsupported mode.

test_init()[source]

Test the initializiation of compositor.

test_method_absolute_import(test_data, test_ct_data_v3)[source]

Test “absolute_import” as method.

test_method_isnan(test_data, test_ct_data, test_ct_data_v3)[source]

Test “isnan” as method.

test_rgb_dataset(conditions_v1, test_ct_data, reference_alpha)[source]

Test RGB dataset.

test_rgba_dataset(conditions_v2, test_ct_data, reference_alpha)[source]

Test RGBA dataset.

class satpy.tests.test_composites.TestMatchDataArrays[source]

Bases: object

Test the utility method ‘match_data_arrays’.

_get_test_ds(shape=(50, 100), dims=('y', 'x'))[source]

Get a fake DataArray.

test_almost_equal_geo_coordinates()[source]

Test that coordinates that are almost-equal still match.

See https://github.com/pytroll/satpy/issues/2668 for discussion.

Various operations like cropping and resampling can cause geo-coordinates (y, x) to be very slightly unequal due to floating point precision. This test makes sure that even in those cases we can still generate composites from DataArrays with these coordinates.

test_mult_ds_area()[source]

Test multiple datasets successfully pass.

test_mult_ds_diff_area()[source]

Test that datasets with different areas fail.

test_mult_ds_diff_dims()[source]

Test that datasets with different dimensions still pass.

test_mult_ds_diff_size()[source]

Test that datasets with different sizes fail.

test_mult_ds_no_area()[source]

Test that all datasets must have an area attribute.

test_nondimensional_coords()[source]

Test the removal of non-dimensional coordinates when compositing.

test_single_ds()[source]

Test a single dataset is returned unharmed.

class satpy.tests.test_composites.TestMultiFiller(methodName='runTest')[source]

Bases: TestCase

Test case for the MultiFiller compositor.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
test_fill()[source]

Test filling.

class satpy.tests.test_composites.TestNaturalEnhCompositor(methodName='runTest')[source]

Bases: TestCase

Test NaturalEnh compositor.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
setUp()[source]

Create channel data and set channel weights.

test_natural_enh(match_data_arrays, repr_)[source]

Test NaturalEnh compositor.

class satpy.tests.test_composites.TestPaletteCompositor(methodName='runTest')[source]

Bases: TestCase

Test the PaletteCompositor.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
test_call()[source]

Test palette compositing.

class satpy.tests.test_composites.TestPrecipCloudsCompositor(methodName='runTest')[source]

Bases: TestCase

Test the PrecipClouds compositor.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
test_call()[source]

Test the precip composite generation.

class satpy.tests.test_composites.TestRatioSharpenedCompositors[source]

Bases: object

Test RatioSharpenedRGB and SelfSharpendRGB compositors.

setup_method()[source]

Create test data.

test_bad_colors(init_kwargs)[source]

Test that only valid band colors can be provided.

test_basic_no_high_res()[source]

Test that three datasets can be passed without optional high res.

test_basic_no_sharpen()[source]

Test that color None does no sharpening.

test_match_data_arrays()[source]

Test that all areas have to be the same resolution.

test_more_than_three_datasets()[source]

Test that only 3 datasets can be passed.

test_ratio_sharpening(high_resolution_band, neutral_resolution_band, exp_r, exp_g, exp_b)[source]

Test RatioSharpenedRGB by different groups of high_resolution_band and neutral_resolution_band.

test_self_sharpened_basic(exp_shape, exp_r, exp_g, exp_b)[source]

Test that three datasets can be passed without optional high res.

test_self_sharpened_no_high_res()[source]

Test for exception when no high_res band is specified.

class satpy.tests.test_composites.TestRealisticColors[source]

Bases: object

Test the SEVIRI Realistic Colors compositor.

test_realistic_colors()[source]

Test the compositor.

class satpy.tests.test_composites.TestSandwichCompositor[source]

Bases: object

Test sandwich compositor.

test_compositor(e2d, input_shape, bands)[source]

Test luminance sharpening compositor.

class satpy.tests.test_composites.TestSingleBandCompositor(methodName='runTest')[source]

Bases: TestCase

Test the single-band compositor.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
setUp()[source]

Create test data.

test_call()[source]

Test calling the compositor.

class satpy.tests.test_composites.TestStaticImageCompositor(methodName='runTest')[source]

Bases: TestCase

Test case for the static compositor.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

_classSetupFailed = False
_class_cleanups = []
test_call(Scene, register, retrieve)[source]

Test the static compositing.

test_init(get_area_def)[source]

Test the initializiation of static compositor.

satpy.tests.test_composites._create_fake_composite_config(yaml_filename: str)[source]
satpy.tests.test_composites._enhance2dataset(dataset, convert_p=False)[source]

Mock the enhance2dataset to return the original data.

satpy.tests.test_composites.fake_area()[source]

Return a fake 2×2 area.

satpy.tests.test_composites.fake_dataset_pair(fake_area)[source]

Return a fake pair of 2×2 datasets.

satpy.tests.test_composites.test_bad_sensor_yaml_configs(tmp_path)[source]

Test composite YAML file with no sensor isn’t loaded.

But the bad YAML also shouldn’t crash composite configuration loading.

satpy.tests.test_composites.test_ratio_compositor(fake_dataset_pair)[source]

Test the ratio compositor.

satpy.tests.test_composites.test_sum_compositor(fake_dataset_pair)[source]

Test the sum compositor.