full_trips: R6 class full_trips

full_tripsR Documentation

R6 class full_trips

Description

Create R6 reference object class full_trips

Super class

t3::list_t3 -> full_trips

Methods

Public methods

Inherited methods

Method create_full_trips()

Creation of full trip item from trips.

Usage
full_trips$create_full_trips(object_trips)
Arguments
object_trips

Object of type R6-trips expected. A R6 reference object of class trips.


Method filter_by_periode()

Function for filter full trips by a reference periode.

Usage
full_trips$filter_by_periode(periode_reference)
Arguments
periode_reference

Object of class integer expected. Year(s) in 4 digits format.


Method add_activities()

Function for add activities in full trips object.

Usage
full_trips$add_activities(object_activities)
Arguments
object_activities

Object of type R6-activities expected. A R6 reference object of class activities.


Method add_elementarycatches()

Function for add elementary catches in full trips object.

Usage
full_trips$add_elementarycatches(object_elementarycatches)
Arguments
object_elementarycatches

Object of type R6-elementarycatches expected. A R6 reference object of class elementarycatches.


Method add_elementarylandings()

Function for add elementary landings in full trips object.

Usage
full_trips$add_elementarylandings(object_elementarylandings)
Arguments
object_elementarylandings

Object of type R6-elementarylandings expected. A R6 reference object of class elementarylandings.


Method add_wells_samples()

Function for add wells and samples caracteristics in full trips object.

Usage
full_trips$add_wells_samples(object_wells)
Arguments
object_wells

Object of type R6-wells expected. A R6 reference object of class wells.


Method rf1()

Process of Raising Factor level 1 (RF1).

Usage
full_trips$rf1(
  species_rf1 = as.integer(c(1, 2, 3, 4, 9, 11)),
  rf1_lowest_limit = 0.8,
  rf1_highest_limit = 1.2,
  global_outputs_path = NULL
)
Arguments
species_rf1

Object of type integer expected. Specie(s) code(s) used for the RF1 process. By default 1 (YFT), 2 (SKJ), 3 (BET), 4 (ALB), 9 (MIX) and 11 (LOT).

rf1_lowest_limit

Object of type numeric expected. Verification value for the lowest limit of the RF1. By default 0.8.

rf1_highest_limit

Object of type numeric expected. Verification value for the highest limit of the RF1. By default 1.2.

global_outputs_path

By default object of type NULL but object of type character expected if parameter outputs_extraction egual TRUE. Path of the global outputs directory. The function will create subsection if necessary.


Method rf2()

Process of Raising Factor level 2 (rf2).

Usage
full_trips$rf2()

Method conversion_weigth_category()

Process of logbook weigth categories conversion.

Usage
full_trips$conversion_weigth_category()

Method set_count()

Process for postive sets count.

Usage
full_trips$set_count()

Method set_duration()

Process for set duration calculation (in hours).

Usage
full_trips$set_duration(set_duration_ref)
Arguments
set_duration_ref

Object of type data.frame expected. Data and parameters for set duration calculation (by year, country, ocean and school type).


Method time_at_sea()

Process for time at sea calculation (in hours).

Usage
full_trips$time_at_sea()

Method fishing_time()

Process for fishing time calculation (in hours).

Usage
full_trips$fishing_time(sunrise_schema = "sunrise", sunset_schema = "sunset")
Arguments
sunrise_schema

Object of class character expected. Sunrise caracteristic. By default "sunrise" (top edge of the sun appears on the horizon). See below for more details.

sunset_schema

Object of class character expected. Sunset caracteristic. By default "sunset" (sun disappears below the horizon, evening civil twilight starts). See below for more details.

Details

Available variables are:

  • "sunrise"sunrise (top edge of the sun appears on the horizon)

  • "sunriseEnd"sunrise ends (bottom edge of the sun touches the horizon)

  • "goldenHourEnd"morning golden hour (soft light, best time for photography) ends

  • "solarNoon"solar noon (sun is in the highest position)

  • "goldenHour"evening golden hour starts

  • "sunsetStart"sunset starts (bottom edge of the sun touches the horizon)

  • "sunset"sunset (sun disappears below the horizon, evening civil twilight starts)

  • "dusk"dusk (evening nautical twilight starts)

  • "nauticalDusk"nautical dusk (evening astronomical twilight starts)

  • "night"night starts (dark enough for astronomical observations)

  • "nadir"nadir (darkest moment of the night, sun is in the lowest position)

  • "nightEnd"night ends (morning astronomical twilight starts)

  • "nauticalDawn"nautical dawn (morning nautical twilight starts)

  • "dawn"dawn (morning nautical twilight ends, morning civil twilight starts)


Method searching_time()

Process for searching time calculation (in hours, fishing time minus sets durations).

Usage
full_trips$searching_time()

Method sample_length_class_ld1_to_lf()

Process for length conversion, if necessary, in length fork (lf). Furthermore, variable "sample_number_measured_extrapolated" of process 2.1 will converse in variable "sample_number_measured_extrapolated_lf" (Notably due to the creation of new lf classes during some conversions).

Usage
full_trips$sample_length_class_ld1_to_lf(length_step)
Arguments
length_step

Object of type data.frame expected. Data frame object with length ratio between ld1 and lf class.


Method sample_number_measured_extrapolation()

Process for sample number measured individuals extrapolation to sample number individuals counted.

Usage
full_trips$sample_number_measured_extrapolation()

Method sample_length_class_step_standardisation()

Process for step standardisation of lf length class.

Usage
full_trips$sample_length_class_step_standardisation(
  maximum_lf_class = as.integer(500)
)
Arguments
maximum_lf_class

Object of type integer expected. Theorical maximum lf class that can occur (all species considerated). By default 500.


Method well_set_weigth_categories()

Process for well set weigth categories definition.

Usage
full_trips$well_set_weigth_categories(sample_set)
Arguments
sample_set

Object of type data.frame expected. Data frame object with weighted weigh of each set sampled.


Method standardised_sample_creation()

Object standardised sample creation.

Usage
full_trips$standardised_sample_creation()

Method standardised_sample_set_creation()

R6 object standardised sample set creation.

Usage
full_trips$standardised_sample_set_creation(length_weight_relationship_data)
Arguments
length_weight_relationship_data

Object of type data.frame expected. Data frame object with parameters for length weight relationship.


Method raised_factors_determination()

Raised factors determination for weigth sample set to set.

Usage
full_trips$raised_factors_determination(
  threshold_rf_minus10 = as.integer(500),
  threshold_rf_plus10 = as.integer(500),
  threshold_frequency_rf_minus10 = as.integer(75),
  threshold_frequency_rf_plus10 = as.integer(75),
  threshold_rf_total = as.integer(250)
)
Arguments
threshold_rf_minus10

Object of type integer expected. Threshold limite value for raising factor on individuals category minus 10. By default 500.

threshold_rf_plus10

Object of type integer expected. Threshold limite value for raising factor on individuals category plus 10. By default 500.

threshold_frequency_rf_minus10

Object of type integer expected. Threshold limite frequency value for raising factor on individuals category minus 10. By default 75.

threshold_frequency_rf_plus10

Object of type integer expected. Threshold limite frequency value for raising factor on individuals category plus 10. By default 75.

threshold_rf_total

Object of type integer expected. Threshold limite value for raising factor (all categories). By default 250.


Method raised_standardised_sample_set()

Application of process 2.8 raised factors on standardised sample set.

Usage
full_trips$raised_standardised_sample_set()

Method path_to_level3()

Temporary link to the R object model with Antoine D. modelisation process.

Usage
full_trips$path_to_level3()

Method data_preparatory()

Data preparatory for the t3 modelling process (level 3).

Usage
full_trips$data_preparatory(
  inputs_level3 = NULL,
  inputs_level3_path = NULL,
  outputs_directory,
  periode_reference = NULL,
  target_year = as.integer(lubridate::year(Sys.time() - 1)),
  period_duration = 4L,
  distance_maximum = as.integer(5),
  number_sets_maximum = as.integer(5),
  set_weight_minimum = as.integer(6),
  minimum_set_frequency = 0.1,
  vessel_id_ignored = NULL
)
Arguments
inputs_level3

Object of type data.frame expected. Inputs of levels 3 (see function path to level 3).

inputs_level3_path

Object of type character expected. Path to the folder containing yearly data output of the level 1 and 2 (output of the function the path to level 3). If provide, replace the inputs_level3 object.

outputs_directory

Object of type character expected. Path of the t3 processes outputs directory.

periode_reference

Object of type integer expected. Year(s) period of reference for modelling estimation.

target_year

Object of type integer expected. Year of interest for the model estimation and prediction.Default value is current year -1.

period_duration

Object of type integer expected. number of years use for the modelling. The default value is 5

distance_maximum

Object of type integer expected. Maximum distance between all sets of a sampled well. By default 5.

number_sets_maximum

Object of type integer expected. Maximum number of sets allowed in mixture. By default 5.

set_weight_minimum

Object of type integer expected. Minimum set size considered. Remove smallest set for which sample could not be representative. By default 6 t.

minimum_set_frequency

Object of type numeric expected. Minimum threshold proportion of set in awell to be used for model training in the process. By default 0.1.

vessel_id_ignored

Object of type integer expected. Specify list of vessel(s) id(s) to be ignored in the model estimation and prediction .By default NULL.


Method random_forest_models()

Modelling proportions in sets througth random forest models.

Usage
full_trips$random_forest_models(
  outputs_level3_process1,
  num.trees = 1000L,
  mtry = 2L,
  min.node.size = 5,
  seed_number = 7L,
  small_fish_only = F
)
Arguments
outputs_level3_process1

Object of type data.frame expected. Output table data_lb_sample_screened from process 3.1.

num.trees

Object of type integer expected. Number of trees to grow. This should not be set to too small a number, to ensure that every input row gets predicted at least a few times. The default value is 1000.

mtry

Object of type integer expected. Number of variables randomly sampled as candidates at each split. The default value is 2.

min.node.size

Object of type numeric expected. Minimum size of terminal nodes. Setting this number larger causes smaller trees to be grown (and thus take less time).The default value is 5.

seed_number

Object of type integer expected. Set the initial seed for the modelling. The default value is 7.

small_fish_only

Object of type logical expected. Whether the model estimate proportion for small fish only (< 10 kg).


Method models_checking()

Load each full model and compute figures and tables to check the model quality. Furthermore, create a map of samples used for each model and relationship between logbook reports and samples.

Usage
full_trips$models_checking(
  outputs_level3_process2,
  outputs_directory,
  plot_sample = F,
  avdth_patch_coord = F
)
Arguments
outputs_level3_process2

Object of type list expected. Outputs models and data from process 3.2.

outputs_directory

Object of type character expected. Outputs directory path.

plot_sample

logical. Whether the sample figure is computed. Default value = F

avdth_patch_coord

parameter waiting for coordinate conversion patch from avdth database


Method data_formatting_for_predictions()

Formatting data for model predictions.

Usage
full_trips$data_formatting_for_predictions(
  inputs_level3,
  outputs_level3_process1,
  target_year,
  vessel_id_ignored = NULL,
  small_fish_only = F
)
Arguments
inputs_level3

Object of type data.frame expected. Inputs of levels 3 (see function path to level 3).

outputs_level3_process1

Object of type data.frame expected. Output table data_lb_sample_screened from process 3.1.

target_year

Object of type integer expected. The year of interest for the model estimation and prediction.

vessel_id_ignored

Object of type integer expected. Specify here vessel(s) id(s) if you want to ignore it in the model estimation and prediction .By default NULL.

small_fish_only

Object of type logical expected. Whether the model estimate proportion for small fish only (< 10 kg).


Method model_predictions()

Model predictions for the species composition and computing of catches.

Usage
full_trips$model_predictions(
  outputs_level3_process2,
  outputs_level3_process4,
  outputs_directory,
  ci = FALSE,
  ci_type = "all",
  Nboot = 50,
  plot_predict = FALSE
)
Arguments
outputs_level3_process2

Object of type list expected. Outputs from level 3 process 2 (random forest models).

outputs_level3_process4

Object of type list expected. Outputs from level 3 process 4 (data formatting for predictions).

outputs_directory

Object of type character expected. Outputs directory path.

ci

Object of type logical expected. Logical indicating whether confidence interval is computed. The default value is FALSE as it is a time consuming step.

ci_type

Type of confidence interval to compute. The default value is "all". Other options are "set" for ci on each set, "t1" for ci on nominal catch by species, "t1-fmod" for ci on nominal catch by species and fishing mode "t2" and "t2-fmod" for ci by 1 degree square and month. A vector of several ci option can be provided. ci_type are computed only if the ci parameter is TRUE.

Nboot

Object of type numeric expected. The number of bootstrap samples desired for the ci computation. The default value is 10.

plot_predict

Object of type logical expected. Logical indicating whether maps of catch at size have to be done.


Method show_me_what_you_got()

Most powerfull and "schwifty" function in the univers for "open the T3 process" and manipulate in live R6 objects.

Usage
full_trips$show_me_what_you_got()

Method clone()

The objects of this class are cloneable with this method.

Usage
full_trips$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


OB7-IRD/t3 documentation built on April 23, 2023, 7:34 p.m.