Function to build the folder structure when updating/upgrading Gmacs and prepare input files to run Gmacs. This function is to be used by developers.

set_DevStruct(
  stock = NULL,
  ADMBpaths = NULL,
  dir_test = NULL,
  dir_old_version = NULL,
  use_LastAss_Files = NULL,
  dir_LastAss_Files = NULL,
  use_Version_Files = NULL,
  dir_Version_Files = NULL,
  new_Ver_ID = NULL,
  verbose = NULL
)

Arguments

stock

(character; vector)- The stock(s) to be considered. This specifies the input file folder names that will be build in the dir_test repertory. If set as "all", then the function will look in either the dir_LastAss_Files or the dir_Version_Files repertories to identify which stock(s) to consider.

ADMBpaths

(filepath): absolute or relative to current working directory path to file defining required ADMB paths. See the details section for more information about this ADMB file.

dir_test

(path)- path to the repertory where the codes and stocks folder will be saved during the development of this new version. This folder will be used to run tests when updating/upgrading Gmacs.

dir_old_version

(path)- path to the repertory where the latest version of Gmacs is saved. This repertory has to hold the last codes available for Gmacs as well as the outptut of Gmacs for each stock obtained using this version. The names of the stock folders in that repertory have to match the ones in the stock argument.

use_LastAss_Files

(logical)- If TRUE, the last available assessment input files are used. See details for more information.

dir_LastAss_Files

(path)- path to the repertory holding the last available input files for each stock.

use_Version_Files

(logical)- If TRUE, the input files for a given version of Gmacs are used.

dir_Version_Files

(path)- path to the repertory holding the input files for each stock that have been used for an older version of Gmacs. See details for more information.

new_Ver_ID

(character)- the version number of Gmacs for this update/upgrade. This has to be in the form X.YY.ZZ. If NULL, a window will pop up and ask the user to specify this version number.

verbose

(logical)- if TRUE, report the building process.

Value

Set up the folder structure to develop a new version of Gmacs and provide the stock specific input files that will be used to develop the new version of Gmacs.

Details

The dir_test repertory will hold the following folders:

Gmacs_XX.YY.ZZ

a Gmacs version specific folder that is used to store the outupt of Gmacs for the current version in development. The name gave to the version being developed (new_Ver_ID) has to match the one that will be given when updating/upgrading Gmacs.

Stock_Input_files

a folder subdived in multiple subfolders corresponding to each version of Gmacs that is developped. Each of these subfolders holds the stock-specific input files that are used for the development.

The functions allows to use the stock-specific input files available in the dir_LastAss_Files folder so you are sure to work with the last available input files for each stock. This can be avoid by i) using input files from a previous developed version of Gmacs (see the use_Version_Files argument) or ii) providing your own input files in the Stock_Input_files folder.

The ADMBpaths refers to the repertory that holds either the "ADpaths_Windows.txt" file for the windows machine or the "ADpaths_MacOS.txt" file for Mac. The function automatically detect which machine you are working on.

Author

M. Veron

Examples

if (FALSE) {
rm(list = ls(all.names = TRUE))

# 1. set up ----

fsep <- .Platform$file.sep

# Load packages ----
library(gmr)
library(magrittr)

# Set directories ----
dir_test <- file.path(here::here(), "Testing_Versions")
dir_old_version <- file.path(here::here(), "Dvpt_Version", fsep = fsep)
dir_LastAss_Files <- file.path(dirname(here::here()), "Assessment_data", fsep = fsep)
dir_Version_Files <- NULL
dir_ADMBpath_Files <- here::here()


# 2. local functions ----

# Specification for building the structure
stock <-  "all"
use_LastAss_Files <- TRUE
use_Version_Files <- FALSE
new_Ver_ID <- NULL
verbose <- TRUE

# Run the function to set up the folder structure ----
set_DevStruct(stock = stock,
              ADMBpaths = dir_ADMBpath_Files,
              dir_test = dir_test,
              dir_old_version = dir_old_version,
              use_LastAss_Files = use_LastAss_Files,
              dir_LastAss_Files = dir_LastAss_Files,
              use_Version_Files = use_Version_Files,
              dir_Version_Files = dir_Version_Files,
              new_Ver_ID = new_Ver_ID,
              verbose = verbose
)
}