es_sfgtools.data_models.metadata package
- class es_sfgtools.data_models.metadata.Benchmark(*, name: str, benchmarkID: str | None = '', aPrioriLocation: Location | None = None, start: Annotated[datetime | None, Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))] = None, end: Annotated[datetime | None, Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))] = None, dropPointLocation: Location | None = None, transponders: List[Transponder] | None = None)
Bases:
AttributeUpdater,BaseModel- benchmarkID: str | None
- end: datetime | None
- get_transponder_by_datetime(dt: datetime) Transponder | None
Get the transponder for a given datetime.
- Parameters:
dt (datetime) – The datetime to get the transponder for.
- Returns:
The transponder, or None if no transponder is found for the given datetime.
- Return type:
Optional[Transponder]
- model_computed_fields = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields = {'aPrioriLocation': FieldInfo(annotation=Union[Location, NoneType], required=False, default=None, description='The a priori location of the benchmark'), 'benchmarkID': FieldInfo(annotation=Union[str, NoneType], required=False, default='', description='The benchmark ID'), 'dropPointLocation': FieldInfo(annotation=Union[Location, NoneType], required=False, default=None, description='The drop point location of the benchmark'), 'end': FieldInfo(annotation=Union[datetime, NoneType], required=False, default=None, description='The end date of the benchmark', metadata=[Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))]), 'name': FieldInfo(annotation=str, required=True, description='The name of the benchmark'), 'start': FieldInfo(annotation=Union[datetime, NoneType], required=False, default=None, description='The start date of the benchmark', metadata=[Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))]), 'transponders': FieldInfo(annotation=Union[List[Transponder], NoneType], required=False, default_factory=list, description='The transponders attached to the benchmark')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- name: str
- start: datetime | None
- transponders: List[Transponder] | None
- class es_sfgtools.data_models.metadata.Campaign(*, name: str, type: str, vesselCode: str, start: Annotated[datetime, Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))], end: Annotated[datetime, Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))], vessel: Vessel | None = None, principalInvestigator: str | None = None, launchVesselName: str | None = None, recoveryVesselName: str | None = None, cruiseName: str | None = None, technicianName: str | None = None, technicianContact: str | None = None, surveys: List[Survey] = None)
Bases:
AttributeUpdater,BaseModelRepresents a campaign, which is a collection of surveys.
- check_survey_times()
Checks that survey times within the campaign do not overlap.
- Raises:
ValueError – If any survey times overlap.
- cruiseName: str | None
- end: datetime
- get_survey_by_datetime(dt: datetime) Survey
Returns the survey that encompasses the given datetime.
- Parameters:
dt (datetime) – The datetime to check against surveys.
- Returns:
The Survey object that contains the given datetime.
- Return type:
- Raises:
ValueError – If no survey is found for the given datetime.
- launchVesselName: str | None
- model_computed_fields = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config = {'arbitrary_types_allowed': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields = {'cruiseName': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'end': FieldInfo(annotation=datetime, required=True, description='The end date & time of the campaign', metadata=[Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))]), 'launchVesselName': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'name': FieldInfo(annotation=str, required=True, description='The name of the campaign in the format YYYY_A_VVVV'), 'principalInvestigator': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'recoveryVesselName': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'start': FieldInfo(annotation=datetime, required=True, description='The start date & time of the campaign', metadata=[Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))]), 'surveys': FieldInfo(annotation=List[Survey], required=False, default_factory=list), 'technicianContact': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'technicianName': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'type': FieldInfo(annotation=str, required=True, description='The type of the campaign (deploy | measure | etc)'), 'vessel': FieldInfo(annotation=Union[Vessel, NoneType], required=False, default=None, description='Instatiate Vessel object'), 'vesselCode': FieldInfo(annotation=str, required=True, description='The 4 digit vessel code, associated with a vessel metadata file')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- name: str
- principalInvestigator: str | None
- recoveryVesselName: str | None
- start: datetime
- technicianContact: str | None
- technicianName: str | None
- type: str
- vesselCode: str
- class es_sfgtools.data_models.metadata.Site(*, names: List[str], networks: List[str], timeOrigin: Annotated[datetime, Ge(ge=datetime.datetime(1901, 1, 1, 0, 0))], localGeoidHeight: float | None = 0, arrayCenter: Location | None = None, campaigns: List[Campaign] = None, benchmarks: List[Benchmark] = None, referenceFrames: List[ReferenceFrame] = None)
Bases:
BaseModel- class Config
Bases:
object- json_encoders = {<class 'datetime.datetime'>: <function Site.Config.<lambda>>}
- validate_assignment = True
- export_site(filepath: str)
- localGeoidHeight: float | None
- model_computed_fields = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config = {'json_encoders': {<class 'datetime.datetime'>: <function Site.Config.<lambda>>}, 'validate_assignment': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields = {'arrayCenter': FieldInfo(annotation=Union[Location, NoneType], required=False, default=None, description='The array center of the site'), 'benchmarks': FieldInfo(annotation=List[Benchmark], required=False, default_factory=list, description='The benchmarks associated with the site'), 'campaigns': FieldInfo(annotation=List[Campaign], required=False, default_factory=list, description='The campaigns associated with the site'), 'localGeoidHeight': FieldInfo(annotation=Union[float, NoneType], required=False, default=0, description='The local geoid height of the site'), 'names': FieldInfo(annotation=List[str], required=True, description='The names of the site, including the 4 character ID'), 'networks': FieldInfo(annotation=List[str], required=True, description='A list networks the site is part of'), 'referenceFrames': FieldInfo(annotation=List[ReferenceFrame], required=False, default_factory=list, description='The reference frames used for the site'), 'timeOrigin': FieldInfo(annotation=datetime, required=True, description='The time origin of the site', metadata=[Ge(ge=datetime.datetime(1901, 1, 1, 0, 0))])}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- names: List[str]
- networks: List[str]
- print_json()
- referenceFrames: List[ReferenceFrame]
- return_tats_for_campaign(campaign_name: str) List[Dict[str, Any]] | None
Return all TATs for a given campaign
- Parameters:
campaign_name (str) – The name of the campaign
- Returns:
A list of dictionaries containing Benchmark name, Transponder address, and TAT
- Return type:
List[Dict[str, Any]]
- run_component(component_type: TopLevelSiteGroups, component_metadata: dict, add_new: bool = False, update: bool = False, delete: bool = False)
Generic add, update or delete equipment for the site
- run_sub_component(component_type: TopLevelSiteGroups, component_name: str, sub_component_type: SubLevelSiteGroups, sub_component_metadata: dict, add_new: bool = False, update: bool = False, delete: bool = False)
Generic add, update or delete sub-components (e.g Transponder attached to Benchmark, Survey to campaign) for the site.
- timeOrigin: datetime
- top_level_map_components: ClassVar[Dict[str, Any]] = {TopLevelSiteGroups.BENCHMARKS: (<function Site.<lambda>>, <class 'es_sfgtools.data_models.metadata.benchmark.Benchmark'>), TopLevelSiteGroups.CAMPAIGNS: (<function Site.<lambda>>, <class 'es_sfgtools.data_models.metadata.campaign.Campaign'>), TopLevelSiteGroups.REFERENCE_FRAMES: (<function Site.<lambda>>, <class 'es_sfgtools.data_models.metadata.site.ReferenceFrame'>)}
- validate_components()
If there are no benchmarks, transponders, campaigns, or surveys, print a warning.
- class es_sfgtools.data_models.metadata.Survey(*, id: str, type: str | SurveyType, benchmarkIDs: List[str], start: Annotated[datetime, Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))], end: Annotated[datetime, Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))], notes: str | None = None, commands: str | None = None)
Bases:
AttributeUpdater,BaseModelRepresents a single survey within a campaign.
- benchmarkIDs: List[str]
- commands: str | None
- end: datetime
- id: str
- model_computed_fields = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields = {'benchmarkIDs': FieldInfo(annotation=List[str], required=True, description='Benchmark IDs associated with the survey'), 'commands': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='Log of commands'), 'end': FieldInfo(annotation=datetime, required=True, description='The end date & time of the survey', metadata=[Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))]), 'id': FieldInfo(annotation=str, required=True, description='The unique ID of the survey'), 'notes': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='Any additional notes about the survey'), 'start': FieldInfo(annotation=datetime, required=True, description='The start date & time of the survey', metadata=[Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))]), 'type': FieldInfo(annotation=Union[str, SurveyType], required=True, description='The type of the survey (e.g. circle | fixed point | mixed)')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- notes: str | None
- start: datetime
- type: str | SurveyType
- class es_sfgtools.data_models.metadata.SurveyType(value)
Bases:
str,Enum- CENTER = 'center'
- CIRCLE = 'circledrive'
- FIXED_POINT = 'fixedpoint'
- GARPOS = 'garpos'
- MIXED = 'mixed'
- MOVEAROUND = 'movearound'
- OTHER = 'other'
- class es_sfgtools.data_models.metadata.Vessel(*, name: str, type: str, model: str, serialNumber: str | None = None, start: Annotated[datetime | None, Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))] = None, end: Annotated[datetime | None, Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))] = None, imuSensors: List[ImuSensor] = None, atdOffsets: List[AtdOffset] = None, gnssAntennas: List[GnssAntenna] = None, gnssReceivers: List[GnssReceiver] = None, acousticTransducers: List[AcousticTransducer] = None, acousticTransceivers: List[AcousticTransceiver] = None)
Bases:
AttributeUpdater,BaseModel- acousticTransceivers: List[AcousticTransceiver]
- acousticTransducers: List[AcousticTransducer]
- classmethod check_required_fields(value)
- end: datetime | None
- equipment_map: ClassVar[Dict[str, Any]] = {EquipmentType.ACOUSTIC_TRANSCEIVER: (<function Vessel.<lambda>>, <class 'es_sfgtools.data_models.metadata.vessel.AcousticTransceiver'>), EquipmentType.ACOUSTIC_TRANSDUCER: (<function Vessel.<lambda>>, <class 'es_sfgtools.data_models.metadata.vessel.AcousticTransducer'>), EquipmentType.ATD_OFFSETS: (<function Vessel.<lambda>>, <class 'es_sfgtools.data_models.metadata.vessel.AtdOffset'>), EquipmentType.GNSS_ANTENNAS: (<function Vessel.<lambda>>, <class 'es_sfgtools.data_models.metadata.vessel.GnssAntenna'>), EquipmentType.GNSS_RECEIVERS: (<function Vessel.<lambda>>, <class 'es_sfgtools.data_models.metadata.vessel.GnssReceiver'>), EquipmentType.IMU_SENSORS: (<function Vessel.<lambda>>, <class 'es_sfgtools.data_models.metadata.vessel.ImuSensor'>)}
- export_vessel(filepath: str)
Export vessel data to a JSON file.
- Parameters:
filepath (str) – The path to the JSON file.
- classmethod from_json(filepath: str) Vessel
Import vessel data from a JSON file.
- Parameters:
filepath (str) – The path to the JSON file.
- Returns:
The vessel object.
- Return type:
- gnssAntennas: List[GnssAntenna]
- gnssReceivers: List[GnssReceiver]
- model: str
- model_computed_fields = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields = {'acousticTransceivers': FieldInfo(annotation=List[AcousticTransceiver], required=False, default_factory=list), 'acousticTransducers': FieldInfo(annotation=List[AcousticTransducer], required=False, default_factory=list), 'atdOffsets': FieldInfo(annotation=List[AtdOffset], required=False, default_factory=list), 'end': FieldInfo(annotation=Union[datetime, NoneType], required=False, default=None, metadata=[Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))]), 'gnssAntennas': FieldInfo(annotation=List[GnssAntenna], required=False, default_factory=list), 'gnssReceivers': FieldInfo(annotation=List[GnssReceiver], required=False, default_factory=list), 'imuSensors': FieldInfo(annotation=List[ImuSensor], required=False, default_factory=list), 'model': FieldInfo(annotation=str, required=True, description='The model of the vessel'), 'name': FieldInfo(annotation=str, required=True, description='The 4 digit name of the vessel'), 'serialNumber': FieldInfo(annotation=Union[str, NoneType], required=False, default=None), 'start': FieldInfo(annotation=Union[datetime, NoneType], required=False, default=None, metadata=[Gt(gt=datetime.datetime(1901, 1, 1, 0, 0))]), 'type': FieldInfo(annotation=str, required=True, description='The type of the vessel. e.g. waveglider')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- name: str
- print_json()
Print the vessel data as a JSON string.
- run_equipment(serial_number: str, equipment_type: EquipmentType, equipment_metadata: dict, add_new: bool = False, update: bool = False, delete: bool = False)
Add, update, or delete a survey vessel equipment.
- Parameters:
serial_number (str) – The serial number of the equipment.
equipment_type (EquipmentType) – The type of the equipment.
equipment_metadata (dict) – The metadata of the equipment.
add_new (bool, optional) – Whether to add a new equipment, by default False.
update (bool, optional) – Whether to update an existing equipment, by default False.
delete (bool, optional) – Whether to delete an existing equipment, by default False.
- serialNumber: str | None
- start: datetime | None
- type: str
- es_sfgtools.data_models.metadata.classify_survey_type(survey_type: str) SurveyType
Classifies the survey type based on the provided string.
- Parameters:
survey_type (str) – The survey type as a string.
- Returns:
The classified SurveyType.
- Return type:
- Raises:
ValueError – If the survey type is not recognized.
- es_sfgtools.data_models.metadata.import_site(filepath: str)
Import site data from a JSON file.
- es_sfgtools.data_models.metadata.import_vessel(filepath: str) Vessel
Import vessel data from a JSON file.
- Parameters:
filepath (str) – The path to the JSON file.
- Returns:
The vessel object.
- Return type:
Submodules
- es_sfgtools.data_models.metadata.benchmark module
BatteryVoltageBenchmarkExtraSensorsTATTransponderTransponder.addressTransponder.batteryCapacityTransponder.batteryVoltageTransponder.endTransponder.extraSensorsTransponder.get_tat_by_datetime()Transponder.modelTransponder.model_computed_fieldsTransponder.model_configTransponder.model_fieldsTransponder.notesTransponder.serialNumberTransponder.startTransponder.tatTransponder.uid
- es_sfgtools.data_models.metadata.campaign module
CampaignCampaign.ConfigCampaign.check_survey_times()Campaign.cruiseNameCampaign.endCampaign.get_survey_by_datetime()Campaign.launchVesselNameCampaign.model_computed_fieldsCampaign.model_configCampaign.model_fieldsCampaign.nameCampaign.principalInvestigatorCampaign.recoveryVesselNameCampaign.startCampaign.surveysCampaign.technicianContactCampaign.technicianNameCampaign.typeCampaign.vesselCampaign.vesselCode
SurveySurveyTypecampaign_checks()classify_survey_type()
- es_sfgtools.data_models.metadata.catalogs module
- es_sfgtools.data_models.metadata.site module
ReferenceFrameSiteSite.ConfigSite.arrayCenterSite.benchmarksSite.campaignsSite.export_site()Site.from_json()Site.localGeoidHeightSite.model_computed_fieldsSite.model_configSite.model_fieldsSite.namesSite.networksSite.print_json()Site.referenceFramesSite.return_tats_for_campaign()Site.run_component()Site.run_sub_component()Site.timeOriginSite.top_level_map_componentsSite.validate_components()
SubLevelSiteGroupsTopLevelSiteGroupsimport_site()
- es_sfgtools.data_models.metadata.utils module
- es_sfgtools.data_models.metadata.vessel module
AcousticTransceiverAcousticTransceiver.delayIncludedInTWTTAcousticTransceiver.endAcousticTransceiver.frequencyAcousticTransceiver.model_computed_fieldsAcousticTransceiver.model_configAcousticTransceiver.model_fieldsAcousticTransceiver.serialNumberAcousticTransceiver.startAcousticTransceiver.triggerDelayAcousticTransceiver.type
AcousticTransducerAtdOffsetEquipmentTypeGnssAntennaGnssReceiverImuSensorVesselVessel.acousticTransceiversVessel.acousticTransducersVessel.atdOffsetsVessel.check_required_fields()Vessel.endVessel.equipment_mapVessel.export_vessel()Vessel.from_json()Vessel.gnssAntennasVessel.gnssReceiversVessel.imuSensorsVessel.modelVessel.model_computed_fieldsVessel.model_configVessel.model_fieldsVessel.nameVessel.print_json()Vessel.run_equipment()Vessel.serialNumberVessel.startVessel.type
import_vessel()