MetaDict#
- class sunpy.util.MetaDict(*args, save_original=True)[source]#
Bases:
OrderedDictA class to hold metadata associated with a
sunpy.map.Mapderivative.This class handles everything in lower case. This allows case insensitive indexing.
If the key ‘keycomments’ exists, its value must be a dictionary mapping keys in the
MetaDictto their comments. The casing of keys in the keycomments dictionary is not significant. If a key is removed from theMetaDict, it will also be removed from the keycomments dictionary. Additionally, any extraneous keycomments will be removed when theMetaDictis instantiated.- Parameters:
save_original (bool, optional) – If
True(the default), a copy of the original metadata will be saved to theoriginal_metaproperty. Note that this keyword argument is required as an implementation detail to avoid recursion when saving the original contents.
Attributes Summary
Items added since initialisation.
Items modified since initialisation.
A copy of the dictionary from when it was initialised.
Items removed since initialisation.
Methods Summary
copy()Shallow copies this instance.
get(key[, default])Override
.get()indexing.has_key(key)Override
.has_key()to perform case-insensitively.Create a hash based on the stored items.
pop(key[, default])Override
.pop()to perform case-insensitively.popitem(last)Remove and return a (key, value) pair from the dictionary.
setdefault(key[, default])Override
.setdefault()to perform case-insensitively.update(d2)Override
.update()to perform case-insensitively.Attributes Documentation
- added_items#
Items added since initialisation.
- modified_items#
Items modified since initialisation.
This is a mapping from
keyto[original_value, current_value].
- original_meta#
A copy of the dictionary from when it was initialised.
- removed_items#
Items removed since initialisation.
Methods Documentation
- item_hash()[source]#
Create a hash based on the stored items.
This relies on all the items themselves being hashable. For this reason the ‘keycomments’ item, which is a dict, is excluded from the hash.
If creating the hash fails, returns
None.