Skip to content

crossing

The python package crossing implements the optimisation of the crossing point for the Dijkstra path construction using the NewtonianDistance class. In the section below we will go through, stage by stage, how the crossing point is determined and the methods used within the class.

NewtonianDistance(node_id, neighbour_id, cellboxes, case=None, unit_shipspeed='km/hr', time_unit='days', maxiter=1000, optimizer_tol=0.001)

Class that uses the Newton method to find the crossing point between cells based on their environmental parameters.

Parameters:

Name Type Description Default
node_id str

the id of the initial cellbox

required
neighbour_id str

the id of the neighbouring cellbox

required
cellboxes dict

a dictionary with all cellboxes in the mesh indexed by their ids

required
case int

the case between the cellboxes

None
unit_shipspeed str

the speed unit to use

'km/hr'
time_unit str

the time unit to use

'days'
maxiter int

the maximum number of iterations for the optimisation

1000
optimizer_tol float

the tolerance value for the optimisation

0.001

value()

Applying a correction to determine the optimal crossing point between the start and end cell boxes

All outputs are given in SI units (m,m/s,s)

Outputs

Traveltime (tuple,[float,float]) - Traveltime legs from start cell centre to crossing to end cell centre cross_points (tuple,[float,float]) - Crossing Point in (long,lat) cell_points (tuple,[int,int]) - Start and End cell indices Case (int) - Adjacent cell-box case between start and end cell box

waypoint_correction(Wp, Cp)

Determines the traveltime between two points within a given cell Args: Wp (tuple): Start Waypoint location (long,lat) Cp (tuple): End Waypoint location (long,lat) Returns: traveltime (float) - Traveltime between the two points within cell in unit_time

traveltime_in_cell(xdist, ydist, u, v, s, tt_dist=None)

Determine the traveltime within a cell

Parameters:

Name Type Description Default
xdist float

Longitude distance between two points in km

required
ydist float

Latitude distance between two points in km

required
u float

U-Component for the forcing vector

required
v float

V-Component for the forcing vector

required
s float

Speed of the vehicle

required
tt_dist bool

Returns traveltime and distance if true, otherwise just traveltime

None

Returns: traveltime (float): the travel time within the cell dist (float): the distance within the cell