@@ -331,6 +331,9 @@ def SampleT(particle, fieldset, time):
331331 # run the model for the length of the sample_lons list
332332 for i in range (len (sample_lons )- 1 ):
333333
334+ if i % 96 == 0 :
335+ print (f"Gathered data { timedelta (seconds = total_time )} hours since start." )
336+
334337 # execute the ADCP kernels to sample U and V and underway T and S
335338 if config .ADCP_data :
336339 pset_ADCP .execute ([SampleVel ], dt = adcp_dt , runtime = 1 , verbose_progress = False )
@@ -384,8 +387,6 @@ def SampleT(particle, fieldset, time):
384387 total_time += adcp_dt
385388 pset_ADCP .time_nextloop [:] = total_time
386389 pset_UnderwayData .time_nextloop [:] = total_time
387- if i % 96 == 0 :
388- print (f"Gathered data { timedelta (seconds = total_time )} hours since start." )
389390
390391 # write the final locations of the ADCP and Underway data particles
391392 if config .ADCP_data :
@@ -396,7 +397,7 @@ def SampleT(particle, fieldset, time):
396397 UnderwayData_output_file .write_latest_locations (pset_UnderwayData , time = total_time )
397398 print ("Cruise has ended. Please wait for drifters and/or Argo floats to finish." )
398399
399- return drifter_time , argo_time
400+ return drifter_time , argo_time , total_time
400401
401402
402403def drifter_deployments (config , drifter_time ):
@@ -577,10 +578,26 @@ def postprocess():
577578 continue
578579 print ("CTD data postprocessed." )
579580
581+ def costs (config , total_time ):
582+ '''Calculates cost of the virtual ship'''
583+
584+ ship_cost_per_day = 30000
585+ drifter_deploy_cost = 2500
586+ argo_deploy_cost = 15000
587+
588+ ship_cost = ship_cost_per_day / 24 * total_time // 3600
589+ argo_cost = len (config .argo_deploylocations ) * argo_deploy_cost
590+ drifter_cost = len (config .drifter_deploylocations ) * drifter_deploy_cost
591+
592+ cost = ship_cost + argo_cost + drifter_cost
593+ return cost
594+
580595if __name__ == '__main__' :
581596 config = VirtualShipConfiguration ('student_input.json' )
582- drifter_time , argo_time = sailship (config )
583- drifter_deployments (config , drifter_time )
584- argo_deployments (config , argo_time )
585- postprocess ()
586- print ("All data has been gathered and postprocessed, returning home." )
597+ drifter_time , argo_time , total_time = sailship (config )
598+ # drifter_deployments(config, drifter_time)
599+ # argo_deployments(config, argo_time)
600+ # postprocess()
601+ print ("All data has been gathered and postprocessed, returning home." )
602+ cost = costs (config , total_time )
603+ print (f"This cruise took { timedelta (seconds = total_time )} and would have cost { cost :,.0f} euros." )
0 commit comments