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)[source]
satpy.dataset.metadata._combine_time_parameters(values)[source]
satpy.dataset.metadata._combine_times(key, values)[source]
satpy.dataset.metadata._combine_values(key, values, shared_info)[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._filter_time_values(values)[source]

Remove values that are not datetime objects.

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=None)[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.

All values of the keys containing the substring ‘start_time’ will be set to the earliest value and similarly for ‘end_time’ to latest time. All other keys containing the word ‘time’ are averaged. Before these adjustments, None values resulting from data that don’t have times associated to them are removed. These rules are applied also to values in the ‘time_parameters’ dictionary.

Changed in version 0.47: Before Satpy 0.47, all times, including start_time and end_time, were averaged.

In the interest of processing time, lazy arrays are compared by object identity rather than by their contents.

Parameters:

*metadata_objects – MetadataObject or dict objects to combine

Kwargs:

average_times (bool): Removed option to average all time attributes.

Returns:

the combined metadata

Return type:

dict