README.md 4.51 KB
Newer Older
Ingredients to make a reproducibility test of EC-Earth 3.1 and later.
Francois Massonnet's avatar
Francois Massonnet committed
Largely based on Paolo Davini's initial scripts to make a climate assessment of EC-Earth
Francois Massonnet's avatar
Francois Massonnet committed

Francois Massonnet's avatar
Francois Massonnet committed
Current limitations and constraints:
* The output must come from EC-Earth 3.1 or later
Francois Massonnet's avatar
Francois Massonnet committed
* The output must be available as MMO, MMA tar files and ICMGG, ICMSH grib files
* The output must consist in 12 month data per file
spalomas's avatar
spalomas committed
* You have to use the classic outclass (https://earth.bsc.es/gitlab/es/auto-ecearth3/-/issues/1547)
* The simulation must start with January and finish with December
spalomas's avatar
spalomas committed
* Run at least 5 members for each experiment
* The scripts are adapted to compare two and only two experiments at time (in `compare.sh`)

In proj.conf, set:
* NFIXYR=`"YEAR OF YOUR SIMULATION (YYYY)"`
* OCEAN_ini=official_repro
* OCEAN_ini_member=all_members
* ICE_ini=official_repro
* ICE_ini_member=all_members
* ATM_ini=official_repro
* ATM_ini_member=all_members
* ATM_ini_member_perturb=FALSE
* SAVEMMA=TRUE
* SAVEMMO=TRUE
Francois Massonnet's avatar
Francois Massonnet committed

Pablo Echevarria's avatar
Pablo Echevarria committed
# Checkout the git project from the BSC archive

Pablo Echevarria's avatar
Pablo Echevarria committed
```sh
Pablo Echevarria's avatar
Pablo Echevarria committed
 git clone https://earth.bsc.es/gitlab/es/reproducibility-test.git
Pablo Echevarria's avatar
Pablo Echevarria committed
 cd reproducibility-test
Pablo Echevarria's avatar
Pablo Echevarria committed
 git checkout master
```
Francois Massonnet's avatar
Francois Massonnet committed

Pablo Echevarria's avatar
Pablo Echevarria committed
# Edit the configuration file

Pablo Echevarria's avatar
Pablo Echevarria committed
```sh
Pablo Echevarria's avatar
Pablo Echevarria committed
 vi ./scripts/config.sh
```
spalomas's avatar
spalomas committed
setting variables:
- STARTDATE=`"YOUR START_DATE (YYYYMMDD)"`
- ECVERSION=`"3.3.1 OF LATTER"`
- maskfile=${ece3_constant_files}/ifs/`"RESOLUTION"`/ICMGGECE3INIT
Francois Massonnet's avatar
Francois Massonnet committed

Pablo Echevarria's avatar
Pablo Echevarria committed

spalomas's avatar
spalomas committed
# Run the reproducibility test
## A) Use the full_loop script
If you feel lucky, set and run the `full_repro_loop.sh` script
spalomas's avatar
spalomas committed
```sh
 ./full_repro_loop a3ko a3kp 1950 1950 5
```
Pablo Echevarria's avatar
Pablo Echevarria committed

spalomas's avatar
spalomas committed
## B) Go step by step
Pablo Echevarria's avatar
Pablo Echevarria committed
# Pre-process the EC-Earth output

Pablo Echevarria's avatar
Pablo Echevarria committed
```sh
Pablo Echevarria's avatar
Pablo Echevarria committed
cd ./scripts
Pablo Echevarria's avatar
Pablo Echevarria committed
./preprocess.sh ${exp} ${member} ${yearb} ${yeare}
Pablo Echevarria's avatar
Pablo Echevarria committed
```
Francois Massonnet's avatar
Francois Massonnet committed

[ Execute ./preprocess.sh to see the help ]

Process *all* your members of all experiments. This can be done in paralle
by using nohup commands for instance:

Pablo Echevarria's avatar
Pablo Echevarria committed
```sh
Pablo Echevarria's avatar
Pablo Echevarria committed
exp=m06e;
for i in 0 1 2 3 4 ;  do 
  sleep 2; 
Pablo Echevarria's avatar
Pablo Echevarria committed
  ./preprocess.sh ${exp} fc${i} 1850 1869 >& log/log_prpr_${exp}_fc${i} 
Pablo Echevarria's avatar
Pablo Echevarria committed
done
```
Francois Massonnet's avatar
Francois Massonnet committed

Pablo Echevarria's avatar
Pablo Echevarria committed
# Re-grid to the same grid as the observational reference

Pablo Echevarria's avatar
Pablo Echevarria committed
```
for member in 0 1 2 3 4 ;  do
  sleep 2;
spalomas's avatar
spalomas committed
  nohup ./postprocess.sh ${exp} fc${member} ${yearb} ${yeare}
Pablo Echevarria's avatar
Pablo Echevarria committed
```

Pablo Echevarria's avatar
Pablo Echevarria committed
# Compute the Reichler and Kim indices

Pablo Echevarria's avatar
Pablo Echevarria committed
```sh
Pablo Echevarria's avatar
Pablo Echevarria committed
./scores.sh ${exp} ${member} ${yearb} ${yeare}
Pablo Echevarria's avatar
Pablo Echevarria committed
```
Francois Massonnet's avatar
Francois Massonnet committed

Francois Massonnet's avatar
Francois Massonnet committed
NetCDF files and a text file will be available in the directory EC-Earth_diags.
This text file (PI3.txt) consists in scores. By looking at how scores vary from
member to member one can guess if an experiment is reproducible wrt another one.
Francois Massonnet's avatar
Francois Massonnet committed

Francois Massonnet's avatar
Francois Massonnet committed
Once steps 1/ -> 5/ have been done for all members, we can proceed
to ensemble analyses:

Pablo Echevarria's avatar
Pablo Echevarria committed
# Ensemble analyses

Pablo Echevarria's avatar
Pablo Echevarria committed
```sh
./ensemble.sh ${exp} ${yearb} ${yeare}
Pablo Echevarria's avatar
Pablo Echevarria committed
```

Process all your experiments with this script. And then produce the plots comparing the Reichler and Kim indices and the variables differences between two experiments:

Pablo Echevarria's avatar
Pablo Echevarria committed
# Run reproducibility diagnostics between two experiments

Pablo Echevarria's avatar
Pablo Echevarria committed
```sh
Pablo Echevarria's avatar
Pablo Echevarria committed
./compare.sh ${exp1} ${exp2} ${year1} ${year2} ${number_of_members}
Pablo Echevarria's avatar
Pablo Echevarria committed
```
This script launch three R scripts:

spalomas's avatar
spalomas committed
1. Create the plots for basic time series (2-m temperature, sea ice extent, precip)
2. The second on make the comparison based on the Reichler-Kim indices with the KS test (script R_scripts/KS_index.R). It produces the plot reichler_kim_scores_stat_${exp1}_${exp2}.eps
3. The third script produces the maps of the differences, with a KS test applied in each grid cell (script map_diff_experiments.R), for the variables 't2m','msl','qnet','tp','ewss','nsss' and 'SICE'. RData files are also saved to redo quickly the maps, changing for example the levels of the colour bars.

spalomas's avatar
spalomas committed
The results will be in scripts/EC-Earth_diags. 
If you prefere the plots to be in **pdf** format, just run the convert_and_merge_to_pdf script:

```sh
./convert_and_merge_to_pdf ${exp1} ${exp2}
```
spalomas's avatar
spalomas committed
Note that there is no proper way to handle fc?? naming for members (it should work fine with fc?). If you are using it,  you should do some changes in the R_scripts:

- R_scripts/basic_plots.R :
spalomas's avatar
spalomas committed
```
 -@@ -48,7 +48,7 @@ tp  <- array(NA, dim = c(n.exp,         n.memb, n.year, n.month))
   for (j.memb in seq(1, n.memb)) {
-    fcmemb <- paste("fc", j.memb - 1, sep = "")
+    fcmemb <- paste("fc0", j.memb - 1, sep = "")
     print(paste("  ", fcmemb))
     # SEA ICE
```

- R_scripts/map_diff_experiments.R :
spalomas's avatar
spalomas committed
```
@@ -41,7 +41,7 @@ for (jexp in 1:2) {
   for (jmemb in 1:nmemb) {

     memb=jmemb-1
-    fnc <- open.ncdf(paste(path,'/',exp_name[jexp],'/fc',memb,'/',var,'_mon_2x2.nc',sep=""))
+    fnc <- open.ncdf(paste(path,'/',exp_name[jexp],'/fc0',memb,'/',var,'_mon_2x2.nc',sep=""))
     lon <- get.var.ncdf(fnc,'longitude')
```