satpy.tests.test_scene module
Unit tests for scene.py.
- class satpy.tests.test_scene.TestFinestCoarsestArea[source]
Bases:
object
Test the Scene logic for finding the finest and coarsest area.
- test_coarsest_finest_area_different_shape(coarse_area, fine_area)[source]
Test ‘coarsest_area’ and ‘finest_area’ methods for upright areas.
- test_coarsest_finest_area_same_shape(area_def, shifted_area)[source]
Test that two areas with the same shape are consistently returned.
If two geometries (ex. two AreaDefinitions or two SwathDefinitions) have the same resolution (shape) but different coordinates, which one has the finer resolution would ultimately be determined by the semi-random ordering of the internal container of the Scene (a dict) if only pixel resolution was compared. This test makes sure that it is always the same object returned.
- class satpy.tests.test_scene.TestScene[source]
Bases:
object
Test the scene class.
- test_available_dataset_names_no_readers()[source]
Test the available dataset names without a reader.
- test_create_multiple_reader_different_kwargs()[source]
Test passing different kwargs to different readers.
- test_create_reader_instances_with_reader()[source]
Test createring a reader instance providing the reader name.
- test_create_reader_instances_with_reader_kwargs()[source]
Test creating a reader instance with reader kwargs.
- test_sensor_names_added_datasets(include_reader, added_sensor, exp_sensors)[source]
Test that Scene sensor_names handles contained sensors properly.
- test_sensor_names_readers(reader, filenames, exp_sensors)[source]
Test that Scene sensor_names handles different cases properly.
- test_storage_options_from_reader_kwargs_no_options()[source]
Test getting storage options from reader kwargs.
Case where there are no options given.
- test_storage_options_from_reader_kwargs_per_reader()[source]
Test getting storage options from reader kwargs.
Case where each reader have their own storage options.
- test_storage_options_from_reader_kwargs_per_reader_and_global()[source]
Test getting storage options from reader kwargs.
Case where each reader have their own storage options and there are global options to merge.
- class satpy.tests.test_scene.TestSceneAggregation(methodName='runTest')[source]
Bases:
TestCase
Test the scene’s aggregate method.
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.
- class satpy.tests.test_scene.TestSceneAvailableDatasets[source]
Bases:
object
Test the Scene’s handling of various dependencies.
- test_available_composite_ids_missing_available()[source]
Test available_composite_ids when a composites dep is missing.
- class satpy.tests.test_scene.TestSceneConversions(methodName='runTest')[source]
Bases:
TestCase
Test Scene conversion to geoviews, xarray, etc.
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_geoviews_basic_with_area()[source]
Test converting a Scene to geoviews with an AreaDefinition.
- class satpy.tests.test_scene.TestSceneLoading[source]
Bases:
object
Test the Scene objects .load method.
- test_available_comps_no_deps()[source]
Test Scene available composites when composites don’t have a dependency.
- test_available_when_sensor_none_in_preloaded_dataarrays()[source]
Test Scene available composites when existing loaded arrays have sensor set to None.
Some readers or composites (ex. static images) don’t have a sensor and developers choose to set it to None. This test makes sure this doesn’t break available composite IDs.
- test_load_comp12()[source]
Test loading a composite that depends all wavelengths that get modified.
- test_load_comp13()[source]
Test loading a composite that depends on a modified dataset where the resolution changes.
- test_load_comp15()[source]
Test loading a composite whose prerequisites can’t be loaded.
Note that the prereq exists in the reader, but fails in loading.
- test_load_comp16()[source]
Test loading a composite whose opt prereq can’t be loaded.
Note that the prereq exists in the reader, but fails in loading
- test_load_comp18()[source]
Test loading a composite that depends on a incompatible area modified dataset.
- test_load_comp18_2()[source]
Test loading a composite that depends on a incompatible area modified dataset.
Specifically a modified dataset where the modifier has optional dependencies.
- test_load_comp19()[source]
Test loading a composite that shares a dep with a dependency.
More importantly test that loading a dependency that depends on the same dependency as this composite (a sibling dependency) and that sibling dependency includes a modifier. This test makes sure that the Node in the dependency tree is the exact same node.
- test_load_dataset_after_composite2()[source]
Test load complex composite followed by other datasets.
- test_load_ds5_empty_modifiers()[source]
Test loading a dataset has multiple resolutions available with different resolutions.
- test_load_ds5_missing_best_resolution()[source]
Test loading a dataset that has multiple resolutions but the best isn’t available.
- test_load_ds5_multiple_resolution()[source]
Test loading a dataset has multiple resolutions available with different resolutions.
- test_load_ds5_resolution_list()[source]
Test loading a dataset has multiple resolutions available with different resolutions.
- test_load_modified_with_load_kwarg()[source]
Test loading a modified dataset using the
Scene.load
keyword argument.
- test_load_multiple_resolutions()[source]
Test loading a dataset has multiple resolutions available with different resolutions.
- test_load_same_subcomposite()[source]
Test loading a composite and one of it’s subcomposites at the same time.
- test_load_when_sensor_none_in_preloaded_dataarrays()[source]
Test Scene loading when existing loaded arrays have sensor set to None.
Some readers or composites (ex. static images) don’t have a sensor and developers choose to set it to None. This test makes sure this doesn’t break loading.
- class satpy.tests.test_scene.TestSceneResampling[source]
Bases:
object
Test resampling a Scene to another Scene object.
- test_comp_loading_after_resampling_existing_sensor()[source]
Test requesting a composite after resampling.
- test_comp_loading_after_resampling_new_sensor()[source]
Test requesting a composite after resampling when the sensor composites weren’t loaded before.
- test_comp_loading_multisensor_composite_created_user()[source]
Test that multisensor composite can be created manually.
Test that if the user has created datasets “manually”, that multi-sensor composites provided can still be read.
- test_comps_need_resampling_optional_mod_deps()[source]
Test that a composite with complex dependencies.
This is specifically testing the case where a compositor depends on multiple resolution prerequisites which themselves are composites. These sub-composites depend on data with a modifier that only has optional dependencies. This is a very specific use case and is the simplest way to present the problem (so far).
The general issue is that the Scene loading creates the “ds13” dataset which already has one modifier on it. The “comp27” composite requires resampling so its 4 prerequisites + the requested “ds13” (from the reader which includes mod1 modifier) remain. If the DependencyTree is not copied properly in this situation then the new Scene object will have the composite dependencies without resolution in its dep tree, but have the DataIDs with the resolution in the dataset dictionary. This all results in the Scene trying to regenerate composite dependencies that aren’t needed which fail.
- test_resample_multi_ancillary()[source]
Test that multiple ancillary variables are retained after resampling.
This test corresponds to GH#2329
- test_resample_reduce_data()[source]
Test that the Scene reducing data does not affect final output.
- test_resample_reduce_data_toggle(rs)[source]
Test that the Scene can be reduced or not reduced during resampling.
- class satpy.tests.test_scene.TestSceneSaving(methodName='runTest')[source]
Bases:
TestCase
Test the Scene’s saving method.
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.