dwca package#
Package for reading Darwin Core Archive (DwCA) files.
Subpackages#
- dwca.classes package
- Submodules
- dwca.classes.chronometric_age module
- dwca.classes.data_file module
- dwca.classes.event module
- dwca.classes.geological_context module
- dwca.classes.identification module
- dwca.classes.location module
- dwca.classes.material_entity module
- dwca.classes.material_sample module
- dwca.classes.measurement_or_fact module
- dwca.classes.occurrence module
- dwca.classes.organism module
- dwca.classes.outside_class module
- dwca.classes.resource_relationship module
- dwca.classes.taxon module
- Module contents
- dwca.terms package
- Submodules
- dwca.terms.chronometric_age module
ChronometricAgeConversionProtocol
ChronometricAgeDeterminedBy
ChronometricAgeDeterminedDate
ChronometricAgeID
ChronometricAgeProtocol
ChronometricAgeReferences
ChronometricAgeRemarks
ChronometricAgeUncertaintyInYears
ChronometricAgeUncertaintyMethod
EarliestChronometricAge
EarliestChronometricAgeReferenceSystem
LatestChronometricAge
LatestChronometricAgeReferenceSystem
MaterialDated
MaterialDatedID
MaterialDatedRelationship
UncalibratedChronometricAge
VerbatimChronometricAge
- dwca.terms.event module
- dwca.terms.field module
- dwca.terms.geological_context module
EarliestAgeOrLowestStage
EarliestEonOrLowestEonothem
EarliestEpochOrLowestSeries
EarliestEraOrLowestErathem
EarliestPeriodOrLowestSystem
GeologicalContextID
HighestBiostratigraphicZone
LatestAgeOrHighestStage
LatestEonOrHighestEonothem
LatestEpochOrHighestSeries
LatestEraOrHighestErathem
LatestPeriodOrHighestSystem
LithostratigraphicBed
LithostratigraphicFormation
LithostratigraphicGroup
LithostratigraphicMember
LithostratigraphicTerms
LowestBiostratigraphicZone
- dwca.terms.identification module
- dwca.terms.location module
Continent
CoordinatePrecision
CoordinateUncertaintyInMeters
Country
CountryCode
County
DWCLocalityTerm
DecimalLatitude
DecimalLongitude
FootprintSRS
FootprintSpatialFit
FootprintWKT
GeodeticDatum
GeoreferenceProtocol
GeoreferenceRemarks
GeoreferenceSources
GeoreferencedBy
GeoreferencedDate
HigherGeography
HigherGeographyID
Island
IslandGroup
LocationAccordingTo
LocationID
LocationRemarks
MaximumDepthInMeters
MaximumDistanceAboveSurfaceInMeters
MaximumElevationInMeters
MinimumDepthInMeters
MinimumDistanceAboveSurfaceInMeters
MinimumElevationInMeters
Municipality
PointRadiusSpatialFit
StateProvince
VerbatimCoordinateSystem
VerbatimCoordinates
VerbatimDepth
VerbatimElevation
VerbatimLatitude
VerbatimLocality
VerbatimLongitude
VerbatimSRS
VerticalDatum
WaterBody
- dwca.terms.material_entity module
- dwca.terms.material_sample module
- dwca.terms.measurement_or_fact module
- dwca.terms.occurrence module
AssociatedMedia
AssociatedOccurrences
AssociatedReferences
AssociatedTaxa
Behavior
Caste
CatalogNumber
DWCDegreeOfEstablishment
DWCEstablishmentMeans
GeoreferenceVerificationStatus
IndividualCount
LifeStage
OccurrenceID
OccurrenceRemarks
OccurrenceSex
OccurrenceStatus
OrganismQuantity
OrganismQuantityType
OtherCatalogNumbers
Pathway
RecordNumber
RecordedBy
RecordedByID
ReproductiveCondition
Vitality
- dwca.terms.organism module
- dwca.terms.outside_term module
- dwca.terms.record_level module
DWCAccessRights
DWCBasisOfRecord
DWCBibliographicCitation
DWCCollection
DWCCollectionCode
DWCDataGeneralizations
DWCDataset
DWCDatasetName
DWCDynamicProperties
DWCInformationWithheld
DWCInstitution
DWCInstitutionCode
DWCLanguage
DWCLicense
DWCModified
DWCOwnerInstitutionCode
DWCReferences
DWCRightsHolder
DWCType
- dwca.terms.resource_relationship module
- dwca.terms.taxon module
AcceptedNameUsage
AcceptedNameUsageID
CultivarEpithet
DWCClass
Family
GenericName
Genus
HigherClassification
InfragenericEpithet
InfraspecificEpithet
Kingdom
NameAccordingTo
NameAccordingToID
NamePublishedIn
NamePublishedInID
NamePublishedInYear
NomenclaturalCode
NomenclaturalStatus
Order
OriginalNameUsage
OriginalNameUsageID
ParentNameUsage
ParentNameUsageID
Phylum
ScientificName
ScientificNameAuthorship
ScientificNameID
SpecificEpithet
Subfamily
Subgenus
Subtribe
Superfamily
TaxonConceptID
TaxonID
TaxonRank
TaxonRemarks
TaxonomicStatus
Tribe
VerbatimTaxonRank
VernacularName
- Module contents
Module contents#
Darwin Core Base Class#
- class dwca.base.darwincore.DarwinCore#
Bases:
ABC
Base class of this package.
Methods
from_file
(path_to_archive)Generate a Darwin Core Standard from a file.
to_file
(path_to_archive[, encoding])Generate a Darwin Core file using the information of this instance.
- abstract classmethod from_file(path_to_archive: str) DarwinCore #
Generate a Darwin Core Standard from a file.
- Parameters:
- path_to_archivestr
Path of the archive file.
- Returns:
- DarwinCore
Instance of the Darwin Core Standard.
- abstract to_file(path_to_archive: str, encoding: str = 'utf-8') None #
Generate a Darwin Core file using the information of this instance.
- Parameters:
- path_to_archivestr
Path of the archive to generate.
- encodingstr, optional
Encoding of the corresponding files. Default “utf-8”.
Darwin Core Archive Class#
- class dwca.base.darwincore_archive.DarwinCoreArchive(_id: str = None)#
Bases:
DarwinCore
Represent a Darwin Core Archive file with all its elements.
- Parameters:
- _idstr, optional
A unique id for this Darwin Core Archive.
- Attributes:
core
DataFile: The file with the core of the archive.
extensions
List[DataFile]: A list with the extension of the archive.
id
str: A unique identifier for this DarwinCoreArchive.
language
Language: Language of the Darwin Core Archive register on metadata.
metadata
EML: Metadata instance, currently supported EML.
Methods
Metadata
([metadata])Metadata class of the Darwin Core Archive storing the file name of the archive elements.
from_file
(path_to_archive)Generate a Darwin Core Archive instance from an archive file (.zip).
generate_eml
([filename])Generate an EML file on the archive
to_file
(path_to_archive[, encoding])Generate a Darwin Core Archive file (.zip file) using the information of this instance.
- class Metadata(metadata: str = None)#
Bases:
XMLObject
Metadata class of the Darwin Core Archive storing the file name of the archive elements.
- Parameters:
- metadatastr, optional
Name of the metadata file (e.g.: eml.xml)
- Attributes:
- NAMESPACE_TAG
Methods
check_principal_tag
(tag, nmap)Checks if the tag is the Principal tag of the object.
from_string
(text)Generates XML Object from a string of an XML file.
from_xml
(file[, encoding])Generates an XML Object from an XML file.
get_dwc_class
(element)Extract the row type from an XML element instance.
get_principal_tag
()Returns the principal tag with namespaces if it is present.
object_to_element
(tag[, prefix])Generates an element using tag, adding namespace tag.
parse
(element, nmap)Parses an lxml.etree.Element in a Metadata instance.
Generate an element from a Metadata instance.
to_xml
()Generates text of an XML file.
- PRINCIPAL_TAG = 'archive'#
str : Require tag of the metadata
- classmethod get_dwc_class(element: Element) Type[DataFile] #
Extract the row type from an XML element instance.
- Parameters:
- elementlxml.etree.Element
XML element instance.
- Returns:
- Type[DataFile]
The Python
class
representing the class term.
- classmethod parse(element: Element, nmap: Dict) Metadata #
Parses an lxml.etree.Element in a Metadata instance.
- Parameters:
- elementlxml.etree.Element
XML element to be parsed.
- nmapDict
Namespace prefix:uri.
- Returns:
- Metadata
New Metadata instance with the data from the element.
- to_element() Element #
Generate an element from a Metadata instance.
- Returns:
- lxml.etree.Element
XML element from Metadata instance
- classmethod from_file(path_to_archive: str) DarwinCoreArchive #
Generate a Darwin Core Archive instance from an archive file (.zip).
- Parameters:
- path_to_archivestr
Path of the archive file.
- Returns:
- DarwinCoreArchive
Instance of the Darwin Core Archive.
- generate_eml(filename: str = 'eml.xml') None #
Generate an EML file on the archive
- Parameters:
- filenamestr
Filename for the EML file to be generated
- property id: str#
str: A unique identifier for this DarwinCoreArchive.
- to_file(path_to_archive: str, encoding: str = 'utf-8') None #
Generate a Darwin Core Archive file (.zip file) using the information of this instance.
- Parameters:
- path_to_archivestr
Path of the archive to generate.
- encodingstr, optional
Encoding of the corresponding files. Default “utf-8”.
Simple Darwin Core Class#
- class dwca.base.simple_darwincore.SimpleDarwinCore#
Bases:
DarwinCore
Class representing a Simple Darwin Core standard.
Methods
from_file
(path_to_archive)Generate a Darwin Core Standard from a file.
to_file
(path_to_archive[, encoding])Generate a Darwin Core file using the information of this instance.
- classmethod from_file(path_to_archive: str) SimpleDarwinCore #
Generate a Darwin Core Standard from a file.
- Parameters:
- path_to_archivestr
Path of the archive file.
- Returns:
- DarwinCore
Instance of the Darwin Core Standard.
- to_file(path_to_archive: str, encoding: str = 'utf-8') None #
Generate a Darwin Core file using the information of this instance.
- Parameters:
- path_to_archivestr
Path of the archive to generate.
- encodingstr, optional
Encoding of the corresponding files. Default “utf-8”.