Create R6 reference object class full_trips
t3::list_t3
-> full_trips
filter_by_years_period()
Function for filter full trips by a year(s) period.
years_period
Object of class integer expected. Year(s) in 4 digits format.
rf1()
Process of Raising Factor level 1 (RF1 and RF2) calculation. Raising Factor level 2 (RF2) not implemented yet but will be computed at this step.
full_trips$rf1(
rf1_computation = TRUE,
species_fao_codes_rf1 = c("YFT", "SKJ", "BET", "ALB", "LOT", "MIX", "TUN"),
species_fate_codes_rf1 = as.integer(c(6, 11)),
vessel_type_codes_rf1 = as.integer(c(4, 5, 6)),
rf1_lowest_limit = 0.8,
rf1_highest_limit = 1.2,
global_output_path = NULL,
output_format = "eu"
)
rf1_computation
Object of class logical
expected. If FALSE rf1 is not calculated (rf1=1 for all trips).
By default TRUE, the rf1 is calculated for each trip.
species_fao_codes_rf1
Object of type character
expected.Specie(s) FAO code(s) used for the RF1 process.
By default, use codes YFT (*Thunnus albacares*), SKJ (*Katsuwonus pelamis*), BET (*Thunnus obesus*), ALB (*Thunnus alalunga*),
LOT (*Thunnus tonggol*) and TUN/MIX (mix of tunas species in Observe/AVDTH database) (French and Mayotte fleets).
species_fate_codes_rf1
Object of type integer
expected. By default 6 ("Retained, presumably destined for the cannery"). Specie(s) fate code(s) used for the RF1 process.
vessel_type_codes_rf1
Object of type integer
expected. By default 4, 5 and 6. Vessel type(s).
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_output_path
By default object of type NULL
but object of type character
. Path of the global outputs directory. The function will create subsection if necessary.
By default NULL, for no outputs extraction. Outputs will be extracted, only if a global_output_path is specified.
output_format
Object of class character
expected. By default "eu". Select outputs format regarding European format (eu) or United States format (us).
conversion_weight_category()
Process of logbook weight categories conversion.
full_trips$conversion_weight_category(
global_output_path = NULL,
output_format = "eu",
referential_template = "observe"
)
global_output_path
By default object of type NULL
but object of type character
. Path of the global outputs directory. The function will create subsection if necessary.
By default NULL, for no outputs extraction. Outputs will be extracted, only if a global_output_path is specified.
output_format
Object of class character
expected. By default "eu". Select outputs format regarding European format (eu) or United States format (us).
referential_template
Object of class character
expected. By default "observe". Referential template selected (for example regarding the activity_code). You can switch to "avdth".
set_count()
Process for positive sets count.
full_trips$set_count(
global_output_path = NULL,
output_format = "eu",
referential_template = "observe"
)
global_output_path
By default object of type NULL
but object of type character
. Path of the global outputs directory. The function will create subsection if necessary.
By default NULL, for no outputs extraction. Outputs will be extracted, only if a global_output_path is specified.
output_format
Object of class character
expected. By default "eu". Select outputs format regarding European format (eu) or United States format (us).
referential_template
Object of class character
expected. By default "observe". Referential template selected (for example regarding the activity_code). You can switch to "avdth".
fishing_effort()
Process for set duration, time at sea, fishing time and searching time calculation (in hours).
full_trips$fishing_effort(
set_duration_ref,
activity_code_ref,
sunrise_schema = "sunrise",
sunset_schema = "sunset",
global_output_path = NULL,
output_format = "eu",
referential_template = "observe"
)
set_duration_ref
Object of type data.frame
or tbl_df
expected. Data and parameters for set duration calculation (by year, country, ocean and school type).
Duration in minutes in the reference table, converted into hours in output for subsequent processing).
activity_code_ref
Object of type data.frame
or tbl_df
expected. Reference table with the activity codes to be taken into account for the allocation of sea and/or fishing time,
and/or searching time and/or set duration.
sunrise_schema
Object of class character expected. Sunrise characteristic. 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 characteristic. By default "sunset" (sun disappears below the horizon, evening civil twilight starts). See below for more details.
global_output_path
By default object of type NULL
but object of type character
expected if parameter outputs_extraction equal TRUE. Path of the global outputs directory. The function will create subsection if necessary.
By default NULL, for no outputs extraction. Outputs will be extracted, only if a global_output_path is specified.
output_format
Object of class character
expected. By default "eu". Select outputs format regarding European format (eu) or United States format (us).
referential_template
Object of class character
expected. By default "observe". Referential template selected (for example regarding the activity_code). You can switch to "avdth".
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 ends(soft light, best time for photography)
"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
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).
full_trips$sample_length_class_ld1_to_lf(
length_step,
global_output_path = NULL,
output_format = "eu",
referential_template = "observe"
)
length_step
Object of type data.frame
or tbl_df
expected. Data frame object with length ratio between ld1 and lf class.
global_output_path
By default object of type NULL
but object of type character
. Path of the global outputs directory. The function will create subsection if necessary.
By default NULL, for no outputs extraction. Outputs will be extracted, only if a global_output_path is specified.
output_format
Object of class character
expected. By default "eu". Select outputs format regarding European format (eu) or United States format (us).
referential_template
Object of class character
expected. By default "observe". Referential template selected (for example regarding the activity_code). You can switch to "avdth".
sample_number_measured_extrapolation()
Process for sample number measured individuals extrapolation to sample number individuals counted.
full_trips$sample_number_measured_extrapolation(
global_output_path = NULL,
output_format = "eu"
)
global_output_path
By default object of type NULL
but object of type character
. Path of the global outputs directory. The function will create subsection if necessary.
By default NULL, for no outputs extraction. Outputs will be extracted, only if a global_output_path is specified.
output_format
Object of class character
expected. By default "eu". Select outputs format regarding European format (eu) or United States format (us).
sample_length_class_step_standardisation()
Process for step standardisation of lf length class.
full_trips$sample_length_class_step_standardisation(
maximum_lf_class = as.integer(500),
global_output_path = NULL,
output_format = "eu"
)
maximum_lf_class
Object of type integer
expected. Theorical maximum lf class that can occur (all species considerated). By default 500.
global_output_path
By default object of type NULL
but object of type character
. Path of the global outputs directory.The function will create subsection if necessary.
By default NULL, for no outputs extraction. Outputs will be extracted, only if a global_output_path is specified.
output_format
Object of class character
expected. By default "eu". Select outputs format regarding European format (eu) or United States format (us).
well_set_weight_categories()
Process for well set weight categories definition.
full_trips$well_set_weight_categories(
sample_set,
global_output_path = NULL,
output_format = "eu",
referential_template = "observe"
)
sample_set
Object of type data.frame
expected. Data frame object with weighted weigh of each set sampled.
global_output_path
By default object of type NULL
but object of type character
. Path of the global outputs directory. The function will create subsection if necessary.
By default NULL, for no outputs extraction. Outputs will be extracted, only if a global_output_path is specified.
output_format
Object of class character
expected. By default "eu". Select outputs format regarding European format (eu) or United States format (us).
referential_template
Object of class character
expected. By default "observe". Referential template selected (for example regarding the activity_code). You can switch to "avdth".
standardised_sample_creation()
Object standardised sample creation.
global_output_path
By default object of type NULL
but object of type character
. Path of the global outputs directory. The function will create subsection if necessary.
By default NULL, for no outputs extraction. Outputs will be extracted, only if a global_output_path is specified.
output_format
Object of class character
expected. By default "eu". Select outputs format regarding European format (eu) or United States format (us).
standardised_sample_set_creation()
R6 object standardised sample set creation.
full_trips$standardised_sample_set_creation(
length_weight_relationship_data,
global_output_path = NULL,
output_format = "eu"
)
length_weight_relationship_data
Object of type data.frame
or tbl_df
expected. Data frame object with parameters for length weight relationship.
global_output_path
By default object of type NULL
but object of type character
. Path of the global outputs directory. The function will create subsection if necessary.
By default NULL, for no outputs extraction. Outputs will be extracted, only if a global_output_path is specified.
output_format
Object of class character
expected. By default "eu". Select outputs format regarding European format (eu) or United States format (us).
raised_factors_determination()
Raised factors determination for weight sample set to set.
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),
global_output_path = NULL,
output_format = "eu"
)
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.
global_output_path
By default object of type NULL
but object of type character
. Path of the global outputs directory. The function will create subsection if necessary.
By default NULL, for no outputs extraction. Outputs will be extracted, only if a global_output_path is specified.
output_format
Object of class character
expected. By default "eu". Select outputs format regarding European format (eu) or United States format (us).
raised_standardised_sample_set()
Application of process 2.8 raised factors on standardised sample set.
global_output_path
By default object of type NULL
but object of type character
. Path of the global outputs directory. The function will create subsection if necessary.
By default NULL, for no outputs extraction. Outputs will be extracted, only if a global_output_path is specified.
output_format
Object of class character
expected. By default "eu". Select outputs format regarding European format (eu) or United States format (us).
data_preparatory()
Data preparatory for the t3 modelling process (level 3).
full_trips$data_preparatory(
inputs_level3 = NULL,
inputs_level3_path = NULL,
output_directory,
periode_reference_level3 = NULL,
target_year = as.integer(lubridate::year(Sys.time() - 1)),
period_duration = 4L,
target_ocean = NULL,
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
)
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.
output_directory
Object of type character
expected. Path of the outputs directory.
periode_reference_level3
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
target_ocean
Object of type integer
expected. The code of ocean of interest.
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 a well 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.
random_forest_models()
Modelling proportions in sets througth random forest models.
full_trips$random_forest_models(
output_level3_process1,
num.trees = 1000L,
mtry = 2L,
min.node.size = 5,
seed_number = 7L,
small_fish_only = FALSE
)
output_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).
models_checking()
Load each full model and compute figure and tables to check the model quality. Furthermore, create a map of samples used for each model and relationship between logbook reports and samples.
full_trips$models_checking(
output_level3_process2,
output_directory,
output_format = "eu",
plot_sample = FALSE,
avdth_patch_coord = FALSE
)
output_level3_process2
Object of type list
expected. Outputs models and data from process 3.2.
output_directory
Object of type character
expected. Outputs directory path.
output_format
Object of class character
expected. By default "eu". Select outputs format regarding European format (eu) or United States format (us).
plot_sample
logical
. Whether the sample figure is computed. Default value = F
avdth_patch_coord
parameter waiting for coordinate conversion patch from avdth database
data_formatting_for_predictions()
Formatting data for model predictions.
full_trips$data_formatting_for_predictions(
inputs_level3,
output_level3_process1,
target_year,
vessel_id_ignored = NULL,
country_flag = NULL,
input_type = "observe_database",
small_fish_only = FALSE
)
inputs_level3
Object of type data.frame
expected. Inputs of levels 3 (see function path to level 3).
output_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.
country_flag
Three letters FAO flag code of country to estimate catches.
input_type
Type of coding use in different databases. Default value is 'observe_database'. Values can be 'observe_database' or 'avdth_database'.
small_fish_only
Object of type logical
expected. Whether the model estimate proportion for small fish only (< 10 kg).
model_predictions()
Model predictions for the species composition and computing of catches.
full_trips$model_predictions(
output_level3_process2,
output_level3_process4,
output_directory,
output_format = "eu",
country_flag = NULL,
ci = FALSE,
ci_type = "all",
Nboot = 50,
plot_predict = FALSE
)
output_level3_process2
Object of type list
expected. Outputs from level 3 process 2 (random forest models).
output_level3_process4
Object of type list
expected. Outputs from level 3 process 4 (data formatting for predictions).
output_directory
Object of type character
expected. Outputs directory path.
output_format
Object of class character
expected. By default "eu". Select outputs format regarding European format (eu) or United States format (us).
country_flag
Three letters FAO flag code of country to estimate catches.
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.
show_me_what_you_got()
Most powerfull and "schwifty" function in the univers for "open the T3 process" and manipulate in live R6 objects.