MetaDict

class sunpy.util.MetaDict(*args)[source]

Bases: collections.OrderedDict

A class to hold metadata associated with a sunpy.map.Map derivative.

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 MetaDict to their comments. The casing of keys in the keycomments dictionary is not significant. If a key is removed from the MetaDict, it will also be removed from the keycomments dictionary. Additionally, any extraneous keycomments will be removed when the MetaDict is instantiated.

Methods Summary

get(key[, default])

Override .get() indexing.

has_key(key)

Override .has_key() to perform case-insensitively.

item_hash()

Create a hash based on the stored items.

pop(key[, default])

Override .pop() to perform case-insensitively.

setdefault(key[, default])

Override .setdefault() to perform case-insensitively.

update(d2)

Override .update() to perform case-insensitively.

Methods Documentation

get(key, default=None)[source]

Override .get() indexing.

has_key(key)[source]

Override .has_key() to perform case-insensitively.

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.

pop(key, default=None)[source]

Override .pop() to perform case-insensitively.

setdefault(key, default=None)[source]

Override .setdefault() to perform case-insensitively.

update(d2)[source]

Override .update() to perform case-insensitively.