فهرست منبع

Modified subdirectory to 'anom_bias' and separated into 2 scripts for calculating biases and anomalies. Created 'nemo_bdy/prepare_ecearth_hindcasts_paraso.sh' for hindcastst from previous script.

Deborah Verfaillie (deborah.verfaillie@uclouvain.be) 2 سال پیش
والد
کامیت
632b96d946
7فایلهای تغییر یافته به همراه155 افزوده شده و 99 حذف شده
  1. 54 0
      anom_bias/calculate_anomalies_Jan.sh
  2. 15 15
      anom_bias/calculate_biases.sh
  3. 23 0
      anom_bias/readme.md
  4. 0 13
      anomalies/readme.md
  5. 61 69
      nemo_bdy/prepare_ecearth_hindcasts_paraso.sh
  6. 1 1
      nemo_bdy/readme.md
  7. 1 1
      readme.md

+ 54 - 0
anom_bias/calculate_anomalies_Jan.sh

@@ -0,0 +1,54 @@
+#!/bin/bash
+set -u
+
+# This script takes EC-Earth hindcast and historical ocean temperature and salinity conditions and calculates anomalies for January 1985 from them.
+# Author: D. Verfaillie
+
+# Inputs
+in_folder="/storepelican/dverfail/bsc/anom_bias"
+oras5_file="ORAS5_preinterp_opa1_grid_T_1985-2014"
+
+# Calculate climatological ORAS5 reference
+module --force purge
+module load releases/2020b
+module load noarch
+module load NCO
+module load CDO
+
+#cd ${in_folder}/"oras5_clim"
+#
+#cdo ymonmean ${oras5_file}.nc ${oras5_file}_Mm.nc
+#
+## Extract January 1985 from ORAS5 file and month of January from climatological reference
+#ncks -d time_counter,0 ${oras5_file}.nc ORAS5_preinterp_opa1_grid_T_Jan1985.nc
+#ncks -d time_counter,0  ${oras5_file}_Mm.nc ${oras5_file}_Mm_Jan.nc
+#
+## Calculate anomalies: Jan 1985 -climatological ref (these anomalies will then have to be ADDED to the PARASO restarts)
+#ncdiff -v conservative_temperature ORAS5_preinterp_opa1_grid_T_Jan1985.nc ${oras5_file}_Mm_Jan.nc ../anomalies/thetao_anomaly_3D_Jan_1985.nc
+#ncdiff -v absolute_salinity ORAS5_preinterp_opa1_grid_T_Jan1985.nc ${oras5_file}_Mm_Jan.nc ../anomalies/so_anomaly_3D_Jan_1985.nc
+#
+# Extract anomalies for the surface only
+cd ${in_folder}/anomalies
+#ncks -d deptht,0 thetao_anomaly_3D_Jan_1985.nc tos_anomaly_2D_Jan_1985.nc
+#ncks -d deptht,0 so_anomaly_3D_Jan_1985.nc sos_anomaly_2D_Jan_1985.nc
+#ncwa -O -a deptht tos_anomaly_2D_Jan_1985.nc tos_anomaly_2D_Jan_1985.nc
+#ncwa -O -a deptht sos_anomaly_2D_Jan_1985.nc sos_anomaly_2D_Jan_1985.nc
+#ncks -O -x -v deptht tos_anomaly_2D_Jan_1985.nc tos_anomaly_2D_Jan_1985.nc
+#ncks -O -x -v deptht sos_anomaly_2D_Jan_1985.nc sos_anomaly_2D_Jan_1985.nc
+#
+## Reformat anomaly files to have the same format as the PARASO restart files
+#ncrename -O -d time_counter,time -v lat,nav_lat -v lon,nav_lon -v conservative_temperature,sst_m tos_anomaly_2D_Jan_1985.nc
+#ncrename -O -d time_counter,time -v lat,nav_lat -v lon,nav_lon -v absolute_salinity,sss_m sos_anomaly_2D_Jan_1985.nc
+#ncrename -O -d time_counter,time -d deptht,z -v deptht,nav_lev -v lat,nav_lat -v lon,nav_lon -v conservative_temperature,tb thetao_anomaly_3D_Jan_1985.nc
+#ncrename -O -d time_counter,time -d deptht,z -v deptht,nav_lev -v lat,nav_lat -v lon,nav_lon -v absolute_salinity,sb so_anomaly_3D_Jan_1985.nc
+#cp tos_anomaly_2D_Jan_1985.nc tos_anomaly_2D_Jan_1985_reformatted.nc
+#cp sos_anomaly_2D_Jan_1985.nc sos_anomaly_2D_Jan_1985_reformatted.nc
+#ncap2 -s 'tn=tb' thetao_anomaly_3D_Jan_1985.nc thetao_anomaly_3D_Jan_1985_reformatted.nc
+#ncap2 -s 'sn=sb' so_anomaly_3D_Jan_1985.nc so_anomaly_3D_Jan_1985_reformatted.nc
+#
+## Combine all anomaly files into a single one
+#cp so_anomaly_3D_Jan_1985_reformatted.nc all_anomalies_Jan_1985.nc
+#ncks -A tos_anomaly_2D_Jan_1985_reformatted.nc sos_anomaly_2D_Jan_1985_reformatted.nc
+#ncks -A sos_anomaly_2D_Jan_1985_reformatted.nc thetao_anomaly_3D_Jan_1985_reformatted.nc
+#ncks -A thetao_anomaly_3D_Jan_1985_reformatted.nc all_anomalies_Jan_1985.nc
+ncap2 -s 'nav_lat=float(nav_lat); lat_bnds=float(lat_bnds); nav_lon=float(nav_lon); lon_bnds=float(lon_bnds); sn=double(sn); sb=double(sb); sss_m=double(sss_m); sst_m=double(sst_m); tb=double(tb); tn=double(tn);' all_anomalies_Jan_1985.nc all_anomalies_Jan_1985_reformatted.nc

+ 15 - 15
anomalies/calculate_anomalies.sh → anom_bias/calculate_biases.sh

@@ -1,11 +1,11 @@
 #!/bin/bash
 set -u
 
-# This script takes ORAS5 and EC-Earth historical ocean temperature and salinity conditions and calculates anomalies from them.
+# This script takes ORAS5 and EC-Earth historical ocean temperature and salinity conditions and calculates biases from them.
 # Author: D. Verfaillie
 
 # Inputs
-in_folder="/storepelican/dverfail/bsc/anom"
+in_folder="/storepelican/dverfail/bsc/anom_bias"
 oras5_file="ORAS5_preinterp_opa1_grid_T_1985-2014"
 histo_1m_thetao="thetao_Omon_EC-Earth3_historical_ensmean_gn_198501-201412"
 histo_1m_so="so_Omon_EC-Earth3_historical_ensmean_gn_198501-201412"
@@ -19,22 +19,22 @@ module load CDO
 
 cd ${in_folder}/"oras5_clim"
 
-#cdo remapbil,${in_folder}/oras5_clim/ECEarth_grid_T_new.grid ${oras5_file}.nc ${oras5_file}_remapped.nc
-#ncrename -O -d time_counter,time -d x,i -d y,j -d nvertex,vertices -d deptht,lev -v time_counter,time -v nav_lon,longitude -v nav_lat,latitude -v nav_lon_bnds,longitude_bnds -v nav_lat_bnds,latitude_bnds -v deptht,lev -v conservative_temperature,thetao -v absolute_salinity,so ${oras5_file}_remapped.nc
-#ncap2 -O -s 'defdim("bnds",2);make_bounds(lev,$bnds,"lev_bnds");' ${oras5_file}_remapped.nc ${oras5_file}_remapped_bounds.nc
-#ncks -A -v i,j,lev_bnds ../histo_clim/${histo_1m_thetao}.nc ${oras5_file}_remapped_bounds.nc
+cdo remapbil,${in_folder}/oras5_clim/ECEarth_grid_T_new.grid ${oras5_file}.nc ${oras5_file}_remapped.nc
+ncrename -O -d time_counter,time -d x,i -d y,j -d nvertex,vertices -d deptht,lev -v time_counter,time -v nav_lon,longitude -v nav_lat,latitude -v nav_lon_bnds,longitude_bnds -v nav_lat_bnds,latitude_bnds -v deptht,lev -v conservative_temperature,thetao -v absolute_salinity,so ${oras5_file}_remapped.nc
+ncap2 -O -s 'defdim("bnds",2);make_bounds(lev,$bnds,"lev_bnds");' ${oras5_file}_remapped.nc ${oras5_file}_remapped_bounds.nc
+ncks -A -v i,j,lev_bnds ../histo_clim/${histo_1m_thetao}.nc ${oras5_file}_remapped_bounds.nc
 ncap2 -s 'lev=double(lev); lev_bnds=double(lev_bnds); longitude=float(longitude); longitude_bnds=float(longitude_bnds); latitude=float(latitude); latitude_bnds=float(latitude_bnds);' ${oras5_file}_remapped_bounds.nc ${oras5_file}_remapped_bounds_reformatted.nc
 ncks -O -x -v so,sossheig ${oras5_file}_remapped_bounds_reformatted.nc thetao_ORAS5_preinterp_opa1_grid_T_1985-2014.nc
 ncks -O -x -v thetao,sossheig ${oras5_file}_remapped_bounds_reformatted.nc so_ORAS5_preinterp_opa1_grid_T_1985-2014.nc
 
-# Calculate monthly and climatological anomalies: histo - oras5 (these anomalies will then have to be SUBSTRACTED from the hindcasts)
-ncdiff ../histo_clim/${histo_1m_so}.nc thetao_ORAS5_preinterp_opa1_grid_T_1985-2014.nc ../anom_histo-oras5/thetao_anomaly_1985-2014_1m.nc
-ncdiff ../histo_clim/${histo_1m_thetao}.nc so_ORAS5_preinterp_opa1_grid_T_1985-2014.nc ../anom_histo-oras5/so_anomaly_1985-2014_1m.nc
+# Calculate monthly and climatological biases: histo - oras5 (these biases will then have to be SUBSTRACTED from the hindcasts)
+ncdiff ../histo_clim/${histo_1m_so}.nc thetao_ORAS5_preinterp_opa1_grid_T_1985-2014.nc ../bias_histo-oras5/thetao_bias_1985-2014_1m.nc
+ncdiff ../histo_clim/${histo_1m_thetao}.nc so_ORAS5_preinterp_opa1_grid_T_1985-2014.nc ../bias_histo-oras5/so_bias_1985-2014_1m.nc
 
-cd ${in_folder}/anom_histo-oras5
-cdo ymonmean thetao_anomaly_1985-2014_1m.nc thetao_anomaly_1985-2014_Mm.nc
-cdo ymonmean so_anomaly_1985-2014_1m.nc so_anomaly_1985-2014_Mm.nc
+cd ${in_folder}/bias_histo-oras5
+cdo ymonmean thetao_bias_1985-2014_1m.nc thetao_bias_1985-2014_Mm.nc
+cdo ymonmean so_bias_1985-2014_1m.nc so_bias_1985-2014_Mm.nc
 
-# Reformat the anomaly files to have same format as EC-Earth hindcast ocean temperature and salinity files
-ncrename -O -d time,time_counter -d i,x -d j,y -d vertices,nvertex -d lev,olevel -d bnds,axis_nbounds -v time,time_counter -v time_bnds,time_counter_bounds -v latitude,nav_lat -v latitude_bnds,bounds_nav_lat -v longitude,nav_lon -v longitude_bnds,bounds_nav_lon -v lev,olevel -v lev_bnds,olevel_bounds thetao_anomaly_1985-2014_Mm.nc thetao_anomaly_1985-2014_Mm_reformatted.nc
-ncrename -O -d time,time_counter -d i,x -d j,y -d vertices,nvertex -d lev,olevel -d bnds,axis_nbounds -v time,time_counter -v time_bnds,time_counter_bounds -v latitude,nav_lat -v latitude_bnds,bounds_nav_lat -v longitude,nav_lon -v longitude_bnds,bounds_nav_lon -v lev,olevel -v lev_bnds,olevel_bounds so_anomaly_1985-2014_Mm.nc so_anomaly_1985-2014_Mm_reformatted.nc
+# Reformat the bias files to have same format as EC-Earth hindcast ocean temperature and salinity files
+ncrename -O -d time,time_counter -d i,x -d j,y -d vertices,nvertex -d lev,olevel -d bnds,axis_nbounds -v time,time_counter -v time_bnds,time_counter_bounds -v latitude,nav_lat -v latitude_bnds,bounds_nav_lat -v longitude,nav_lon -v longitude_bnds,bounds_nav_lon -v lev,olevel -v lev_bnds,olevel_bounds thetao_bias_1985-2014_Mm.nc thetao_bias_1985-2014_Mm_reformatted.nc
+ncrename -O -d time,time_counter -d i,x -d j,y -d vertices,nvertex -d lev,olevel -d bnds,axis_nbounds -v time,time_counter -v time_bnds,time_counter_bounds -v latitude,nav_lat -v latitude_bnds,bounds_nav_lat -v longitude,nav_lon -v longitude_bnds,bounds_nav_lon -v lev,olevel -v lev_bnds,olevel_bounds so_bias_1985-2014_Mm.nc so_bias_1985-2014_Mm_reformatted.nc

+ 23 - 0
anom_bias/readme.md

@@ -0,0 +1,23 @@
+# Calculating ocean temperature and salinity biases of EC-Earth vs. ORAS5 and anomalies of ORAS5 vs. its climatological reference.
+
+Scripts for calculating ocean temperature and salinity biases of EC-Earth historical runs vs. ORAS5 and January 1985 anomalies of ORAS5 vs. its climatological reference.
+
+1. Biases of EC-Earth compared to observations are calculated using NCO and CDO operators in the script `calculate_biases.sh`. Please read the NCO and CDO documentation for information on the commands used. The BSC provided us with EC-Earth historical files of ocean temperature and salinity on 75 depth levels, which are ensemble means of their 10 historical members over the period 1985-2014, at monthly resolution. The observations we use consist of the corresponding file (ocean temperature and salinity inside the same netcdf file) from the ORAS5 ocean reanalysis.
+
+ The first step in `calculate_biases.sh` is to prepare the ORAS5 file to have the same grid (remapping) and format (renaming and reformatting of dimensions and variables, separation into 2 different files for temperature and salinity) as the EC-Earth files. 
+
+ Then, the biases are calculated at a monthly timestep and on each depth level as the difference between the variable (temperature/salinity) in the EC-Earth historical file and the variable in ORAS5. These biases will thus have to be SUBSTRACTED from the hindcasts later on. Note that this step is extremely slow on pelican (it takes several hours).
+
+ Climatological biases (for mean January, February, etc. over the 1985-2014 period) are then calculated.
+
+ A final reformatting step then takes place to have the same format (renaming of dimensions and variables) as the EC-Earth hindcast ocean temperature and salinity files used for the boundary conditions.
+
+2. Anomalies of ORAS5 vs. its climatological reference are calculated for January 1985 using NCO and CDO operators in the script `calculate_anomalies_Jan.sh`. We use the climatological mean ORAS5 file of ocean temperature and salinity over 1985-2014 as the observational reference. The ORAS5 ocean conditions for January 1985 are also used.
+
+ The first step in `calculate_anomalies_Jan.sh` is to extract the time step corresponding to January 1985 from the ORAS5 file and the month of January from the climatological reference. 
+
+ Then the anomalies for January 1985 are calculated for every depth level as the difference between the ORAS5 values of temperature/salinity for January 1985 and the climatological values for January in the ORAS5 reference. These anomalies will thus have to be ADDED to the PARASO restarts later on.
+ 
+ Anomalies for the surface are then extracted from the 3D anomalies.
+
+ A final reformatting step then takes place to have the same format (renaming of dimensions and variables, concatenation of surface and 3D variables into one single file) as the PARASO restart files used for the initial conditions.

+ 0 - 13
anomalies/readme.md

@@ -1,13 +0,0 @@
-# Calculating ocean temperature and salinity anomalies of EC-Earth vs. ORAS5.
-
-Script for calculating ocean temperature and salinity anomalies of EC-Earth historical runs vs. ORAS5.
-
-Anomalies of EC-Earth compared to observations are calculated using NCO and CDO operators in the script `calculate_anomalies.sh`. Please read the NCO and CDO documentation for information on the commands used. The BSC provided us with EC-Earth historical files of ocean temperature and salinity on 75 depth levels, which are ensemble means of their 10 historical members over the period 1985-2014, at monthly resolution. The observations we use consist of the corresponding file (ocean temperature and salinity inside the same netcdf file) from the ORAS5 ocean reanalysis.
-
-The first step in `calculate_anomalies.sh` is to prepare the ORAS5 file to have the same grid (remapping) and format (renaming and reformatting of dimensions and variables, separation into 2 different files for temperature and salinity) as the EC-Earth files. 
-
-Then, the anomalies are calculated at a monthly timestep and on each depth level as the difference between the variable (temperature/salinity) in the EC-Earth historical file and the variable in ORAS5. These anomalies will thus have to be SUBSTRACTED from the hindcasts later on. Note that this step is extremely slow on pelican (it takes several hours).
-
-Climatological anomalies (for mean January, February, etc. over the 1985-2014 period) are then calculated.
-
-A final reformatting step then takes place to have the same format (renaming of dimensions and variables) as the EC-Earth hindcast ocean temperature and salinity files used for the boundary conditions.

+ 61 - 69
nemo_bdy/prepare_ecearth_hindcasts_paraso.sh

@@ -1,23 +1,24 @@
 #!/bin/bash
 set -u
 
-# This script takes EC-Earth outputs, reinterpolates them to the NEMO grid, and then generates BDY dta from it.
-# Author: C. Pelletier
+# This script takes EC-Earth hindcast outputs, reinterpolates them to the NEMO grid, and then generates BDY dta from it.
+# Author: C. Pelletier & D. Verfaillie
 
 # Inclusive year range
 year_start=1985
-year_stop=2013
+year_stop=2014
 
-# Input prefix (with folder) for input data files (in .tar format).
-in_prefix="/storepelican/dverfail/bsc/anom/hindcasts"
+# Input prefix (with folder) for input data files.
+in_prefix="/storepelican/dverfail/bsc/anom_bias/hindcasts"
 # Name of experience
 name_exp="a3du"
-fc_num="fc00"
 # Frequency
 freq="1m"
 
+for fc_num in fc00 fc01 fc02; do
+
 # Working folder where pre-interpolated datafiles will be put
-dest_folder="/storepelican/dverfail/nemo_bdy/bdydta"
+dest_folder="/storepelican/dverfail/bsc/nemo_bdy/bdydta"
 dest_prefix="ECEarth_${name_exp}_${fc_num}_${freq}_eORCA025-SO_BDYDTA_nbr1_"
 
 pwd=`pwd`
@@ -48,19 +49,18 @@ for((year=year_start;year<=year_stop;year++)); do
 
     # Loop over input years.
     
-    module purge
-    module load 2018b CDO NCO
+    module --force purge
+    module load releases/2020b
+    module load noarch
+    module load NCO
+    module load CDO
 
     # 1) Extract T, S and ssh (T grid).
 
-    tar -xvf ${in_prefix}/${fc_num}/MMO_${name_exp}_19841101_${fc_num}_${year}0101-${year}1231.tar ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_T_3D.nc ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_T_2D.nc
-    
-    cdo selname,thetao,so ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_T_3D.nc tmp_pid${pid}.nc
-    cdo selname,zos ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_T_2D.nc tmp2_pid${pid}.nc
+    cdo selname,thetao,so ${in_prefix}/${fc_num}/${name_exp}_${freq}_opa_grid_T_3D_${year}.nc tmp_pid${pid}.nc
+    cdo selname,zos ${in_prefix}/${fc_num}/${name_exp}_${freq}_opa_grid_T_2D_${year}.nc tmp2_pid${pid}.nc
     cdo merge tmp_pid${pid}.nc tmp2_pid${pid}.nc tmp3_pid${pid}.nc
 
-    rm -f ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_T_3D.nc ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_T_2D.nc
-    
     # precut
     cdo -O sellonlatbox,${latlon_cut} tmp3_pid${pid}.nc tmp_pid${pid}.nc
 
@@ -71,42 +71,36 @@ for((year=year_start;year<=year_stop;year++)); do
     cdo remapbil,${dest_gridfile_t} tmp_pid${pid}.nc tmp2_pid${pid}.nc
     cdo setmisstonn tmp2_pid${pid}.nc tmp_pid${pid}.nc
 
-    module purge
-    module load ELIC/0.1-foss-2018b-Python-3.6.6
+    module --force purge
+    module load releases/2019a
+    module load noarch
+    module load Java/11.0.2
+    module load ELIC_Python/1-foss-2019a-Python-3.7.2
 
     input_full=`readlink -f tmp_pid${pid}.nc`
     output_full="${dest_folder}/${dest_prefix}grid_T_y${year}.nc"
     
     python ${reformat_script} ${input_full} t ${output_full}
 
-    module purge
-    module load CDO NCO    
-    
+    module --force purge
+    module load releases/2020b
+    module load noarch
+    module load NCO
+    module load CDO
+
     # 2) Extract u velocities.
 
-    if [ "${freq}" == "1d" ]; then
-	
-	tar -xvf ${in_prefix}/${name_exp}/NEMO/MMO_${name_exp}_18500101_fc0_${year}0101-${year}1231.tar ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_U_3D.nc ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_U_2D.nc
-	cdo selname,ubar ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_U_2D.nc tmp2_pid${pid}.nc
-
-    else
-	# ubar is not stored in monthly outputs, so take it from daily and monmean
-	tar -xvf ${in_prefix}/${name_exp}/NEMO/MMO_${name_exp}_18500101_fc0_${year}0101-${year}1231.tar ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_U_3D.nc ${name_exp}_1d_${year}0101_${year}1231_opa_grid_U_2D.nc
-	cdo selname,ubar ${name_exp}_1d_${year}0101_${year}1231_opa_grid_U_2D.nc tmp3_pid${pid}.nc
-	cdo monmean tmp3_pid${pid}.nc tmp2_pid${pid}.nc
-	
-    fi    
-    
-    cdo selname,uo ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_U_3D.nc tmp_pid${pid}.nc
-    cdo merge tmp_pid${pid}.nc tmp2_pid${pid}.nc tmp3_pid${pid}.nc
+    #calculate ubarotropic from uo (3D): vertical mean of uo
+    cdo selname,uo ${in_prefix}/${fc_num}/${name_exp}_${freq}_opa_grid_U_3D_${year}.nc tmp_pid${pid}.nc
+    cdo vertmean tmp_pid${pid}.nc tmp2_pid${pid}.nc
+    ncap2 -O -s 'ubar = uo;' tmp2_pid${pid}.nc tmp3_pid${pid}.nc
+    cdo merge tmp_pid${pid}.nc tmp3_pid${pid}.nc tmp4_pid${pid}.nc
 
-    rm -f ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_U_3D.nc ${name_exp}_??_${year}0101_${year}1231_opa_grid_U_2D.nc
-    
     # precut
-    cdo -O sellonlatbox,${latlon_cut} tmp3_pid${pid}.nc tmp_pid${pid}.nc
+    cdo -O sellonlatbox,${latlon_cut} tmp4_pid${pid}.nc tmp_pid${pid}.nc
 
     ncap2 -O -s 'uobaroclinic = uo - ubar;' tmp_pid${pid}.nc tmp2_pid${pid}.nc
-    ncks -x -v uo tmp2_pid${pid}.nc -O tmp_pid${pid}.nc
+    ncks -x -v uo,uo_2 tmp2_pid${pid}.nc -O tmp_pid${pid}.nc
     ncrename -v ubar,uobarotropic tmp_pid${pid}.nc
     ncrename -v olevel,depthu -v olevel_bnds,depthu_bnds tmp_pid${pid}.nc
     ncatted -a bounds,depthu,o,c,"depthu_bnds" -a name,depthu,o,c,"depthu" tmp_pid${pid}.nc
@@ -117,43 +111,36 @@ for((year=year_start;year<=year_stop;year++)); do
     cdo remapbil,${dest_gridfile_u} tmp2_pid${pid}.nc tmp_pid${pid}.nc
     cdo setmisstonn tmp_pid${pid}.nc tmp2_pid${pid}.nc
 
-    module purge
-    module load ELIC/0.1-foss-2018b-Python-3.6.6
+    module --force purge
+    module load releases/2019a
+    module load noarch
+    module load Java/11.0.2
+    module load ELIC_Python/1-foss-2019a-Python-3.7.2
 
     input_full=`readlink -f tmp2_pid${pid}.nc`
     output_full="${dest_folder}/${dest_prefix}grid_U_y${year}.nc"
     
     python ${reformat_script} ${input_full} u ${output_full}
 
-    module purge
-    module load CDO NCO    
-
+    module --force purge
+    module load releases/2020b
+    module load noarch
+    module load NCO
+    module load CDO
     
     # 3) Extract v velocities.
 
-    if [ "${freq}" == "1d" ]; then
-	
-	tar -xvf ${in_prefix}/${name_exp}/NEMO/MMO_${name_exp}_18500101_fc0_${year}0101-${year}1231.tar ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_V_3D.nc ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_V_2D.nc
-	cdo selname,vbar ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_V_2D.nc tmp2_pid${pid}.nc
-
-    else
-	# vbar is not stored in monthly outputs, so take it from daily and monmean
-	tar -xvf ${in_prefix}/${name_exp}/NEMO/MMO_${name_exp}_18500101_fc0_${year}0101-${year}1231.tar ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_V_3D.nc ${name_exp}_1d_${year}0101_${year}1231_opa_grid_V_2D.nc
-	cdo selname,vbar ${name_exp}_1d_${year}0101_${year}1231_opa_grid_V_2D.nc tmp3_pid${pid}.nc
-	cdo monmean tmp3_pid${pid}.nc tmp2_pid${pid}.nc
-	
-    fi    
-    
-    cdo selname,vo ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_V_3D.nc tmp_pid${pid}.nc
-    cdo merge tmp_pid${pid}.nc tmp2_pid${pid}.nc tmp3_pid${pid}.nc
+    #calculate vbarotropic from vo (3D): vertical mean of vo
+    cdo selname,vo ${in_prefix}/${fc_num}/${name_exp}_${freq}_opa_grid_V_3D_${year}.nc tmp_pid${pid}.nc
+    cdo vertmean tmp_pid${pid}.nc tmp2_pid${pid}.nc
+    ncap2 -O -s 'vbar = vo;' tmp2_pid${pid}.nc tmp3_pid${pid}.nc
+    cdo merge tmp_pid${pid}.nc tmp3_pid${pid}.nc tmp4_pid${pid}.nc
 
-    rm -f ${name_exp}_${freq}_${year}0101_${year}1231_opa_grid_V_3D.nc ${name_exp}_??_${year}0101_${year}1231_opa_grid_V_2D.nc
-    
     # precut
-    cdo -O sellonlatbox,${latlon_cut} tmp3_pid${pid}.nc tmp_pid${pid}.nc
+    cdo -O sellonlatbox,${latlon_cut} tmp4_pid${pid}.nc tmp_pid${pid}.nc
 
     ncap2 -O -s 'vobaroclinic = vo - vbar;' tmp_pid${pid}.nc tmp2_pid${pid}.nc
-    ncks -x -v vo tmp2_pid${pid}.nc -O tmp_pid${pid}.nc
+    ncks -x -v vo,vo_2 tmp2_pid${pid}.nc -O tmp_pid${pid}.nc
     ncrename -v vbar,vobarotropic tmp_pid${pid}.nc
     ncrename -v olevel,depthv -v olevel_bnds,depthv_bnds tmp_pid${pid}.nc
     ncatted -a bounds,depthv,o,c,"depthv_bnds" -a name,depthv,o,c,"depthv" tmp_pid${pid}.nc
@@ -164,19 +151,24 @@ for((year=year_start;year<=year_stop;year++)); do
     cdo remapbil,${dest_gridfile_v} tmp2_pid${pid}.nc tmp_pid${pid}.nc
     cdo setmisstonn tmp_pid${pid}.nc tmp2_pid${pid}.nc 
 
-    module purge
-    module load ELIC/0.1-foss-2018b-Python-3.6.6
+    module --force purge
+    module load releases/2019a
+    module load noarch
+    module load Java/11.0.2
+    module load ELIC_Python/1-foss-2019a-Python-3.7.2
 
     input_full=`readlink -f tmp2_pid${pid}.nc`
     output_full="${dest_folder}/${dest_prefix}grid_V_y${year}.nc"
     
     python ${reformat_script} ${input_full} v ${output_full}
 
-    module purge
-    module load CDO NCO    
-
+    module --force purge
+    module load releases/2020b
+    module load noarch
+    module load NCO
+    module load CDO
     
 done
-
+done
 
 rm -rf ./*pid${pid}*

+ 1 - 1
nemo_bdy/readme.md

@@ -5,7 +5,7 @@ Scripts for generating lateral ocean boundary condition from EC-Earth ORCA1 outp
 Steps:
 
   1. Run `python generate_new_bdy_geom.py`. All inputs are defined on top of the script with explicit comments.
-  2. Run `prepare_ecearth_paraso.sh`. All inputs are defined on top of the script with explicit comments. Be sure to use the "geometry" file that the script in 1. created.
+  2. Run `prepare_ecearth_paraso.sh` or `prepare_ecearth_hindcasts_paraso.sh`. All inputs are defined on top of the script with explicit comments. Be sure to use the "geometry" file that the script in 1. created.
 
 Then you should be settled, i.e. have boundary geometry and data files. Both scripts defined above are commented. 
 

+ 1 - 1
readme.md

@@ -1,4 +1,4 @@
-  - `anomalies`: calculating ocean temperature and salinity anomalies of EC-Earth vs. ORAS5.
+  - `anom_bias`: calculating ocean temperature and salinity biases of EC-Earth vs. ORAS5 and anomalies of ORAS5 vs. its climatological reference.
 
   - `interp`: general guidelines and toolbox for performing horizontal and vertical interpolations with CDO.