process_ais_data.get_state(cur_lon, cur_lat, grid_params)

Discretizes a coordinate pair into its state space representation in a Euclidean grid.

Takes in a coordinate pair cur_lon, cur_lat and grid parameters to calculate the integer state representing the given coordinate pair. This coordinate grid is always row-major. (min_lon, min_lat) represent the bottom-left corner of the grid.


A 3 x 4 grid would have the following state enumeration pattern:

8 9 10 11
4 5 6 7
0 1 2 3

With each grid square’s area bounded in the following way:

(min_lon, min_lat + grid_len)              (min_lon + grid_len, min_lat + grid_len)
 (min_lon, min_lat) ---------------------- (min_lon + grid_len, min_lon)

In this example, the bottom left of state 0’s boundaries would be the point min_lon, min_lat, and the total area mapping to state 0 would be the square with min_lon, min_lat as the bottom left corner and each side of the square with length grid_len. The inclusive parts of the square’s boundaries mapping to zero are solid lines.

  • cur_lon (float) – The longitude of the data point.

  • cur_lat (float) – The latitude of the data point.

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


A state corresponding to the discretized representation of cur_lon, cur_lat.

Return type