mt_metadata.timeseries.station
Classes
Base class for all metadata objects with Pydantic validation. |
Module Contents
- class mt_metadata.timeseries.station.Station(**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
- channel_layout: Annotated[mt_metadata.common.ChannelLayoutEnum, Field(default=ChannelLayoutEnum.X, description='How the station channels were laid out.', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['X']})]
- channels_recorded: Annotated[list[str], Field(default_factory=list, description='List of components recorded by the station. Should be a summary of all channels recorded. Dropped channels will be recorded in Run metadata.', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['"[ Ex, Ey, Hx, Hy, Hz, T]"']})]
- comments: Annotated[mt_metadata.common.Comment, Field(default_factory=Comment, description='Any comments on the station.', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['cows chewed cables']})]
- data_type: Annotated[mt_metadata.common.DataTypeEnum, Field(default='BBMT', description='Type of data recorded. If multiple types input as a comma separated list.', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['BBMT']})]
- fdsn: Annotated[mt_metadata.common.Fdsn, Field(default_factory=Fdsn, description='FDSN information for the station.', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['Fdsn()']})]
- geographic_name: Annotated[str, Field(default='', description='Closest geographic name to the station, usually a city, but could be another common geographic location.', alias=None, json_schema_extra={'units': None, 'required': True, 'examples': ['Whitehorse, YK']})]
- 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']})]
- run_list: Annotated[list[str], 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 ]']})]
- location: Annotated[mt_metadata.common.StationLocation, Field(default_factory=StationLocation, description='Location of the station.', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['StationLocation(latitude=60.0, longitude=-135.0)']})]
- orientation: Annotated[mt_metadata.common.Orientation, Field(default_factory=Orientation, description='Orientation of the station.', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['Orientation(north=0, east=0, vertical=1)']})]
- acquired_by: Annotated[mt_metadata.common.AuthorPerson, Field(default_factory=AuthorPerson, description='Group or person who acquired the data.', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['Person()']})]
- provenance: Annotated[mt_metadata.common.Provenance, Field(default_factory=Provenance, description='Provenance of the data.', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ['Provenance()']})]
- time_period: Annotated[mt_metadata.common.TimePeriod, Field(default_factory=TimePeriod, description='Time period of the data.', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ["TimePeriod(start='2020-01-01', end='2020-12-31')"]})]
- runs: Annotated[mt_metadata.common.list_dict.ListDict | list | dict | collections.OrderedDict | tuple, Field(default_factory=ListDict, description='List of runs recorded by the station.', alias=None, json_schema_extra={'units': None, 'required': False, 'examples': ["[Run(id='mt001a'), Run(id='mt001b'), Run(id='mt001c')]"]})]
- classmethod validate_comments(value, info)
- classmethod validate_list_of_strings(value, info)
Validate that the value is a list of strings.
- validate_runs_and_channels_recorded()
Validate that the value is a list of strings.
- validate_station_id()
Validate that the value is a list of strings.
- classmethod validate_runs(value, info)
- merge(other, inplace=False)
- property n_runs: int
Return the number of runs in the station.
- Returns:
number of runs in the station
- Return type:
int
- has_run(run_id)
Check to see if the run id already exists
- Parameters:
run_id (string) – run id verbatim
- Returns:
Tru if exists, False if not
- Return type:
boolean
- run_index(run_id)
Get the index of the run_id
- Parameters:
run_id (string) – run id verbatim
- Returns:
index of the run
- Return type:
integer
- update_channels_recorded()
Update the channels recorded lists based on the channels in the run.
- update_run_list()
Update the run list based on the runs in the station.
- update_time_period()
update time period from run information
- update_all()
Update the time period, channels recorded and run list.
- add_run(run_obj, update=True)
Add a run, if one of the same name exists overwrite it.
- Parameters:
run_obj (
mt_metadata.timeseries.Run) – run object to add
- get_run(run_id)
Get a
mt_metadata.timeseries.Runobject from the given id- Parameters:
run_id (string) – run id verbatim
- remove_run(run_id, update=True)
remove a run from the survey
- Parameters:
run_id (string) – run id verbatim
- update_run_keys()
Update the keys in the runs ListDict to match current run IDs.
This is useful when run IDs have been modified after runs were added to the station, ensuring that runs can be accessed by their current ID values.
- Returns:
mapping of old keys to new keys
- Return type:
dict
Example
>>> station = Station() >>> run = Run() >>> run.id = "" # empty ID initially >>> station.add_run(run) >>> run.id = "001" # update the ID >>> key_mapping = station.update_run_keys() >>> print(key_mapping) # {'': '001'} >>> # Now run can be accessed as station.runs['001']
- sort_runs_by_time(inplace=True, ascending=True)
return a list of runs sorted by start time in the order of ascending or descending.
- Parameters:
ascending (TYPE, optional) – DESCRIPTION, defaults to True
- Returns:
DESCRIPTION
- Return type:
TYPE