Preprocessing Script Documentation

process_ais_data Module

Preprocesses AIS data.

To obtain the needed AIS data, see (and run) get_raw.sh.

Uses information specified in the config_file to chew through available AIS csv data to generate an output csv file with the discretized states, inferred actions, and records metadata for further processing in the meta_file.

Functions

collect_csv_files(options, directories, …)

Traverses the directory containing the decompressed AIS data to get the csv names for further processing.

get_action(traj, options, grid_params)

Wrapper function for other get_action functions.

get_action_arb(row, options, grid_params)

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

get_action_interp_reg(row, options, grid_params)

Calculates the actions taken from the previous state to reach the current state, interpolating if necessary.

get_action_interp_with_diag(row, options, …)

Calculates the actions taken from the previous state to reach the current state, interpolating if necessary.

get_bounds(zone)

Helper function to get longitude boundaries corresponding to zone.

get_config(config_file)

Helper function to get dictionary of script parameters.

get_meta_data(file_name)

Helper function to retrieve a given file name’s year, month, and zone.

get_state(cur_lon, cur_lat, grid_params)

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

main()

Driver code to run the big steps of pre-processing the data.

read_data(csv_files, options, grid_params)

Iterate through each csv file to segregate each trajectory by its mmsi id.

state_to_coord(state, options, grid_params)

Inverse function for get_state.

write_data(trajectories, options, …)

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