ices-eg / RCGs

A place for the Regional Coordination Groups (RCGs) to store scripts (e.g. for map-plotting, age-length relationships) to make them available to other groups and improve the development and exchange.
7 stars 8 forks source link

Polishing annual_overview_RDBES and related scripts #172

Closed erosquesada closed 5 months ago

erosquesada commented 5 months ago

I expanded and polished the pre-existent work on the structure of the code producing the annual overview starting from annual_overview_RDBES.R script. In brief:

  1. The "annual_overview_RDBES.R" script was restructured with a section with basic user´s selections to custom the overview produced by the script and following sections with the relevant scripts to be sourced (see below).
    The former section´s basic user´s selections include:

    • yearSelected: the year needed
    • regionSelected: the region of interest
    • downloadDataFromSP: allowing for the possibility to choose to download the prepared data existing on the ICES Share Point or proceed with data present locally.

    From these three entries, the parameters can be generated in automatic (see below).

  2. The scripts now sourced in "annual_overview_RDBES.R" were:

    • downloadPreparedData.R: make treasure of "func_download_data_from_sharepoint" to download prepared data directly from ICES SharePoint. Report progress in terminal.
    • loadData.R: Load data already present (manually downloaded and prepared) in the working directory or downloaded from ICES SharePoint at previous point.
    • loadFunctions.R: Load all the functions needed for the overview to be produced.
    • loadLibraries.R: Load all the libraries needed for the overview to be produced.
    • parametersDefinition.R: use the basic user´s selections (see above) to generate the parameters needed to produce the overview and report them into the terminal.

    All the scripts are hosted in the "RegionalOverviews\overviews_reports_RDBES\fisheries_overviews_RDBES\scripts".

  3. The already existing function "func_download_data_from_sharepoint" was polished to report progress status in a format consistent with the other parts.

  4. All the scripts involved in this pull request where added with an header explaining with detail the aim and reporting developers and developments history, in order to facilitate the contribution by others colleagues.

  5. All the scripts involved in this pull request and involved in sourcing were provided with messages reporting the progress status.

Considerations about the pull request:

i) The use of func_download_data_from_sharepoint allows for the default downloading of the latest version of the prepared data prior to the generation of the overview. This may be useful to work all on the same input data and use as reference those on the ICES Share Point. ii) The prepared data are read from a folder in the repo which has not been added to the gitignore, pushing should be done carefully.

mrska commented 5 months ago

@erosquesada Is there any reason not to add the folder with prepared data to gitignore? I do not see any obstacles to add it here, but maybe I’ve overlooked sth?

erosquesada commented 5 months ago

Hi @mrska, I checked the RCGs/RegionalOverviews/.gitignore and the data_RDBES is listed there. I must have checked the RCGs/.gitignore, not citing the folder, while writing the pull request.

mrska commented 5 months ago

Regarding the parametersDefinition.R I see here some dataset names hardcoded , which should rather be changed, so that user do not have to mofidy this script generating an overview. Regarding the logo_path I think this could be calculated in a if() statement, based on the regionSelected. And regarding the CLfileName and CEfileName, there are two lines with 'CL_2021_2021prepared' and 'CE_2021_2021prepared'. Do you have any idea for a workaround @erosquesada ? And regarding RDBES_dowlonad_date - maybe this should be moved as a parameter to the annual_overview_RDBES.R ?