satpy.tests.test_writers module

Test generic writer functions.

class satpy.tests.test_writers.TestBaseWriter[source]

Bases: object

Test the base writer class.

setup_method()[source]

Set up tests.

teardown_method()[source]

Remove the temporary directory created for a test.

test_save_dataset_dynamic_filename(fmt_fn, exp_fns)[source]

Test saving a dataset with a format filename specified.

test_save_dataset_dynamic_filename_with_dir()[source]

Test saving a dataset with a format filename that includes a directory.

test_save_dataset_static_filename()[source]

Test saving a dataset with a static filename specified.

class satpy.tests.test_writers.TestComplexSensorEnhancerConfigs[source]

Bases: _BaseCustomEnhancementConfigTests

Test enhancement configs that use or expect multiple sensors.

ENH_FN = 'test_sensor1.yaml'
ENH_FN2 = 'test_sensor2.yaml'
TEST_CONFIGS: dict[str, str] = {'test_sensor1.yaml': '\nenhancements:\n  test1_sensor1_specific:\n    name: test1\n    sensor: test_sensor1\n    operations:\n    - name: stretch\n      method: !!python/name:satpy.enhancements.stretch\n      kwargs: {stretch: crude, min_stretch: 0, max_stretch: 200}\n\n        ', 'test_sensor2.yaml': '\nenhancements:\n  default:\n    operations:\n    - name: stretch\n      method: !!python/name:satpy.enhancements.stretch\n      kwargs: {stretch: crude, min_stretch: 0, max_stretch: 100}\n  test1_sensor2_specific:\n    name: test1\n    sensor: test_sensor2\n    operations:\n    - name: stretch\n      method: !!python/name:satpy.enhancements.stretch\n      kwargs: {stretch: crude, min_stretch: 0, max_stretch: 50}\n  exact_multisensor_comp:\n    name: my_comp\n    sensor: [test_sensor1, test_sensor2]\n    operations:\n    - name: stretch\n      method: !!python/name:satpy.enhancements.stretch\n      kwargs: {stretch: crude, min_stretch: 0, max_stretch: 20}\n            '}
test_multisensor_choice()[source]

Test that a DataArray with two sensors works.

test_multisensor_exact()[source]

Test that a DataArray with two sensors can match exactly.

class satpy.tests.test_writers.TestComputeWriterResults(methodName='runTest')[source]

Bases: TestCase

Test compute_writer_results().

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.

setUp()[source]

Create temporary directory to save files to and a mock scene.

tearDown()[source]

Remove the temporary directory created for a test.

test_empty()[source]

Test empty result list.

test_geotiff()[source]

Test writing to mitiff file.

test_mixed()[source]

Test writing to multiple mixed-type files.

test_multiple_geotiff()[source]

Test writing to mitiff file.

test_multiple_simple()[source]

Test writing to geotiff files.

test_simple_image()[source]

Test writing to PNG file.

class satpy.tests.test_writers.TestEnhancer(methodName='runTest')[source]

Bases: TestCase

Test basic Enhancer functionality with builtin configs.

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.

test_basic_init_no_args()[source]

Test Enhancer init with no arguments passed.

test_basic_init_no_enh()[source]

Test Enhancer init requesting no enhancements.

test_basic_init_provided_enh()[source]

Test Enhancer init with string enhancement configs.

test_init_nonexistent_enh_file()[source]

Test Enhancer init with a nonexistent enhancement configuration file.

class satpy.tests.test_writers.TestEnhancerUserConfigs[source]

Bases: _BaseCustomEnhancementConfigTests

Test Enhancer functionality when user’s custom configurations are present.

ENH_ENH_FN = 'enhancements/test_sensor.yaml'
ENH_ENH_FN2 = 'enhancements/test_sensor2.yaml'
ENH_FN = 'test_sensor.yaml'
ENH_FN2 = 'test_sensor2.yaml'
ENH_FN3 = 'test_empty.yaml'
TEST_CONFIGS: dict[str, str] = {'enhancements/test_sensor.yaml': '\nenhancements:\n  test1_kelvin:\n    name: test1\n    units: kelvin\n    operations:\n    - name: stretch\n      method: !!python/name:satpy.enhancements.stretch\n      kwargs: {stretch: crude, min_stretch: 0, max_stretch: 20}\n\n        ', 'enhancements/test_sensor2.yaml': '\n\n        ', 'test_empty.yaml': '', 'test_sensor.yaml': '\nenhancements:\n  test1_default:\n    name: test1\n    operations:\n    - name: stretch\n      method: !!python/name:satpy.enhancements.stretch\n      kwargs: {stretch: linear, cutoffs: [0., 0.]}\n\n        ', 'test_sensor2.yaml': '\n\n\n        '}
test_enhance_empty_config()[source]

Test Enhancer doesn’t fail with empty enhancement file.

test_enhance_with_sensor_entry()[source]

Test enhancing an image with a configuration section.

test_enhance_with_sensor_entry2()[source]

Test enhancing an image with a more detailed configuration section.

test_enhance_with_sensor_no_entry()[source]

Test enhancing an image that has no configuration sections.

test_no_enhance()[source]

Test turning off enhancements.

test_writer_custom_enhance()[source]

Test using custom enhancements with writer.

test_writer_no_enhance()[source]

Test turning off enhancements with writer.

class satpy.tests.test_writers.TestOverlays(methodName='runTest')[source]

Bases: TestCase

Tests for add_overlay and add_decorate functions.

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.

setUp()[source]

Create test data and mock pycoast/pydecorate.

tearDown()[source]

Turn off pycoast/pydecorate mocking.

test_add_decorate_basic_l()[source]

Test basic add_decorate usage with L data.

test_add_decorate_basic_rgb()[source]

Test basic add_decorate usage with RGB data.

test_add_overlay_basic_l()[source]

Test basic add_overlay usage with L data.

test_add_overlay_basic_rgb()[source]

Test basic add_overlay usage with RGB data.

class satpy.tests.test_writers.TestReaderEnhancerConfigs[source]

Bases: _BaseCustomEnhancementConfigTests

Test enhancement configs that use reader name.

ENH_FN = 'test_sensor1.yaml'
TEST_CONFIGS: dict[str, str] = {'test_sensor1.yaml': '\nenhancements:\n  default_reader2:\n    reader: reader2\n    operations:\n    - name: stretch\n      method: !!python/name:satpy.enhancements.stretch\n      kwargs: {stretch: crude, min_stretch: 0, max_stretch: 75}\n  default:\n    operations:\n    - name: stretch\n      method: !!python/name:satpy.enhancements.stretch\n      kwargs: {stretch: crude, min_stretch: 0, max_stretch: 100}\n  test1_reader2_specific:\n    name: test1\n    reader: reader2\n    operations:\n    - name: stretch\n      method: !!python/name:satpy.enhancements.stretch\n      kwargs: {stretch: crude, min_stretch: 0, max_stretch: 50}\n  test1_reader1_specific:\n    name: test1\n    reader: reader1\n    operations:\n    - name: stretch\n      method: !!python/name:satpy.enhancements.stretch\n      kwargs: {stretch: crude, min_stretch: 0, max_stretch: 200}\n            '}
test_no_matching_reader()[source]

Test that a DataArray with no matching ‘reader’ works.

test_no_reader()[source]

Test that a DataArray with no ‘reader’ metadata works.

test_only_reader_matches()[source]

Test that a DataArray with only a matching ‘reader’ works.

test_reader_and_name_match()[source]

Test that a DataArray with a matching ‘reader’ and ‘name’ works.

class satpy.tests.test_writers.TestWritersModule(methodName='runTest')[source]

Bases: TestCase

Test the writers module.

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.

test_show(mock_get_image)[source]

Check showing.

test_to_image_1d()[source]

Conversion to image.

test_to_image_2d(mock_geoimage)[source]

Conversion to image.

test_to_image_3d(mock_geoimage)[source]

Conversion to image.

class satpy.tests.test_writers.TestYAMLFiles(methodName='runTest')[source]

Bases: TestCase

Test and analyze the writer configuration files.

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.

test_available_writers()[source]

Test the ‘available_writers’ function.

test_filename_matches_writer_name()[source]

Test that every writer filename matches the name in the YAML.