The EbasMetadata object defines the syntax of the ebas.io file objects. It is used internally by the io.file objects for creating the output files and parsing input files.
The user migtht, when creating an output file use the object for retrieving information about how to set a specific attribute in the file object in order to create a specifig metadata element in the output file.
Or vice versa, when reading an input file, know which attribute to access when the contents of a specific metadata element in the file is needed.
Please find below some examples how to list this kind of information interactively.
This part is needed for all the examples below.
from ebas.io.ebasmetadata import EbasMetadata, EBAS_IOFORMAT_NASA_AMES
meta = EbasMetadata('EBAS_1.1', EBAS_IOFORMAT_NASA_AMES)
This code sequence lists all possible metadata elements in EBAS. Each line contains the tag (the tag used in the Nasa Ames files) and the key (the key used in the io object's metadata).
for elem in meta.metadata:
if not 'renamed_tag' in elem:
print "{:45s} {}".format(elem['tag']+":", elem['key'])
If you see a metadata element in the NASA Ames file and want to access it after reading the file using the ebas.io module, you need to find the element's key when knowing the tag:
meta.metadata_tags['Instrument manufacturer']['key']
meta.metadata_tags['Orig. time res.']['key']
The other way around, you might want to find the tag to a known key:
meta.metadata_keys['instr_manufacturer']['tag']