get_action_arb

process_ais_data.get_action_arb(row, options, grid_params)

Calculates an arbitrary action from the previous state to current state relative to the previous state.

First, the relative offset between the current and previous state in rows and columns is calculated. The action is then calculated according to a spiral rule beginning with the previous state, so self-transitions are defined as 0 as an initial condition. Spiral inspired by the polar function r = theta.

Example

For example, if prev_state = 5, cur_state = 7, and num_cols = 4, then our state grid is populated as follows:

8  9 10 11
4  p  6  c
0  1  2  3

Where p represents the location of the previous state, and c represents the location of the current state. Then the current state’s position relative to the previous state is rel_row = 0, rel_col = 2. Our action spiral then looks like this:

15 14 13 12 11      15 14 13 12 11
16  4  3  2 10      16  4  3  2 10
17  5  0  1  9  ->  17  5  p  1  c
18  6  7  8 24      18  6  7  8 24
19 20 21 22 23      19 20 21 22 23

Thus, this algorithm will return 9 as the action.

Parameters
  • row (pandas.Series) – One row of the DataFrame the function is applied to, containing the trajectory number, previous state, current state, longitude, and latitude.

  • options (dict) – The script options specified in the config_file.

  • grid_params (dict) – The grid parameters specified in the config_file.

Returns

State-action-state triplets that interpolate between prev_state and cur_state.

Return type

dict