|
@@ -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}*
|