es_sfgtools.data_models.metadata.campaign module
- class es_sfgtools.data_models.metadata.campaign.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.campaign.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.campaign.SurveyType(value)
Bases:
str,Enum- CENTER = 'center'
- CIRCLE = 'circledrive'
- FIXED_POINT = 'fixedpoint'
- GARPOS = 'garpos'
- MIXED = 'mixed'
- MOVEAROUND = 'movearound'
- OTHER = 'other'
- es_sfgtools.data_models.metadata.campaign.campaign_checks(campaign_year, campaign_interval, vessel_code)
Checks the campaign year, interval, and vessel code for validity.
- Parameters:
campaign_year (str) – The campaign year (e.g., “2023”).
campaign_interval (str) – The campaign interval (e.g., “A”).
vessel_code (str) – The 4-character vessel code.
- Returns:
A tuple containing the formatted campaign name and the uppercase vessel code.
- Return type:
Tuple[str, str]
- Raises:
ValueError – If the campaign year, interval, or vessel code are invalid.
- es_sfgtools.data_models.metadata.campaign.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.