Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5c5bf9a
draft script for converting MFP CSV to YAML schedule
iuryt Jan 28, 2025
40c7ff9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 28, 2025
366dede
add openpyxl
iuryt Feb 3, 2025
d046444
add mfp_to_yaml function
iuryt Feb 3, 2025
e3199fa
add new command to init to accept mfp file as input
iuryt Feb 3, 2025
d9fe46a
delete files from scripts/
iuryt Feb 3, 2025
7dc9bd7
deleted scripts files
iuryt Feb 3, 2025
a79433c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 3, 2025
11332f8
export the schedule body instead of saving file
iuryt Feb 13, 2025
ad54992
change name of cli param and adapt for new mfp_to_yaml function
iuryt Feb 13, 2025
66adb18
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 13, 2025
2672afa
add warning message for time entry on yaml
iuryt Feb 13, 2025
a370641
change to pydantic and change name of variables
iuryt Feb 13, 2025
b87d944
add XBT
iuryt Feb 13, 2025
eba08b8
accept nonetype time
iuryt Feb 13, 2025
c0a52ac
change to Waypoint to BaseModel and add field_serializer for instrume…
iuryt Feb 13, 2025
526d2af
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 13, 2025
c51043d
remove restriction for version
iuryt Feb 14, 2025
f3daaa7
add checking for columns from excel file
iuryt Feb 14, 2025
4c59420
add unit tests
iuryt Feb 14, 2025
b67b15d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 14, 2025
6f63cd4
Add update comments and var naming
VeckoTheGecko Feb 14, 2025
222df85
Remove buffering from mfp conversion
VeckoTheGecko Feb 14, 2025
c94567b
update references to Waypoint
VeckoTheGecko Feb 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/virtualship/expedition/space_time_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,19 @@ def _check_lon_lat_domain(self) -> Self:
raise ValueError("minimum_depth must be less than maximum_depth")
return self


class TimeRange(BaseModel):
"""Defines the temporal boundaries for a space-time region."""

start_time: datetime
end_time: datetime
start_time: datetime | None = None
end_time: datetime | None = None

@model_validator(mode="after")
def _check_time_range(self) -> Self:
if not self.start_time < self.end_time:
raise ValueError("start_time must be before end_time")
if self.start_time and self.end_time:
if not self.start_time < self.end_time:
raise ValueError("start_time must be before end_time")
return self
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VeckoTheGecko @ammedd
While using pydantic, I had to change this to accept nonetype time, but this means that when we do schedule.from_yaml() for fetch it will not give any error, right? What should we do?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I thought that pydantic would have a way of disabling validation during the initialisation of the object, but looking further at the documentation its looking that that isn't possible ... . Longterm it would be good to have start_time and end_time not none, but perhaps thats something for a future PR



class SpaceTimeRegion(BaseModel):
"""An space-time region with spatial and temporal boundaries."""

Expand Down