mth5.groups.survey
Classes
Collection helper for surveys under |
|
Wrapper for a single survey at |
Module Contents
- class mth5.groups.survey.MasterSurveyGroup(group: h5py.Group, **kwargs: Any)[source]
Bases:
mth5.groups.BaseGroupCollection helper for surveys under
Experiment/Surveys.Provides helpers to add, fetch, or remove surveys and to summarize all channels in the experiment.
Examples
>>> from mth5 import mth5 >>> m5 = mth5.MTH5() >>> _ = m5.open_mth5("/tmp/example.mth5", mode="a") >>> surveys = m5.surveys_group >>> _ = surveys.add_survey("survey_01") >>> surveys.channel_summary.head()
- property channel_summary: pandas.DataFrame[source]
Return a DataFrame summarizing all channels across surveys.
- Returns:
Columns include survey, station, run, location, component, start/end, sample info, orientation, units, and HDF5 reference.
- Return type:
pandas.DataFrame
Examples
>>> summary = surveys.channel_summary >>> set(summary.columns) >= {"survey", "station", "run", "component"} True
- add_survey(survey_name: str, survey_metadata: mt_metadata.timeseries.Survey | None = None) SurveyGroup[source]
Add or fetch a survey at
/Experiment/Surveys/<name>.- Parameters:
survey_name (str) – Survey identifier; validated with
validate_name.survey_metadata (Survey, optional) – Metadata container used to seed the survey attributes.
- Returns:
Wrapper for the created or existing survey.
- Return type:
- Raises:
ValueError – If
survey_nameis empty.MTH5Error – If the provided metadata id conflicts with the group name.
Examples
>>> survey = surveys.add_survey("survey_01") >>> survey.metadata.id 'survey_01'
- get_survey(survey_name: str) SurveyGroup[source]
Return an existing survey by name.
- Parameters:
survey_name (str) – Existing survey name.
- Returns:
Wrapper for the requested survey.
- Return type:
- Raises:
MTH5Error – If the survey does not exist.
Examples
>>> existing = surveys.get_survey("survey_01") >>> existing.metadata.id 'survey_01'
- class mth5.groups.survey.SurveyGroup(group: h5py.Group, survey_metadata: mt_metadata.timeseries.Survey | None = None, **kwargs: Any)[source]
Bases:
mth5.groups.BaseGroupWrapper for a single survey at
Experiment/Surveys/<id>.Handles survey-level metadata, child groups (stations, reports, filters, standards), and synchronization utilities.
Examples
>>> survey = surveys.add_survey("survey_01") >>> survey.metadata.id 'survey_01'
- initialize_group(**kwargs: Any) None[source]
Create default subgroups and write survey metadata.
- Parameters:
**kwargs – Additional attributes to set on the instance before initialization.
Examples
>>> survey.initialize_group()
- metadata() mt_metadata.timeseries.Survey[source]
Survey metadata enriched with station and filter information.
- property stations_group: mth5.groups.MasterStationGroup[source]
- property filters_group: mth5.groups.FiltersGroup[source]
Convenience accessor for
/Survey/Filtersgroup.
- property reports_group: mth5.groups.ReportsGroup[source]
Convenience accessor for
/Survey/Reportsgroup.
- property standards_group: mth5.groups.StandardsGroup[source]
Convenience accessor for
/Survey/Standardsgroup.
- update_survey_metadata(survey_dict: dict[str, Any] | None = None) None[source]
Deprecated alias for
update_metadata().- Raises:
DeprecationWarning – Always raised to direct callers to
update_metadata.
Examples
>>> survey.update_survey_metadata() Traceback (most recent call last): ... DeprecationWarning: 'update_survey_metadata' has been deprecated use 'update_metadata()'
- update_metadata(survey_dict: dict[str, Any] | None = None) None[source]
Synchronize survey metadata from station summaries.
- Parameters:
survey_dict (dict, optional) – Additional metadata values to merge before synchronization.
Notes
Updates survey start/end dates and bounding box from station summaries, then writes metadata to HDF5.
Examples
>>> _ = survey.update_metadata() >>> survey.metadata.time_period.start_date '2020-01-01'