process_ais_data.write_data(trajectories, options, directories, grid_params)

Writes all trajectories to an output csv file using a discretized state and action grid.

Uses the trajectories variable to look at each id-state-action-state transition to discretize all states and to interpolate actions if specified. These discretized states with interpolated or arbitrary actions are then written to the output csv specified by options['out_dir'] + options['out_file']. Each trajectory is also sorted by its timestamp.

The trajectories have their ids aliased by a counter variable that only increments whenever a trajectory is going to appear in the final csv. Self-transitions are discarded, and because of the huge grid size, most trajectories will be discarded since they will never transition between grid squares.

  • trajectories (pandas.DataFrame) – All data entries with columns ['MMSI', 'LON', 'LAT', 'TIME'].

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

  • directories (dict) – The input and output paths and files specified in the config_file.

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