The purpose of the logbook_anapo_control function is to provide a table of data that contains an inconsistency between activity position and VMS position

logbook_anapo_control(
  dataframe1,
  dataframe2,
  dataframe3,
  activity_crs = 4326,
  harbour_crs = 4326,
  vms_crs = 4326,
  output,
  threshold_number_vms = 20,
  threshold_geographical = 10,
  threshold_time = 7200000,
  threshold_score = 0.5,
  buffer_harbour = 11100
)

Arguments

dataframe1

data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_anapo_control () function.

dataframe2

data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_anapo_control () function.

dataframe3

data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_anapo_control () function.

activity_crs

numeric expected. Default values: 4326. Coordinate Reference Systems for the position activity

harbour_crs

numeric expected. Default values: 4326. Coordinate Reference Systems for the position harbour

vms_crs

numeric expected. Default values: 4326. Coordinate Reference Systems for the position VMS

output

character expected. Kind of expected output. You can choose between "message", "report" or "logical".

threshold_number_vms

numeric expected. Default values: 20. Minimum number of VMS positions required per day.

threshold_geographical

numeric expected. Default values: 10. Maximum valid distance threshold (Nautical miles) between position and nearest VMS point.

threshold_time

numeric expected. Default values: 7200000. Maximum valid distance threshold (milliseconds) between position and VMS point.

threshold_score

numeric expected. Default values: 0.5. Minimum valid score between position and VMS point.

buffer_harbour

numeric expected. Default values: 11100. Buffer to be used for harbour, in meter

Value

The function returns a character with output is "message", two data.frame with output is "report" (the first without geographical location and the second with geographical location), a logical with output is "logical"

Details

The input dataframe must contain all these columns for the function to work :

  • activity_id

  • activity_date

  • activity_time

  • activity_position

  • trip_id

  • trip_id

  • vessel_code

  • harbour_position_departure

  • harbour_position_landing

  • vms_date

  • vms_time

  • vms_position

  • vessel_code

Examples

#Activity 1, 2 and 3 are ok,
#Activity 4 has a number of VMS below the threshold (threshold_number_vms),
#Activity 5 has no position,
#Activity 6 has has a geographical distance above the threshold (threshold_geographical) and
#           a score below the threshold (threshold_score)
dataframe1 <- data.frame(activity_id = c("1", "2", "3", "4", "5", "6"),
                         activity_date = as.Date(c("2020/01/01", "2020/01/12", "2020/01/12",
                                                   "2020/01/13", "2020/01/12", "2020/01/12")),
                         activity_time = c("05:26:01", "10:41:15", "16:41:15", "03:12:34",
                                           "05:56:12", "23:26:47"),
                         activity_position = c("POINT (1 1)", "POINT (0 0)", "POINT (3 0)",
                                               "POINT (4 4)", NA, "POINT (3 0.6)"),
                         trip_id = c("1", "2", "2", "2", "2", "2"))
dataframe2 <- data.frame(trip_id = c("1", "2"),
                         vessel_code = c("1", "1"),
                         harbour_position_departure = c("POINT (1 1.1)", "POINT (3 3)"),
                         harbour_position_landing = c("POINT (3 3)", "POINT (3 3)"))
dataframe3 <- data.frame(vms_date = as.Date(c("2020/01/01", "2020/01/12", "2020/01/12")),
                         vms_time = c("15:26:01", "10:55:15", "22:32:17"),
                         vms_position = c("POINT (4 4)", "POINT (0 0.1)", "POINT (3 0.3)"),
                         vessel_code = c("1", "1", "1"))
logbook_anapo_control(dataframe1,dataframe2, dataframe3, output = "report",threshold_number_vms = 1)
#> [[1]]
#>   activity_id logical nb_vms    min_distance max_score
#> 1           1    TRUE      1         NA [NM]        NA
#> 2           2    TRUE      2   6.004055 [NM]        NA
#> 3           3    TRUE      2  18.012165 [NM] 2.1795967
#> 4           4   FALSE     NA 230.106884 [NM] 0.0000000
#> 5           5   FALSE      2         NA [NM]        NA
#> 6           6   FALSE      2  18.012165 [NM] 0.2094411
#> 
#> [[2]]
#>    activity_id activity_date activity_time activity_position   vms_date
#> 1            3    2020-01-12      16:41:15       POINT (3 0) 2020-01-12
#> 2            3    2020-01-12      16:41:15       POINT (3 0) 2020-01-12
#> 3            4    2020-01-13      03:12:34       POINT (4 4) 2020-01-12
#> 4            4    2020-01-13      03:12:34       POINT (4 4) 2020-01-12
#> 5            6    2020-01-12      23:26:47     POINT (3 0.6) 2020-01-12
#> 6            6    2020-01-12      23:26:47     POINT (3 0.6) 2020-01-12
#> 7            1    2020-01-01      05:26:01       POINT (1 1) 2020-01-01
#> 8            2    2020-01-12      10:41:15       POINT (0 0) 2020-01-12
#> 9            2    2020-01-12      10:41:15       POINT (0 0) 2020-01-12
#> 10           5    2020-01-12      05:56:12              <NA> 2020-01-12
#> 11           5    2020-01-12      05:56:12              <NA> 2020-01-12
#>    vms_time  vms_position        distance       duration     score vms_crs
#> 1  10:55:15 POINT (0 0.1) 180.221603 [NM]  20760000 [ms] 0.0000000    4326
#> 2  22:32:17 POINT (3 0.3)  18.012165 [NM] -21062000 [ms] 2.1795967    4326
#> 3  10:55:15 POINT (0 0.1) 335.278629 [NM] -27761000 [ms] 0.0000000    4326
#> 4  22:32:17 POINT (3 0.3) 230.106884 [NM] -69583000 [ms] 0.0000000    4326
#> 5  10:55:15 POINT (0 0.1) 182.602329 [NM]  45092000 [ms] 0.0000000    4326
#> 6  22:32:17 POINT (3 0.3)  18.012165 [NM]   3270000 [ms] 0.2094411    4326
#> 7  15:26:01   POINT (4 4)         NA [NM]        NA [ms]        NA    4326
#> 8  10:55:15 POINT (0 0.1)   6.004055 [NM]        NA [ms]        NA    4326
#> 9  22:32:17 POINT (3 0.3) 181.019203 [NM]        NA [ms]        NA    4326
#> 10 10:55:15 POINT (0 0.1)         NA [NM]        NA [ms]        NA    4326
#> 11 22:32:17 POINT (3 0.3)         NA [NM]        NA [ms]        NA    4326
#>    activity_crs
#> 1          4326
#> 2          4326
#> 3          4326
#> 4          4326
#> 5          4326
#> 6          4326
#> 7          4326
#> 8          4326
#> 9          4326
#> 10         4326
#> 11         4326
#>