Verification tool
------------------
This folder is testing how to create a Verification tool for CS

The OperationalCS.R is the principal code.
It requires to files for now:
- the recipe (.yml) in which the system(s) to be verified are specified, as well as, other info:
  + Variables: ECVs and Indicators
  + Time: frequency, periods, ...
  + Regions: Global, aggregations, specific regions of grid points
  + Workflow: the order and methods to apply in the verification
- the conf_user.yml (eventually, it could be merge to the recipe). For now, it contains:
  + the output_dir (there are no outputs right now)
  + the path to the code (this folder for now)

The OperationalCS.R can be run in the command line:

```
Rscript OperationalCS.R conf_user.yml recipe_seasonal.yml
```
*Note that this line should be run in the folder where the OperationalCS.R is saved*

Given that it is under-development, the OperationalCS.R contains commented lines to run each step in an R session.


##### What OperationalCS.R does for now?

It reads the configuration file and the recipe.
It loads many things (some not used for now).
It loads three functions in which we are working on:
- `check_conf()` (.R file in data_analysis folder)
- `check_recipe()` (.R file in data_analysis folder) which calls to 
- `check_number_of_dependent_verifications()`

The functions `check_conf` and `check_recipe` will be improved when we agree on the structure and ensure it is plausible.

The function `check_number_of_dependent_verifications()` is very relevant to confirm we can distinguish when variables and indicators require independent verifications or when they can be part of the same verification analysis. It requires the recipe and the conf and it returns a list of 2 and a message. For instance:

```r
> check_number_of_dependent_verifications(recipe, conf)
The variables for independent verification are tasmax
The variables for dependent verification are: c("tas", "gdd", "gst")
$independent
[1] "tasmax"

$dependent
$dependent[[1]]
[1] "tas" "gdd" "gst"
```

The variables and indicators listed in independent can be verified in separated analysis.
The variables and indicators listed in dependent can be verified in a common analysis to avoid calibrating 'tas' 3 times. The analysis specified by the user follows this order:
1. Calibration
2. Indicators

That is why we know they can be part of the same analysis.

There are tests of this function in `data_analysis/test_check_number_of_dependent_verifications.R`.

During this process, a few tables (or dictionnairs) have been detected to be needed:
- data_table.yml to describe the name and characteristics of the datasets
- indicators_table.yml to describe the indicators name, ECVs required and functions from CSIndicators

### TODO-list:
 -[ ] The frequency of the variables to be loaded should be specified in the same line:

```
Analysis:
  Variables:
    ECVs: 
      - {name: tas, freq: monthly_mean}
      - {name: tas, freq: daily_mean}
```
Instead of being defined in Time section. This implies to modify also the function `check_number_of_dependent_verifications()` given that indicators depend on the frequency of the variables.

 -[ ] The next step is define the workflows to be run given the output from check_recipe()







