naturtag.metadata.meta_metadata module#
- class naturtag.metadata.meta_metadata.MetaMetadata(*args, **kwargs)#
Bases:
naturtag.metadata.image_metadata.ImageMetadata
Parses observation info and other higher-level details derived from raw image metadata
Example
>>> from naturtag import MetaMetadata >>> meta = MetaMetadata('/path/to/image.jpg') >>> print(meta.summary) >>> print(meta.to_observation())
- property combined: dict[str, Any]#
- Return type
dict
[str
,Any
]
- property coordinates: Optional[Tuple[float, float]]#
Get coordinates as decimal degrees from EXIF or XMP metadata
- Return type
Optional
[Tuple
[float
,float
]]
- property date: Optional[str]#
Date taken or created, as a string
- Return type
Optional
[str
]
- property filtered_combined: dict[str, Any]#
- Return type
dict
[str
,Any
]
- property has_any_tags: bool#
- Return type
bool
- property has_coordinates: bool#
- Return type
bool
- property has_observation: bool#
- Return type
bool
- property has_taxon: bool#
- Return type
bool
- property inaturalist_ids: tuple[Optional[int], Optional[int]]#
Get taxon and/or observation IDs from metadata if available
- Return type
tuple
[Optional
[int
],Optional
[int
]]
- merge(other)#
Update metadata from another instance
- Return type
- property min_rank: Optional[tuple[str, str]]#
Get the lowest (most specific) taxonomic rank and name from tags, if any
- Return type
Optional
[tuple
[str
,str
]]- Returns
(rank, name)
- property observation_id: Optional[int]#
- Return type
Optional
[int
]
- property observation_url: str#
- Return type
str
- property simplified: dict[str, str]#
Get simplified/deduplicated key-value pairs from a combination of keywords + basic metadata
- Return type
dict
[str
,str
]
- property summary: str#
Get a condensed summary of available metadata
- Return type
str
- property taxon_id: Optional[int]#
- Return type
Optional
[int
]
- property taxon_url: str#
- Return type
str
- to_observation()#
Convert DwC metadata to an observation object, if possible
- Return type
- update(new_metadata)#
Update arbitrary EXIF, IPTC, and/or XMP metadata, and reset/update derived properties
- update_coordinates(coordinates)#
- update_keywords(keywords)#
Update only keyword metadata. Keywords will be written to appropriate tags for each metadata format.
- naturtag.metadata.meta_metadata.get_inaturalist_ids(metadata)#
Look for taxon and/or observation IDs from metadata if available
- Return type
tuple
[Optional
[int
],Optional
[int
]]
- naturtag.metadata.meta_metadata.simplify_keys(mapping)#
Simplify/deduplicate dict keys, to reduce variations in similarly-named keys
- Example::
>>> simplify_keys({'my_namepace:Sub_Family': 'Panorpinae'}) {'subfamily': 'Panorpinae'}
- Return type
dict
[str
,str
]- Returns
dict with simplified/deduplicated keys