voyager/core.py
def run(self, results_file: str):
        """Runs a model a specified number of times in time and space on Earth, generating a 
        GeoJSON file called 'results_file' with coordinates and timestamps for departure of all trajectories. 

        Args:
            results_file (str): A GeoJSON file with a list of trajectories with associated coordinates and timestamps.
        """

        time_delta     = pd.Timedelta(self.launch_day_frequency, 'D')
        date           = self.start_date

        all_results = {}
        # all_drifts  = []
        progress = tqdm(self.dates[::self.launch_day_frequency])
        for launch_day in progress:

            progress.set_description(f"Date: {launch_day.strftime('%Y-%m-%d')}")
            progress.refresh() # to show immediately the update

            end_date = launch_day + pd.Timedelta(self.duration, 'D')

            # Naming:
            # u_current - current in e-w direction / longitude / x
            # v_current - current in n-s direction / latitude / y

            # Interpolate the current speeds for the current day
            u_current = self.interpolate(self.u_current_all, launch_day, end_date) 
            v_current = self.interpolate(self.v_current_all, launch_day, end_date) 
            
            # Interpolate the wind speeds for the current day
            u_wind = self.interpolate(self.u_wind_all, launch_day, end_date) 
            v_wind = self.interpolate(self.v_wind_all, launch_day, end_date) 

            # Send out a number of vessels every day
            vessels  = self.initialize_vessels(self.departure_points, self.n_reps)

            # Input arguments to model
            options =  [(vessel, (u_current, v_current), (u_wind, v_wind)) for vessel in vessels]

            # Run several calls to the model in parallel,
            # In practice launching multiple vessels simultaneously
            # Observe that the gain is especially notable when simulating many vessels, not their duration
            with mp.Pool(mp.cpu_count()) as p:

                results = p.starmap(self.model, options)
                all_results[date.strftime('%Y-%m-%d')] = results

            date += time_delta

        # Save trajectories to file        
        utils.save_to_GeoJSON(all_results, results_file)
Runs a model a specified number of times in time and space on Earth, generating a 
        GeoJSON file called 'results_file' with coordinates and timestamps for departure of all trajectories. 

        Args:
            results_file (str): A GeoJSON file with a list of trajectories with associated coordinates and timestamps.
        
Runs a model a specified number of times in time and space on Earth, generating a
GeoJSON file called 'results_file' with coordinates and timestamps for departure of all trajectories.
Runs a model a specified number of times in time and space on Earth generating a GeoJSON file called ' results_file ' with coordinates and timestamps for departure of all trajectories .
def run(self, results_file: str):
        time_delta     = pd.Timedelta(self.launch_day_frequency, 'D')
        date           = self.start_date
        all_results = {}
        progress = tqdm(self.dates[::self.launch_day_frequency])
        for launch_day in progress:
            progress.set_description(f"Date: {launch_day.strftime('%Y-%m-%d')}")
            progress.refresh() 
            end_date = launch_day + pd.Timedelta(self.duration, 'D')
            u_current = self.interpolate(self.u_current_all, launch_day, end_date) 
            v_current = self.interpolate(self.v_current_all, launch_day, end_date) 
            u_wind = self.interpolate(self.u_wind_all, launch_day, end_date) 
            v_wind = self.interpolate(self.v_wind_all, launch_day, end_date) 
            vessels  = self.initialize_vessels(self.departure_points, self.n_reps)
            options =  [(vessel, (u_current, v_current), (u_wind, v_wind)) for vessel in vessels]
            with mp.Pool(mp.cpu_count()) as p:
                results = p.starmap(self.model, options)
                all_results[date.strftime('%Y-%m-%d')] = results
            date += time_delta
        utils.save_to_GeoJSON(all_results, results_file)
def run ( self , results_file : str ) : time_delta = pd . Timedelta ( self . launch_day_frequency , 'D' ) date = self . start_date all_results = { } progress = tqdm ( self . dates [ : : self . launch_day_frequency ] ) for launch_day in progress : progress . set_description ( f"Date: {launch_day.strftime('%Y-%m-%d')}" ) progress . refresh ( ) end_date = launch_day + pd . Timedelta ( self . duration , 'D' ) u_current = self . interpolate ( self . u_current_all , launch_day , end_date ) v_current = self . interpolate ( self . v_current_all , launch_day , end_date ) u_wind = self . interpolate ( self . u_wind_all , launch_day , end_date ) v_wind = self . interpolate ( self . v_wind_all , launch_day , end_date ) vessels = self . initialize_vessels ( self . departure_points , self . n_reps ) options = [ ( vessel , ( u_current , v_current ) , ( u_wind , v_wind ) ) for vessel in vessels ] with mp . Pool ( mp . cpu_count ( ) ) as p : results = p . starmap ( self . model , options ) all_results [ date . strftime ( '%Y-%m-%d' ) ] = results date += time_delta utils . save_to_GeoJSON ( all_results , results_file )
Runs a model a specified number of times in time and space on Earth, generating a
GeoJSON file called 'results_file' with coordinates and timestamps for departure of all trajectories.
Runs a model a specified number of times in time and space on Earth generating a GeoJSON file called ' results_file ' with coordinates and timestamps for departure of all trajectories .
"""Runs a model a specified number of times in time and space on Earth, generating a 
        GeoJSON file called 'results_file' with coordinates and timestamps for departure of all trajectories. 

        Args:
            results_file (str): A GeoJSON file with a list of trajectories with associated coordinates and timestamps.
        """ # all_drifts  = [] # to show immediately the update # Naming: # u_current - current in e-w direction / longitude / x # v_current - current in n-s direction / latitude / y # Interpolate the current speeds for the current day # Interpolate the wind speeds for the current day # Send out a number of vessels every day # Input arguments to model # Run several calls to the model in parallel, # In practice launching multiple vessels simultaneously # Observe that the gain is especially notable when simulating many vessels, not their duration # Save trajectories to file        
self
results_file
str
A GeoJSON file with a list of trajectories with associated coordinates and timestamps.
A GeoJSON file with a list of trajectories with associated coordinates and timestamps .