satpy.dataset.metadata module

Utilities for merging metadata from various sources.

satpy.dataset.metadata._all_arrays_equal(arrays)[source]

Check if the arrays are equal.

If the arrays are lazy, just check if they have the same identity.

satpy.dataset.metadata._all_close(values)[source]
satpy.dataset.metadata._all_dicts_equal(dicts)[source]
satpy.dataset.metadata._all_equal(values)[source]
satpy.dataset.metadata._all_identical(values)[source]

Check that the identities of all values are the same.

satpy.dataset.metadata._all_list_of_arrays_equal(array_lists)[source]

Check that the lists of arrays are equal.

satpy.dataset.metadata._all_non_dicts_equal(values)[source]
satpy.dataset.metadata._all_values_equal(values)[source]
satpy.dataset.metadata._are_values_combinable(values)[source]

Check if the values can be combined.

satpy.dataset.metadata._combine_shared_info(shared_keys, info_dicts, average_times)[source]
satpy.dataset.metadata._contain_arrays(values)[source]
satpy.dataset.metadata._contain_collections_of_arrays(values)[source]
satpy.dataset.metadata._contain_dicts(values)[source]
satpy.dataset.metadata._dict_equal(d1, d2)[source]

Check that two dictionaries are equal.

Nested dictionaries are flattened to facilitate comparison.

satpy.dataset.metadata._dict_keys_equal(d1, d2)[source]
satpy.dataset.metadata._get_valid_dicts(metadata_objects)[source]

Get the valid dictionaries matching the metadata_objects.

satpy.dataset.metadata._is_all_arrays(value)[source]
satpy.dataset.metadata._is_array(val)[source]

Check if val is an array.

satpy.dataset.metadata._is_equal(a, b, comp_func)[source]
satpy.dataset.metadata._is_non_empty_collection(value)[source]
satpy.dataset.metadata._pairwise_all(func, values)[source]
satpy.dataset.metadata._shared_keys(info_dicts)[source]
satpy.dataset.metadata.average_datetimes(datetime_list)[source]

Average a series of datetime objects.

Note

This function assumes all datetime objects are naive and in the same time zone (UTC).

Parameters:

datetime_list (iterable) – Datetime objects to average

Returns: Average datetime as a datetime object

satpy.dataset.metadata.combine_metadata(*metadata_objects, average_times=True)[source]

Combine the metadata of two or more Datasets.

If the values corresponding to any keys are not equal or do not exist in all provided dictionaries then they are not included in the returned dictionary. By default any keys with the word ‘time’ in them and consisting of datetime objects will be averaged. This is to handle cases where data were observed at almost the same time but not exactly. In the interest of time, lazy arrays are compared by object identity rather than by their contents.

Parameters:
  • *metadata_objects – MetadataObject or dict objects to combine

  • average_times (bool) – Average any keys with ‘time’ in the name

Returns:

the combined metadata

Return type:

dict