Skip to content

Commit cd9d1b0

Browse files
committed
update expedition output printing
1 parent a0da379 commit cd9d1b0

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

src/virtualship/expedition/do_expedition.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ def do_expedition(expedition_dir: str | Path, input_data: Path | None = None) ->
3232
:param expedition_dir: The base directory for the expedition.
3333
:param input_data: Input data folder (override used for testing).
3434
"""
35+
print("\n╔═════════════════════════════════════════════════╗")
36+
print("║ VIRTUALSHIP EXPEDITION STATUS ║")
37+
print("╚═════════════════════════════════════════════════╝")
38+
3539
if isinstance(expedition_dir, str):
3640
expedition_dir = Path(expedition_dir)
3741

@@ -57,6 +61,8 @@ def do_expedition(expedition_dir: str | Path, input_data: Path | None = None) ->
5761
input_data=input_data,
5862
)
5963

64+
print("\n---- WAYPOINT VERIFICATION ----")
65+
6066
# verify schedule is valid
6167
schedule.verify(ship_config.ship_speed_knots, input_data)
6268

@@ -83,6 +89,8 @@ def do_expedition(expedition_dir: str | Path, input_data: Path | None = None) ->
8389
shutil.rmtree(expedition_dir.joinpath("results"))
8490
os.makedirs(expedition_dir.joinpath("results"))
8591

92+
print("\n----- EXPEDITION SUMMARY ------")
93+
8694
# calculate expedition cost in US$
8795
assert schedule.waypoints[0].time is not None, (
8896
"First waypoint has no time. This should not be possible as it should have been verified before."
@@ -91,20 +99,26 @@ def do_expedition(expedition_dir: str | Path, input_data: Path | None = None) ->
9199
cost = expedition_cost(schedule_results, time_past)
92100
with open(expedition_dir.joinpath("results", "cost.txt"), "w") as file:
93101
file.writelines(f"cost: {cost} US$")
94-
print(f"This expedition took {time_past} and would have cost {cost:,.0f} US$.")
102+
print(f"\nExpedition duration: {time_past}\nExpedition cost: US$ {cost:,.0f}.")
103+
104+
print("\n--- MEASUREMENT SIMULATIONS ---")
95105

96106
# simulate measurements
97-
print("Simulating measurements. This may take a while..")
107+
print("\nSimulating measurements. This may take a while...\n")
98108
simulate_measurements(
99109
expedition_dir,
100110
ship_config,
101111
input_data,
102112
schedule_results.measurements_to_simulate,
103113
)
104-
print("Done simulating measurements.")
114+
print("\nAll measurement simulations are complete.")
105115

106-
print("Your expedition has concluded successfully!")
107-
print("Your measurements can be found in the results directory.")
116+
print("\n----- EXPEDITION RESULTS ------")
117+
print("\nYour expedition has concluded successfully!")
118+
print(
119+
f"Your measurements can be found in the '{expedition_dir}/results' directory."
120+
)
121+
print("\n------------- END -------------\n")
108122

109123

110124
def _load_input_data(

src/virtualship/expedition/schedule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def verify(
139139
# check if all waypoints are in water
140140
# this is done by picking an arbitrary provided fieldset and checking if UV is not zero
141141

142-
print("Verifying all waypoints are on water..")
142+
print("\nVerifying all waypoints are on water...")
143143

144144
# get all available fieldsets
145145
available_fieldsets = []
@@ -178,7 +178,7 @@ def verify(
178178
raise ScheduleError(
179179
f"The following waypoints are on land: {['#' + str(wp_i) + ' ' + str(wp) for (wp_i, wp) in land_waypoints]}"
180180
)
181-
print("Good, all waypoints are on water.")
181+
print("... Good, all waypoints are on water.")
182182

183183
# check that ship will arrive on time at each waypoint (in case no unexpected event happen)
184184
time = self.waypoints[0].time

0 commit comments

Comments
 (0)