satpy.tests.writer_tests.test_cf module

Tests for the CF writer.

class satpy.tests.writer_tests.test_cf.EncodingUpdateTest[source]

Bases: object

Test update of netCDF encoding.

fake_ds()[source]

Create fake data for testing.

fake_ds_digit()[source]

Create fake data for testing.

test_dataset_name_digit(fake_ds_digit)[source]

Test data with dataset name staring with a digit.

test_with_time(fake_ds)[source]

Test data with a time dimension.

test_without_time(fake_ds)[source]

Test data with no time dimension.

class satpy.tests.writer_tests.test_cf.TempFile(suffix='.nc')[source]

Bases: object

A temporary filename class.

Initialize.

class satpy.tests.writer_tests.test_cf.TestCFWriter[source]

Bases: object

Test case for CF writer.

assertDictWithArraysEqual(d1, d2)[source]

Check that dicts containing arrays are equal.

get_test_attrs()[source]

Create some dataset attributes for testing purpose.

Returns:

Attributes, encoded attributes, encoded and flattened attributes

test__add_grid_mapping()[source]

Test the conversion from pyresample area object to CF grid mapping.

test_add_lonlat_coords()[source]

Test the conversion from areas to lon/lat.

test_ancillary_variables()[source]

Test ancillary_variables cited each other.

test_area2cf()[source]

Test the conversion of an area to CF standards.

test_assert_xy_unique()[source]

Test that the x and y coordinates are unique.

test_bounds()[source]

Test setting time bounds.

test_bounds_minimum()[source]

Test minimum bounds.

test_bounds_missing_time_info()[source]

Test time bounds generation in case of missing time.

test_collect_cf_dataarrays()[source]

Test collecting CF datasets from a DataArray objects.

test_da2cf()[source]

Test the conversion of a DataArray to a CF-compatible DataArray.

test_da2cf_one_dimensional_array()[source]

Test the conversion of an 1d DataArray to a CF-compatible DataArray.

test_encode_attrs_nc()[source]

Test attributes encoding.

test_global_attr_default_history_and_Conventions()[source]

Test saving global attributes history and Conventions.

test_global_attr_history_and_Conventions()[source]

Test saving global attributes history and Conventions.

test_groups()[source]

Test creating a file with groups.

test_header_attrs()[source]

Check global attributes are set.

test_init()[source]

Test initializing the CFWriter class.

Check that coordinates link has been established correctly.

test_load_module_with_old_pyproj()[source]

Test that cf_writer can still be loaded with pyproj 1.9.6.

test_make_alt_coords_unique()[source]

Test that created coordinate variables are unique.

test_save_array()[source]

Test saving an array to netcdf/cf.

test_save_array_coords()[source]

Test saving array with coordinates.

test_save_dataset_a_digit()[source]

Test saving an array to netcdf/cf where dataset name starting with a digit.

test_save_dataset_a_digit_no_prefix_include_attr()[source]

Test saving an array to netcdf/cf dataset name starting with a digit with no prefix include orig name.

test_save_dataset_a_digit_prefix()[source]

Test saving an array to netcdf/cf where dataset name starting with a digit with prefix.

test_save_dataset_a_digit_prefix_include_attr()[source]

Test saving an array to netcdf/cf where dataset name starting with a digit with prefix include orig name.

test_single_time_value()[source]

Test setting a single time value.

test_time_coordinate_on_a_swath()[source]

Test that time dimension is not added on swath data with time already as a coordinate.

test_unlimited_dims_kwarg()[source]

Test specification of unlimited dimensions.

class satpy.tests.writer_tests.test_cf.TestCFWriterData[source]

Bases: object

Test case for CF writer where data arrays are needed.

datasets()[source]

Create test dataset.

test_collect_cf_dataarrays_with_latitude_named_lat(datasets)[source]

Test collecting CF datasets with latitude named lat.

test_has_projection_coords(datasets)[source]

Test the has_projection_coords function.

test_is_lon_or_lat_dataarray(datasets)[source]

Test the is_lon_or_lat_dataarray function.

class satpy.tests.writer_tests.test_cf.TestEncodingAttribute[source]

Bases: TestEncodingKwarg

Test CF writer with ‘encoding’ dataset attribute.

scene_with_encoding(scene, encoding)[source]

Create scene with a dataset providing the ‘encoding’ attribute.

test_encoding_attribute(scene_with_encoding, filename, expected)[source]

Test ‘encoding’ dataset attribute.

class satpy.tests.writer_tests.test_cf.TestEncodingKwarg[source]

Bases: object

Test CF writer with ‘encoding’ keyword argument.

_assert_encoding_as_expected(filename, expected)[source]
complevel_exp(compression_on)[source]

Get expected compression level.

compression_on(request)[source]

Get compression options.

encoding(compression_on)[source]

Get encoding.

expected(complevel_exp)[source]

Get expectated file contents.

filename(tmp_path)[source]

Get output filename.

scene()[source]

Create a fake scene.

test_encoding_kwarg(scene, encoding, filename, expected)[source]

Test ‘encoding’ keyword argument.

test_no_warning_if_backends_match(scene, filename, monkeypatch)[source]

Make sure no warning is issued if backends match.

test_warning_if_backends_dont_match(scene, filename, monkeypatch)[source]

Test warning if backends don’t match.

satpy.tests.writer_tests.test_cf._get_compression_params(complevel)[source]
satpy.tests.writer_tests.test_cf._should_use_compression_keyword()[source]
satpy.tests.writer_tests.test_cf.test_add_time_cf_attrs()[source]

Test addition of CF-compliant time attributes.

satpy.tests.writer_tests.test_cf.test_da2cf_lonlat()[source]

Test correct da2cf encoding for area with lon/lat units.

satpy.tests.writer_tests.test_cf.test_empty_collect_cf_datasets()[source]

Test that if no DataArrays, collect_cf_datasets raise error.

satpy.tests.writer_tests.test_cf.test_is_projected(caplog)[source]

Tests for private _is_projected function.

satpy.tests.writer_tests.test_cf.test_lonlat_storage(tmp_path)[source]

Test correct storage for area with lon/lat units.

satpy.tests.writer_tests.test_cf.test_preprocess_dataarray_name()[source]

Test saving an array to netcdf/cf where dataset name starting with a digit with prefix include orig name.