mt_metadata.timeseries.station ============================== .. py:module:: mt_metadata.timeseries.station Classes ------- .. autoapisummary:: mt_metadata.timeseries.station.Station Module Contents --------------- .. py:class:: Station(**data) Bases: :py:obj:`mt_metadata.base.MetadataBase` Base 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. .. attribute:: _skip_equals Private attribute listing fields to skip in equality comparisons :type: list[str] .. attribute:: _fields Private attribute caching field information :type: dict[str, Any] .. rubric:: 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 .. py:attribute:: channel_layout :type: 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']})] .. py:attribute:: channels_recorded :type: 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]"']})] .. py:attribute:: comments :type: 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']})] .. py:attribute:: data_type :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']})] .. py:attribute:: fdsn :type: 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()']})] .. py:attribute:: geographic_name :type: 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']})] .. py:attribute:: id :type: 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']})] .. py:attribute:: run_list :type: 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 ]']})] .. py:attribute:: location :type: 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)']})] .. py:attribute:: orientation :type: 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)']})] .. py:attribute:: acquired_by :type: 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()']})] .. py:attribute:: provenance :type: 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()']})] .. py:attribute:: time_period :type: 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')"]})] .. py:attribute:: runs :type: 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')]"]})] .. py:method:: validate_comments(value, info) :classmethod: .. py:method:: validate_list_of_strings(value, info) :classmethod: Validate that the value is a list of strings. .. py:method:: validate_runs_and_channels_recorded() Validate that the value is a list of strings. .. py:method:: validate_station_id() Validate that the value is a list of strings. .. py:method:: validate_runs(value, info) :classmethod: .. py:method:: merge(other, inplace=False) .. py:property:: n_runs :type: int Return the number of runs in the station. :return: number of runs in the station :rtype: int .. py:method:: has_run(run_id) Check to see if the run id already exists :param run_id: run id verbatim :type run_id: string :return: Tru if exists, False if not :rtype: boolean .. py:method:: run_index(run_id) Get the index of the run_id :param run_id: run id verbatim :type run_id: string :return: index of the run :rtype: integer .. py:method:: update_channels_recorded() Update the channels recorded lists based on the channels in the run. .. py:method:: update_run_list() Update the run list based on the runs in the station. .. py:method:: update_time_period() update time period from run information .. py:method:: update_all() Update the time period, channels recorded and run list. .. py:method:: add_run(run_obj, update=True) Add a run, if one of the same name exists overwrite it. :param run_obj: run object to add :type run_obj: :class:`mt_metadata.timeseries.Run` .. py:method:: get_run(run_id) Get a :class:`mt_metadata.timeseries.Run` object from the given id :param run_id: run id verbatim :type run_id: string .. py:method:: remove_run(run_id, update=True) remove a run from the survey :param run_id: run id verbatim :type run_id: string .. py:method:: 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 :rtype: dict .. rubric:: 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'] .. py:method:: sort_runs_by_time(inplace=True, ascending=True) return a list of runs sorted by start time in the order of ascending or descending. :param ascending: DESCRIPTION, defaults to True :type ascending: TYPE, optional :return: DESCRIPTION :rtype: TYPE