mt_metadata.transfer_functions.io.emtfxml.metadata.site
Classes
Base class for all metadata objects with Pydantic validation. |
Module Contents
- class mt_metadata.transfer_functions.io.emtfxml.metadata.site.Site(**data)
Bases:
mt_metadata.base.MetadataBaseBase class for all metadata objects with Pydantic validation.
MetadataBase extends DotNotationBaseModel (which inherits from Pydantic’s BaseModel) to provide automatic validation according to metadata standards. It adds functionality beyond dictionaries, supporting JSON, XML, pandas Series, and other formats for metadata interchange.
- _skip_equals
Private attribute listing fields to skip in equality comparisons
- Type:
list[str]
- _fields
Private attribute caching field information
- Type:
dict[str, Any]
Notes
All field assignments are validated automatically via Pydantic
None values are converted to appropriate defaults (empty string or 0.0)
Supports nested attribute access via dot notation
Thread-safe for read operations after initialization
- project: Annotated[str, Field(default='', description='Name of the project', alias=None, pattern='^[a-zA-Z0-9-_]*$', json_schema_extra={'units': None, 'required': True, 'examples': ['USMTArray']})]
- survey: Annotated[str, Field(default='', description='Name of the survey', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['MT 2020']})]
- year_collected: Annotated[mt_metadata.common.mttime.MTime | str | float | int | numpy.datetime64 | pandas.Timestamp, Field(default=None, description='Year data collected', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['2020']})]
- country: Annotated[str, Field(default='', description='Country where data was collected', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['USA']})]
- id: Annotated[str, Field(default='', description='Station ID name. This should be an alpha numeric name that is typically 5-6 characters long. Commonly the project name in 2 or 3 letters and the station number.', alias=None, pattern='^[a-zA-Z0-9]*$', json_schema_extra={'units': None, 'required': True, 'examples': ['MT001']})]
- name: Annotated[str, Field(default='', description='closest geographic name to the station', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['"Whitehorse, YK"']})]
- acquired_by: Annotated[str, Field(default='', description='Person or group who collected the data', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['MT Group']})]
- start: Annotated[mt_metadata.common.mttime.MTime | str | float | int | numpy.datetime64 | pandas.Timestamp, Field(default_factory=lambda: MTime(time_stamp=None), description='Date time when the data collection started', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['2020-01-01T12:00:00']})]
- end: Annotated[mt_metadata.common.mttime.MTime | str | float | int | numpy.datetime64 | pandas.Timestamp, Field(default_factory=lambda: MTime(time_stamp=None), description='Date time when the data collection ended', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['2020-05-01T12:00:00']})]
- run_list: Annotated[list[str] | None, Field(default_factory=list, description='list of runs recorded by the station. Should be a summary of all runs recorded', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['"[ mt001a, mt001b, mt001c ]"']})]
- data_quality_notes: Annotated[mt_metadata.transfer_functions.io.emtfxml.metadata.DataQualityNotes, Field(default_factory=DataQualityNotes, description='Notes on the data quality', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['Data quality is good']})]
- data_quality_warnings: Annotated[mt_metadata.transfer_functions.io.emtfxml.metadata.DataQualityWarnings, Field(default_factory=DataQualityWarnings, description='Warnings about the data quality', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['Data quality is questionable']})]
- orientation: Annotated[mt_metadata.transfer_functions.io.emtfxml.metadata.Orientation, Field(default_factory=Orientation, description='Orientation of the site', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ["Orientation('layout=orthogonal, angle_to_geographic_north=0.0')"]})]
- location: Annotated[mt_metadata.transfer_functions.io.emtfxml.metadata.Location, Field(default_factory=Location, description='Location of the site', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ["Location('latitude=60.0, longitude=-135.0, declination=10.0')"]})]
- comments: Annotated[mt_metadata.common.Comment | str | None, Field(default_factory=Comment, description='Comments about the site', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ["Comment('This is a comment about the site')"]})]
- classmethod validate_start(field_value)
- classmethod validate_year_collected(field_value)
- classmethod validate_string_fields(field_value)
Validate string fields, converting None to empty string.
- classmethod validate_comments(value)
Validate that the value is a valid string.
- classmethod validate_run_list(value)
Validate that the value is a list of strings.
- read_dict(input_dict)
Read the input dictionary and update the object’s attributes.
- Parameters:
input_dict (dict) – The input dictionary containing the data to read.
- to_xml(string=False, required=True)
Convert the object to XML format.
- Parameters:
string (bool, optional) – Whether to return the XML as a string, by default False
required (bool, optional) – Whether the XML is required, by default True
- Returns:
The XML representation of the object.
- Return type:
str | et.Element