The following functions are used internally to the main functions.
Called by create_fishing_trip
.
This function serve to calculate and to format trip information and to assemble the output table.
build_trip(data, index, xstart, xpos, index2, ports_buffer, ports)
Called by classification_wrapper
.
This function analyzes the speed profile of the points contained within a spatial cluster, and indicates if the proportion of the point indicated by the target speed is above a specified threshold
check_cluster(data, gear, threshold, low_speed)
Called by classification_wrapper
.
This function identifies the size of each track.
classify(data)
classifify_speed
Called by classification_wrapper
.
Classified speed applies the k-means algorithm on fishing speed data, then it uses time information to identify transmission gaps (or data with time lag > parameter specified by user). Classification results are homogenized with a lookahead (3 points) and finally points are clustered into tracks based on k-means result and time information.
classify_speed(data, gear, xcentroids, pars)
Called by classification_wrapper
.
This function controls most of the functions called by classification_wrapper
, and apply them in the right sequential order to one fishing trip at time. It search for spatial clusters of points by appliying a dbscan algorithm and then it classify the fishing data basing on the speed by applying a kmeans algorithm. Information on the spatial cluster and on the speed classification are evaluated within a set of rules designed to identify a range of fishing gears.
core_function(trip_data, pars)
This function is not called by any of the functions listed in the processing workflow.
This function serve to format the data required to train the Random Forest algorithm.
data_partition(data)
Called by create_fishing_trip
.
This function is used to individuate if there are points (x,y) that fall within the polygon of harbours, and, eventually, it indicates which are these points.
find_inport(data, ports)
Called by create_fishing_trip
.
This function was used to assign the harbor to fishing session the start or finish without a “in harbor” position. The departure or the arrival harbor was assigned considering the closest harbor respect to the first or last position of the session:
closest_port(longitude , latitude, ports)
Called by create_fishing_trip
.
This function is used to assign the beginning and ending ports of fishing tripsduring the recovery step of the create_fishing_trip function. This function individuate if there are harbours closest then 50 km with respect to the first or last position of the trip. If there are harbours, the function selects the closest five, then it checks if the reference_port is included in the closest five. If yes, it assign this harbour, if no, it assign the closest harbour:
closest_port_recovery(longitude , latitude, ports, reference_port)
Called by create_fishing_trip
.
This function is used to assign the beginning and ending ports of fishing trips, by the means of a spatial intersection between coordinates and the ports buffer layer. If the intersection is successful, it return the name of the identified harbour:
get_port(longitude , latitude, ports_buffer, ports)
This function is not called by any of the functions listed in the processing workflow.
This function recycles the data gaps from the function “core_function” and retrieves tracks corresponding to gaps in the AIS signal.
identify_trasmission_gaps(data, coord_sys)
This function is not called by any of the functions listed in the processing workflow.
The import_parameters allows to load the required parameters of several internal functions.
import_parameters(parameters, centroids)
Called by create_fishing_trip
.
This function is used to individuate if the last point of a fishing trip (n) and the first point of the subsequent fishing trip (n+1), lies within the coastal ban zone. It returns the number of points individuated:
incoastal_ban_zone(longitude_start , latitude_start , longitude_end , latitude_end, coastline)
Called by classification_wrapper
.
This function assigns unique ids to subsequent points if they fall within the same cluster inherited from k-means, thus creating groups of homogeneous points, corresponding to different phases of the activity (mainly steaming and fishing). Then it removes the first and the last steaming tracks.
make_segment_lite(data, gear)
Called by classification_wrapper
.
This function applies the dbscan algorithm to identify spatial clusters in the input data.
search_cluster(data, pars, gear)