From d6d71b0377f2738f2a59a144b721ff3899d25250 Mon Sep 17 00:00:00 2001
From: Martin Schupfner <k204212@levante0.atos.local>
Date: Tue, 29 Nov 2022 19:14:37 +0100
Subject: [PATCH] cmor - mpiesm - adjustments for methane experiments and MK
 errataBatch

---
 cmor/mpiesm/scripts/Create_Version_dir.sh     | 15 ++++++-----
 .../mpiesm/scripts/calc_nominal_resolution.py | 12 ++++++---
 cmor/mpiesm/scripts/ncatted.sh                |  8 +++++-
 ...mod2_cmor-rewrite_MPI-ESM1-2_echam6_auto.h |  4 +--
 ...mod2_cmor-rewrite_MPI-ESM1-2_jsbach_auto.h |  2 --
 ...lmod2_cmor-rewrite_MPI-ESM1-2_mpiom_auto.h |  4 +--
 ...almod2_diagnostic_MPI-ESM1-2_echam6_auto.h |  9 +++++++
 .../ssp119-future-methane_r1i1p1f1-CR.runpp   | 27 +++++++++----------
 ...rescribed-glac1d-methane_r1i1p1f1-CR.runpp |  9 ++++---
 ...bed-glac1d-methane_r1i1p1f1-CR_cdocmorinfo |  8 +++---
 ...iation-prescribed-glac1d_r1i1p1f1-CR.runpp |  4 +--
 ...-prescribed-glac1d_r1i1p1f1-CR_cdocmorinfo |  2 +-
 ...iation-prescribed-glac1d_r1i1p2f2-CR.runpp |  2 +-
 ...-prescribed-glac1d_r1i1p2f2-CR_cdocmorinfo |  2 +-
 ...iation-prescribed-glac1d_r1i1p3f2-CR.runpp |  2 +-
 ...-prescribed-glac1d_r1i1p3f2-CR_cdocmorinfo |  2 +-
 ...ciation-prescribed-ice6g_r1i1p1f1-CR.runpp |  2 +-
 ...n-prescribed-ice6g_r1i1p1f1-CR_cdocmorinfo |  2 +-
 ...ciation-prescribed-ice6g_r1i1p2f2-CR.runpp |  2 +-
 ...n-prescribed-ice6g_r1i1p2f2-CR_cdocmorinfo |  2 +-
 ...ciation-prescribed-ice6g_r1i1p3f2-CR.runpp |  2 +-
 ...n-prescribed-ice6g_r1i1p3f2-CR_cdocmorinfo |  2 +-
 22 files changed, 67 insertions(+), 57 deletions(-)

diff --git a/cmor/mpiesm/scripts/Create_Version_dir.sh b/cmor/mpiesm/scripts/Create_Version_dir.sh
index e22fd4e..229c3a2 100644
--- a/cmor/mpiesm/scripts/Create_Version_dir.sh
+++ b/cmor/mpiesm/scripts/Create_Version_dir.sh
@@ -1,10 +1,12 @@
 #!/bin/bash
 
-drs_root="/work/bk1192/k204212/palmod_thirdBatch/transient-deglaciation-prescribed-*/archive/PalMod2"
-#drs_root=/scratch/m/m300749/mpiesm-1.2.01-release/experiments/past2k_r1i1p1f1-LR/archive/CMIP6
-new_version=v20221010
+drs_root="/work/kd1292/ESGF_Buff/k204212/palmod/transient-deglaciation-prescribed-*/archive/PalMod2"
+#drs_root="/work/kd1292/ESGF_Buff/k204212/palmod_errataBatch/transient-deglaciation-prescribed-*/archive/PalMod2"
+#drs_root="/work/kd1292/ESGF_Buff/k204212/palmod_thirdBatch/transient-deglaciation-prescribed-*/archive/PalMod2"
+#drs_root="/work/kd1292/k204212/palmod_errataBatch/transient-deglaciation-prescribed-*/archive/PalMod2"
+drs_root="/work/kd1292/ESGF_Buff/k204212/errata/volcello/PalMod2"
+new_version=v20221212
 
-cd $drs_root
 vars=( $(find $drs_root -maxdepth 7 -mindepth 7 -type d) )
 
 ## Check?:
@@ -19,8 +21,7 @@ vars=( $(find $drs_root -maxdepth 7 -mindepth 7 -type d) )
 
 for var in ${vars[@]}; do
   echo $var
-  cd $drs_root
-  cd $var
+  cd $var || exit 1
   # merge
   #mkdir -p $new_version
   #mv -v v????????/*.nc $new_version
@@ -28,7 +29,7 @@ for var in ${vars[@]}; do
   #mv -v v???????? $new_version
   # Create version dir
   mkdir -p $new_version
-  mv *.nc $new_version
+  for i in *.nc ; do mv $i $new_version ; done
 done
 
 
diff --git a/cmor/mpiesm/scripts/calc_nominal_resolution.py b/cmor/mpiesm/scripts/calc_nominal_resolution.py
index cc6328a..c787978 100644
--- a/cmor/mpiesm/scripts/calc_nominal_resolution.py
+++ b/cmor/mpiesm/scripts/calc_nominal_resolution.py
@@ -7,10 +7,14 @@
 # cdo gridarea in.nc out.nc
 ### Calculate nominal resolution
 import nominal_resolution, xarray
-ds=xarray.open_dataset("out.nc")
-a=nominal_resolution.mean_resolution(ds.cell_area.values.ravel(), ds.latitude_bnds.values.ravel().reshape((160000,4)), ds.longitude_bnds.values.ravel().reshape((160000,4)), convertdeg2rad=True, returnMaxDistance=False)
+ds=xarray.open_dataset("out2.nc")
+# mpism
+#a=nominal_resolution.mean_resolution(ds.cell_area.values.ravel(), ds.latitude_bnds.values.ravel().reshape((160000,4)), ds.longitude_bnds.values.ravel().reshape((160000,4)), convertdeg2rad=True, returnMaxDistance=False)
+# mpiom/hamocc
+a=nominal_resolution.mean_resolution(ds.cell_area.values.ravel(), ds.latitude_bnds.values.ravel().reshape((12322,4)), ds.longitude_bnds.values.ravel().reshape((12322,4)), convertdeg2rad=True, returnMaxDistance=False)
 #>>> a
 #20.951768033878334
 nominal_resolution.nominal_resolution(a)
-#'25 km'
-a=nominal_resolution.mean_resolution(ds.cell_area.values.ravel(), ds.latitude_bnds.values.ravel().reshape((160000,4)), ds.longitude_bnds.values.ravel().reshape((160000,4)), convertdeg2rad=True, returnMaxDistance=True)
+#'25 km' # mpism
+#'500 km' # mpiom/hamocc
+#a=nominal_resolution.mean_resolution(ds.cell_area.values.ravel(), ds.latitude_bnds.values.ravel().reshape((160000,4)), ds.longitude_bnds.values.ravel().reshape((160000,4)), convertdeg2rad=True, returnMaxDistance=True)
diff --git a/cmor/mpiesm/scripts/ncatted.sh b/cmor/mpiesm/scripts/ncatted.sh
index bc1826a..04bf042 100644
--- a/cmor/mpiesm/scripts/ncatted.sh
+++ b/cmor/mpiesm/scripts/ncatted.sh
@@ -9,7 +9,10 @@ module load nco
 # Attributes
 TITLE="MPI-ESM1-2 output prepared for PalMod2"
 REFERENCES="Kapsch, M.-L., Mikolajewicz, U., Ziemen, F., & Schannwell, C. (2022). Ocean response in transient simulations of the last deglaciation dominated by underlying ice-sheet reconstruction and method of meltwater distribution. Geophysical Research Letters, 49, e2021GL096767. https://doi.org/10.1029/2021GL096767\nMPI-ESM: Mauritsen, T. et al. (2019), Developments in the MPI‐M Earth System Model version 1.2 (MPI‐ESM1.2) and Its Response to Increasing CO2, J. Adv. Model. Earth Syst.,11, 998-1038, doi:10.1029/2018MS001400,\nMueller, W.A. et al. (2018): A high‐resolution version of the Max Planck Institute Earth System Model MPI‐ESM1.2‐HR. J. Adv. Model. EarthSyst.,10,1383–1413, doi:10.1029/2017MS001217"
-NOMINAL_RESOLUTION="500 km"
+REFERENCES="Kleinen, T., Mikolajewicz, U. and Brovkin, V. (2020). Terrestrial methane emissions from the Last Glacial Maximum to the preindustrial period. Climate of the Past, 16(2):575–595. doi: 10.5194/cp-16-575-2020.\nKleinen, T., Gromov, S., Steil, B. and Brovkin, V. (2021). Atmospheric methane underestimated in future climate projections. Environmental Research Letters, 16(9):094006. doi: 10.1088/1748-9326/ac1814.\nKapsch, M.-L., Mikolajewicz, U., Ziemen, F., & Schannwell, C. (2022). Ocean response in transient simulations of the last deglaciation dominated by underlying ice-sheet reconstruction and method of meltwater distribution. Geophysical Research Letters, 49, e2021GL096767. https://doi.org/10.1029/2021GL096767\nMPI-ESM: Mauritsen, T. et al. (2019), Developments in the MPI‐M Earth System Model version 1.2 (MPI‐ESM1.2) and Its Response to Increasing CO2, J. Adv. Model. Earth Syst.,11, 998-1038, doi:10.1029/2018MS001400,\nMueller, W.A. et al. (2018): A high‐resolution version of the Max Planck Institute Earth System Model MPI‐ESM1.2‐HR. J. Adv. Model. EarthSyst.,10,1383–1413, doi:10.1029/2017MS001217"
+NOMINAL_RESOLUTION="500 km" # echam6, jsbach, mpiom, hamocc
+#NOMINAL_RESOLUTION="km" # vilma
+#NOMINAL_RESOLUTION="25 km" # mPISM
 SOURCE="MPI-ESM1.2-CR (2017): \naerosol: none, prescribed Kinne (2010)\natmos: ECHAM6.3 (spectral T31; 96 x 48 longitude/latitude; 31 levels; top level 10 hPa)\natmosChem: none\nland: JSBACH3.20\nlandIce: none/prescribed\nocean: MPIOM1.63 (bipolar GR3.0, approximately 300km; 122 x 101 longitude/latitude; 40 levels; top grid cell 0-15 m)\nocnBgchem: none\nseaIce: unnamed (thermodynamic (Semtner zero-layer) dynamic (Hibler 79) sea ice model)\nsolidLand: none/prescribed"
 CONVENTIONS="CF-1.7 PalMod-2.0"
 CREATION_DATE="2022-02-22T22:00:00Z"
@@ -59,6 +62,7 @@ ifolder=/work/bk1192/k204212/palmod/${exp_id}/archive/PalMod2/
 ifolder=/work/bk1192/k204212/palmod_secondBatch/${exp_id}/archive/PalMod2/
 ifolder=/work/bk1192/k204212/palmod_thirdBatch/${exp_id}/archive/PalMod2/
 ifolder=/work/kd1292/k204212/palmod_errataBatch/${exp_id}/archive/PalMod2/
+#ifolder=/work/bk1192/k204212/palmod_pismtest/transient-deglaciation-prescribed-glac1d_r1i1p1f1-CR/archive/PalMod2
 #ifolder=/work/ik1017/ESGF_Buff/k204212/PalMod2_test
 
 ifiles=($(find $ifolder -type f))
@@ -70,10 +74,12 @@ echo $i $ifile
     table=$(echo $ifile | rev | cut -d '/' -f 1 | rev | cut -d '_' -f 2)
     memberid=$(echo $ifile | rev | cut -d '/' -f 1 | rev | cut -d '_' -f 5)
     physics_index=${memberid:5:1}
+    uuid="hdl:21.14105/$(uuidgen)"
 
     # Run ncatted
     #ncatted -O -h -a parent_experiment_id,global,m,c,"${PARENTEXPID}" -a variant_info,global,m,c,"${VARIANT_INFO[$physics_index]}" -a history,global,m,c,"$HISTORY" -a creation_date,global,m,c,"$CREATION_DATE" -a physics_index,global,m,c,"$physics_index" -a variant_label,global,m,c,"$memberid" -a table_info,global,m,c,"${TABLE_INFO[$table]}" -a Conventions,global,m,c,"$CONVENTIONS" -a title,global,m,c,"$TITLE" -a references,global,m,c,"$REFERENCES" -a source,global,m,c,"$SOURCE" -a nominal_resolution,global,m,c,"$NOMINAL_RESOLUTION" $ifile || echo "ERROR $ifile"
     #ncatted -O -h -a variant_info,global,m,c,"${VARIANT_INFO[$physics_index]}" $ifile || echo "ERROR $ifile"
+    #ncatted -O -h -a tracking_id,global,m,c,"$uuid" $ifile || echo "ERROR $ifile"
 
     # Adjust filename timestamp
     if [[ "$table" != *"fx"* ]]; then
diff --git a/cmor/mpiesm/scripts/palmod2_cmor-rewrite_MPI-ESM1-2_echam6_auto.h b/cmor/mpiesm/scripts/palmod2_cmor-rewrite_MPI-ESM1-2_echam6_auto.h
index 8c57458..5a65c0d 100644
--- a/cmor/mpiesm/scripts/palmod2_cmor-rewrite_MPI-ESM1-2_echam6_auto.h
+++ b/cmor/mpiesm/scripts/palmod2_cmor-rewrite_MPI-ESM1-2_echam6_auto.h
@@ -1,9 +1,9 @@
 #-- CMOR-rewrite for echam6 (ESM: MPI-ESM1-2) AERmon
 cn='emilnox'
-find_file "$sdir" "*_echam6_lghtng_${period}*" ifile >> $err.find_file.AERmon 2>&1
 for var in $cn; do
   { (if_requested $member $atmmod AERmon $var $chunk || continue
   mkdir -p $dr/$submodel/AERmon_${var}
+  ifile=${sdir}/out_diag/AERmon_${var}_$period.nc
   echo $cdo cmor,AERmon,i=$it,mt=$mt,dr=$dr/$submodel/AERmon_${var},vd=$vd,cn=$var ${cdochain-} $ifile
   $cdo cmor,AERmon,i=$it,mt=$mt,dr=$dr/$submodel/AERmon_${var},vd=$vd,cn=$var ${cdochain-} $ifile || echo ERROR
   )&; }>>$err.$var.AERmon 2>&1
@@ -86,8 +86,6 @@ for var in $cn; do
   )&; }>>$err.$var.Emon 2>&1
 done
 
-wait # test to reduce failure rate
-
 #-- CMOR-rewrite for echam6 (ESM: MPI-ESM1-2) Emon
 cn='tdps'
 find_file "$sdir" "*_echam_${period}*" ifile >> $err.find_file.Emon 2>&1
diff --git a/cmor/mpiesm/scripts/palmod2_cmor-rewrite_MPI-ESM1-2_jsbach_auto.h b/cmor/mpiesm/scripts/palmod2_cmor-rewrite_MPI-ESM1-2_jsbach_auto.h
index cf09108..55651fc 100644
--- a/cmor/mpiesm/scripts/palmod2_cmor-rewrite_MPI-ESM1-2_jsbach_auto.h
+++ b/cmor/mpiesm/scripts/palmod2_cmor-rewrite_MPI-ESM1-2_jsbach_auto.h
@@ -88,8 +88,6 @@ for var in $cn; do
   )&; }>>$err.$var.Lmon 2>&1
 done
 
-wait # test to reduce failure rate
-
 #-- CMOR-rewrite for jsbach (ESM: MPI-ESM1-2) dec
 cn='mrsofc rootd sftgif sftlf'
 for var in $cn; do
diff --git a/cmor/mpiesm/scripts/palmod2_cmor-rewrite_MPI-ESM1-2_mpiom_auto.h b/cmor/mpiesm/scripts/palmod2_cmor-rewrite_MPI-ESM1-2_mpiom_auto.h
index 4e28305..29c36a9 100644
--- a/cmor/mpiesm/scripts/palmod2_cmor-rewrite_MPI-ESM1-2_mpiom_auto.h
+++ b/cmor/mpiesm/scripts/palmod2_cmor-rewrite_MPI-ESM1-2_mpiom_auto.h
@@ -97,8 +97,6 @@ for var in $cn; do
   )&; }>>$err.$var.Omon 2>&1
 done
 
-wait # test to reduce failure rate
-
 #-- CMOR-rewrite for mpiom (ESM: MPI-ESM1-2) Omon
 cn='deptho hfds mlotst msftbarot sos tauuo tauvo tos zos'
 find_file "$sdir" "*_mpiom_data_2d_mm_${period}*" ifile >> $err.find_file.Omon 2>&1
@@ -138,7 +136,7 @@ find_file "$sdir" "msftmz_Omon_${period}*" ifile >> $err.find_file.Omon 2>&1
 for var in $cn; do
   { (if_requested $member $ocemod Omon $var $chunk || continue
   mkdir -p $dr/$submodel/Omon_${var}
-  echo $cdo cmor,Omon,i=$it,mt=$mt,dr=$dr/$submodel/Omon_${var},vd=$vd,cn=$var ${cdochain-} $ifile
+  echo $cdo cmor,Omon,i=$it,mt=$mt,dr=$dr/$submodel/Omon_${var},vd=$vd,cn=$var $ifile
   $cdo cmor,Omon,i=$it,mt=$mt,dr=$dr/$submodel/Omon_${var},vd=$vd,cn=$var $ifile || echo ERROR
   )&; }>>$err.$var.Omon 2>&1
 done
diff --git a/cmor/mpiesm/scripts/palmod2_diagnostic_MPI-ESM1-2_echam6_auto.h b/cmor/mpiesm/scripts/palmod2_diagnostic_MPI-ESM1-2_echam6_auto.h
index a82d2bd..d7a3591 100644
--- a/cmor/mpiesm/scripts/palmod2_diagnostic_MPI-ESM1-2_echam6_auto.h
+++ b/cmor/mpiesm/scripts/palmod2_diagnostic_MPI-ESM1-2_echam6_auto.h
@@ -1,3 +1,12 @@
+#-- Diagnostic for echam6 (ESM: MPI-ESM1-2) variable emilnox / table AERmon
+# Editor Note: emi_NO_lghtng_accu
+{ (if_requested $member $atmmod AERmon emilnox $chunk && {
+  find_file -e            "$sdir" "*_echam6_lghtng_${period}*" ifile
+  $cdo -f nc -O \
+    expr,'emilnox=var3/gridarea(var3);' \
+    $ifile ${sdir}/out_diag/AERmon_emilnox_$period.nc || echo ERROR
+}; )&; }>$err.emilnox.AERmon 2>&1
+
 #-- Diagnostic for echam6 (ESM: MPI-ESM1-2) variable evspsbl / table Amon
 { (if_requested $member $atmmod Amon evspsbl $chunk && {
   find_file -e            "$sdir" "*_echam_${period}*" ifile
diff --git a/cmor/mpiesm/scripts/ssp119-future-methane_r1i1p1f1-CR.runpp b/cmor/mpiesm/scripts/ssp119-future-methane_r1i1p1f1-CR.runpp
index ee25088..a52b245 100755
--- a/cmor/mpiesm/scripts/ssp119-future-methane_r1i1p1f1-CR.runpp
+++ b/cmor/mpiesm/scripts/ssp119-future-methane_r1i1p1f1-CR.runpp
@@ -10,8 +10,8 @@
 #SBATCH --mem=100G
 #SBATCH --time=01:30:00
 #SBATCH --mail-type=none
-#SBATCH --account=bm0021
-#SBATCH --qos=esgf
+#SBATCH --account=bk1192
+##SBATCH --qos=esgf
 #SBATCH --exclusive
 #SBATCH --output=ssp119-future-methane_r1i1p1f1-CR.runpp_%j.log
 
@@ -44,14 +44,12 @@ alias ncatted=/sw/spack-levante/nco-5.0.6-3xkdth/bin/ncatted
 
 #Root directory of all scripts, outdata, logs etc
 EXP_ID=ssp119-future-methane_r1i1p1f1-CR
-EXP_DIR_TRUNK=/work/bm0021/PalMod2/cmor/transient-deglaciation-prescribed
-EXP_DIR_TRUNK=/work/bk1192/k204212/palmod_TK/ssp119-future-methane_r1i1p1f1-CR
+EXP_DIR_TRUNK=/work/kd1292/k204212/palmod_TK/ssp119-future-methane_r1i1p1f1-CR
+
+#TODO todo initial files for aggregation
 
 # RAW Data - path and sub-simulations
-RAW_EXP_DIR_TRUNK=/work/bk1192/from_Mistral/bk1192/WG2/WP2.3/future_scenarios_2021/SSP1-1.9
-# SSP1-1.9/echam6/pmt0550_20RN_SSP119_r2_echam6_echam_7038.grb
-#RAW_EXP_DIR_TRUNK=/work/bk1192/WG2/WP2.3/transient_deglaciation_2020/
-#RAW_EXP_DIR_TRUNK=/work/bk1192/WG2/WP2.3/future_scenarios_2021/SSP1-1.9
+RAW_EXP_DIR_TRUNK=/work/bk1192/WG2/WP2.3/future_scenarios_2021/SSP1-1.9
 # As usually the Experiment is composed of several sub-simulations, define them as array
 RAW_EXP_IDS=( pmt0550_20RN_SSP119_r2 )
 # Parent experiment that the first RAW_EXP_ID branched from
@@ -59,7 +57,7 @@ RAW_EXP_IDS=( pmt0550_20RN_SSP119_r2 )
 # !! spinup - the aggregation will fail if the spinup period
 # !!          is as long or longer than
 # !!          the length of the first sub simulation!
-spinup=0
+spinup=300
 RAW_EXP_ID_PARENT=( pmt0531_d )
 if [[ $spinup -ne 0 ]]; then
     RAW_EXP_ID_PARENT[0]=${RAW_EXP_IDS[0]}
@@ -82,8 +80,7 @@ SCRIPT_DIR=/work/bm0021/PalMod2/cmor/mpiesm/scripts
 ############################
 
 #Where to find cdo (incl. CMOR operator), eg.:
-#cdo="/home/k/k204210/cdo-git/bin/cdo -v"  # PalMod cdo cmor version
-cdo="/work/bm0021/cdo_incl_cmor/cdo-2022-05-11_cmor3.6.0_gcc/bin/cdo -v" # hopefully the correct version
+cdo="/work/bm0021/cdo_incl_cmor/cdo-2022-09-20_cmor3.6.0_gcc/bin/cdo -v" # latest version
 
 # Base directory for DataRequest related headers/scripts
 SCRIPT_ROOT=${SCRIPT_DIR}
@@ -129,13 +126,13 @@ errdir_diag=${errdir}_diag
 errdir_agg=${errdir}_agg
 
 #initial and final year of the experiment
-iniyeararr=($((5900+spinup))) # 1850-3049
+iniyeararr=($((5600+spinup))) # 1850-3049
 finyeararr=(7099)
-iniyear=$(( 1850 + spinup ))
-finyear=$(( 3049 - $spinup ))
+iniyear=1850
+finyear=3049
 #offset compared to startyear
 inioffsetarr=(-4050) # 1850-3049 
-#  -  5900-7099 - 1250 yrs - 1850-3049 - -4050
+#  -  5900-7099 - 1200 yrs - 1850-3049 - -4050
 
 # Command line options
 RUN_AGG=true
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1-CR.runpp b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1-CR.runpp
index 2d77b3b..13fa383 100755
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1-CR.runpp
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1-CR.runpp
@@ -44,10 +44,12 @@ alias ncatted=/sw/spack-levante/nco-5.0.6-3xkdth/bin/ncatted
 
 #Root directory of all scripts, outdata, logs etc
 EXP_ID=transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1-CR
-EXP_DIR_TRUNK=/work/bk1192/k204212/palmod_TK/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1-CR
+EXP_DIR_TRUNK=/work/kd1292/k204212/palmod_TK/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1-CR
+
+#TODO todo initial files for aggregation
 
 # RAW Data - path and sub-simulations
-RAW_EXP_DIR_TRUNK=/work/bk1192/from_Mistral/bk1192/WG2/WP2.3/transient_deglaciation_2020/
+RAW_EXP_DIR_TRUNK=/work/bk1192/WG2/WP2.3/transient_deglaciation_2020/
 # As usually the Experiment is composed of several sub-simulations, define them as array
 RAW_EXP_IDS=( pmt0531_a  pmt0531_b  pmt0531_c  pmt0531_d )
 # Parent experiment that the first RAW_EXP_ID branched from
@@ -78,8 +80,7 @@ SCRIPT_DIR=/work/bm0021/PalMod2/cmor/mpiesm/scripts
 ############################
 
 #Where to find cdo (incl. CMOR operator), eg.:
-#cdo="/home/k/k204210/cdo-git/bin/cdo -v"  # PalMod cdo cmor version
-cdo="/work/bm0021/cdo_incl_cmor/cdo-2022-05-11_cmor3.6.0_gcc/bin/cdo -v" # hopefully the correct version
+cdo="/work/bm0021/cdo_incl_cmor/cdo-2022-09-20_cmor3.6.0_gcc/bin/cdo -v" # latest version
 
 # Base directory for DataRequest related headers/scripts
 SCRIPT_ROOT=${SCRIPT_DIR}
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1-CR_cdocmorinfo b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1-CR_cdocmorinfo
index 959c005..73e52ea 100755
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1-CR_cdocmorinfo
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1-CR_cdocmorinfo
@@ -19,7 +19,7 @@ FORCING_INDEX=1
 #
 # todo: set VARIANT_INFO
 #
-# VARIANT_INFO="" # not important for Thomas because its just one realization, we can set it in relation to Marie's definition of model version, we can use it in redefining physics index P2/P3 etc for differet model versions for example here p4
+VARIANT_INFO="tbd" # we can set it in relation to Marie's definition of model version
 ACTIVITY_ID=PalMod2
 #MIP_ERA=PalMod2                   #ONLY CMIP6  
 PROJECT_ID=PalMod2
@@ -35,7 +35,7 @@ REQUIRED_TIME_UNITS="days since 1-1-1 00:00:00"
 #PARENT_MIP_ERA=none              #ONLY CMIP6
 #PARENT_ACTIVITY_ID=none
 #PARENT_EXPERIMENT=none
-#PARENT_EXPERIMENT_ID=none
+PARENT_EXPERIMENT_ID="no parent"
 #PARENT_SOURCE_ID=none
 #PARENT_TIME_UNITS="days since 1850-1-1 00:00:00"
 #PARENT_VARIANT_LABEL=none
@@ -49,8 +49,8 @@ SOURCE_ID=MPI-ESM1-2-CR
 #
 # todo: Update References
 #
-REFERENCES="Kapsch, M.-L., Mikolajewicz, U., Ziemen, F., & Schannwell, C. (2022). Ocean response in transient simulations of the last deglaciation dominated by underlying ice-sheet reconstruction and method of meltwater distribution. Geophysical Research Letters, 49, e2021GL096767. https://doi.org/10.1029/2021GL096767\nMPI-ESM: Mauritsen, T. et al. (2019), Developments in the MPI‐M Earth System Model version 1.2 (MPI‐ESM1.2) and Its Response to Increasing CO2, J. Adv. Model. Earth Syst.,11, 998-1038, doi:10.1029/2018MS001400,\nMueller, W.A. et al. (2018): A high‐resolution version of the Max Planck Institute Earth System Model MPI‐ESM1.2‐HR. J. Adv. Model. EarthSyst.,10,1383–1413, doi:10.1029/2017MS001217" # thomas needs to defne reference
-SOURCE="MPI-ESM1.2-CR (2017): \naerosol: none, prescribed Kinne (2010)\natmos: ECHAM6.3 (spectral T31; 96 x 48 longitude/latitude; 31 levels; top level 10 hPa)\natmosChem: none\nland: JSBACH3.20\nlandIce: none/prescribed\nocean: MPIOM1.63 (bipolar GR3.0, approximately 300km; 122 x 101 longitude/latitude; 40 levels; top grid cell 0-15 m)\nocnBgchem: none\nseaIce: unnamed (thermodynamic (Semtner zero-layer) dynamic (Hibler 79) sea ice model)\nsolidLand: none/prescribed" # thomas needs to define
+REFERENCES="Kleinen, T., Mikolajewicz, U. and Brovkin, V. (2020). Terrestrial methane emissions from the Last Glacial Maximum to the preindustrial period. Climate of the Past, 16(2):575–595. doi: 10.5194/cp-16-575-2020.\nKleinen, T., Gromov, S., Steil, B. and Brovkin, V. (2021). Atmospheric methane underestimated in future climate projections. Environmental Research Letters, 16(9):094006. doi: 10.1088/1748-9326/ac1814.\nKapsch, M.-L., Mikolajewicz, U., Ziemen, F., & Schannwell, C. (2022). Ocean response in transient simulations of the last deglaciation dominated by underlying ice-sheet reconstruction and method of meltwater distribution. Geophysical Research Letters, 49, e2021GL096767. https://doi.org/10.1029/2021GL096767\nMPI-ESM: Mauritsen, T. et al. (2019), Developments in the MPI‐M Earth System Model version 1.2 (MPI‐ESM1.2) and Its Response to Increasing CO2, J. Adv. Model. Earth Syst.,11, 998-1038, doi:10.1029/2018MS001400,\nMueller, W.A. et al. (2018): A high‐resolution version of the Max Planck Institute Earth System Model MPI‐ESM1.2‐HR. J. Adv. Model. EarthSyst.,10,1383–1413, doi:10.1029/2017MS001217"
+SOURCE="MPI-ESM1.2-CR (2017): \naerosol: none, prescribed Kinne (2010)\natmos: ECHAM6.3 (spectral T31; 96 x 48 longitude/latitude; 31 levels; top level 10 hPa)\natmosChem: none\nland: JSBACH3.20\nlandIce: none/prescribed\nocean: MPIOM1.63 (bipolar GR3.0, approximately 300km; 122 x 101 longitude/latitude; 40 levels; top grid cell 0-15 m)\nocnBgchem: none\nseaIce: unnamed (thermodynamic (Semtner zero-layer) dynamic (Hibler 79) sea ice model)\nsolidLand: none/prescribed" # todo: replace
 SOURCE_TYPE="AOGCM CHEM"
 CALENDAR=proleptic_gregorian
 #MAPPING_TABLE_DIR=cmip6_mapping_tables
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p1f1-CR.runpp b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p1f1-CR.runpp
index e052682..ffb9bd9 100755
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p1f1-CR.runpp
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p1f1-CR.runpp
@@ -78,9 +78,7 @@ SCRIPT_DIR=/work/bm0021/PalMod2/cmor/mpiesm/scripts
 ############################
 
 #Where to find cdo (incl. CMOR operator), eg.:
-#cdo="/home/k/k204210/cdo-git/bin/cdo -v"  # PalMod cdo cmor version
-#cdo="/work/bm0021/cdo_incl_cmor/cdo-2022-05-11_cmor3.6.0_gcc/bin/cdo -v" # hopefully the correct version
-cdo="/work/bm0021/cdo_incl_cmor/cdo-2022-09-20_cmor3.6.0_gcc/bin/cdo -v"
+cdo="/work/bm0021/cdo_incl_cmor/cdo-2022-09-20_cmor3.6.0_gcc/bin/cdo -v" # latest version
 
 # Base directory for DataRequest related headers/scripts
 SCRIPT_ROOT=${SCRIPT_DIR}
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p1f1-CR_cdocmorinfo b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p1f1-CR_cdocmorinfo
index f480c99..eadd02b 100644
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p1f1-CR_cdocmorinfo
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p1f1-CR_cdocmorinfo
@@ -33,7 +33,7 @@ REQUIRED_TIME_UNITS="days since 1-1-1 00:00:00"
 #PARENT_ACTIVITY_ID=none
 #PARENT_EXPERIMENT=none
 #cmip6-spinup-HR
-#PARENT_EXPERIMENT_ID=none
+PARENT_EXPERIMENT_ID="no parent"
 #PARENT_SOURCE_ID=none
 #PARENT_TIME_UNITS="days since 1850-1-1 00:00:00"
 #PARENT_VARIANT_LABEL=none
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p2f2-CR.runpp b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p2f2-CR.runpp
index 8ccc816..a7b2f57 100755
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p2f2-CR.runpp
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p2f2-CR.runpp
@@ -44,7 +44,7 @@ alias ncatted=/sw/spack-levante/nco-5.0.6-3xkdth/bin/ncatted
 
 #Root directory of all scripts, outdata, logs etc
 EXP_ID=transient-deglaciation-prescribed-glac1d_r1i1p2f2-CR
-EXP_DIR_TRUNK=/work/bk1192/k204212/palmod_thirdBatch/transient-deglaciation-prescribed-glac1d_r1i1p2f2-CR
+EXP_DIR_TRUNK=/work/kd1292/k204212/palmod_errataBatch/transient-deglaciation-prescribed-glac1d_r1i1p2f2-CR
 
 # RAW Data - path and sub-simulations
 RAW_EXP_DIR_TRUNK=/work/bk1192/from_Mistral/bk1192/WG1/WP1.1/MPIM_transient_deglaciation_prescribed/
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p2f2-CR_cdocmorinfo b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p2f2-CR_cdocmorinfo
index aae59e8..56e3791 100644
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p2f2-CR_cdocmorinfo
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p2f2-CR_cdocmorinfo
@@ -33,7 +33,7 @@ REQUIRED_TIME_UNITS="days since 1-1-1 00:00:00"
 #PARENT_ACTIVITY_ID=none
 #PARENT_EXPERIMENT=none
 #cmip6-spinup-HR
-#PARENT_EXPERIMENT_ID=none
+PARENT_EXPERIMENT_ID="no parent"
 #PARENT_SOURCE_ID=none
 #PARENT_TIME_UNITS="days since 1850-1-1 00:00:00"
 #PARENT_VARIANT_LABEL=none
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p3f2-CR.runpp b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p3f2-CR.runpp
index 8432878..ab08948 100755
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p3f2-CR.runpp
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p3f2-CR.runpp
@@ -44,7 +44,7 @@ alias ncatted=/sw/spack-levante/nco-5.0.6-3xkdth/bin/ncatted
 
 #Root directory of all scripts, outdata, logs etc
 EXP_ID=transient-deglaciation-prescribed-glac1d_r1i1p3f2-CR
-EXP_DIR_TRUNK=/work/bk1192/k204212/palmod_thirdBatch/transient-deglaciation-prescribed-glac1d_r1i1p3f2-CR
+EXP_DIR_TRUNK=/work/kd1292/k204212/palmod_errataBatch/transient-deglaciation-prescribed-glac1d_r1i1p3f2-CR
 
 # RAW Data - path and sub-simulations
 RAW_EXP_DIR_TRUNK=/work/bk1192/from_Mistral/bk1192/WG1/WP1.1/MPIM_transient_deglaciation_prescribed/
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p3f2-CR_cdocmorinfo b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p3f2-CR_cdocmorinfo
index 8b66329..400aa3e 100644
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p3f2-CR_cdocmorinfo
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d_r1i1p3f2-CR_cdocmorinfo
@@ -33,7 +33,7 @@ REQUIRED_TIME_UNITS="days since 1-1-1 00:00:00"
 #PARENT_ACTIVITY_ID=none
 #PARENT_EXPERIMENT=none
 #cmip6-spinup-HR
-#PARENT_EXPERIMENT_ID=none
+PARENT_EXPERIMENT_ID="no parent"
 #PARENT_SOURCE_ID=none
 #PARENT_TIME_UNITS="days since 1850-1-1 00:00:00"
 #PARENT_VARIANT_LABEL=none
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p1f1-CR.runpp b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p1f1-CR.runpp
index 7ca7b32..e937563 100755
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p1f1-CR.runpp
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p1f1-CR.runpp
@@ -44,7 +44,7 @@ alias ncatted=/sw/spack-levante/nco-5.0.6-3xkdth/bin/ncatted
 
 #Root directory of all scripts, outdata, logs etc
 EXP_ID=transient-deglaciation-prescribed-ice6g_r1i1p1f1-CR
-EXP_DIR_TRUNK=/work/bk1192/k204212/palmod_thirdBatch/transient-deglaciation-prescribed-ice6g_r1i1p1f1-CR
+EXP_DIR_TRUNK=/work/kd1292/k204212/palmod_errataBatch/transient-deglaciation-prescribed-ice6g_r1i1p1f1-CR
 
 # RAW Data - path and sub-simulations
 RAW_EXP_DIR_TRUNK=/work/bk1192/from_Mistral/bk1192/WG1/WP1.1/MPIM_transient_deglaciation_prescribed/
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p1f1-CR_cdocmorinfo b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p1f1-CR_cdocmorinfo
index acc4ee6..819123a 100644
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p1f1-CR_cdocmorinfo
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p1f1-CR_cdocmorinfo
@@ -33,7 +33,7 @@ REQUIRED_TIME_UNITS="days since 1-1-1 00:00:00"
 #PARENT_ACTIVITY_ID=none
 #PARENT_EXPERIMENT=none
 #cmip6-spinup-HR
-#PARENT_EXPERIMENT_ID=none
+PARENT_EXPERIMENT_ID="no parent"
 #PARENT_SOURCE_ID=none
 #PARENT_TIME_UNITS="days since 1850-1-1 00:00:00"
 #PARENT_VARIANT_LABEL=none
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p2f2-CR.runpp b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p2f2-CR.runpp
index 98da6b2..a6024d6 100755
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p2f2-CR.runpp
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p2f2-CR.runpp
@@ -44,7 +44,7 @@ alias ncatted=/sw/spack-levante/nco-5.0.6-3xkdth/bin/ncatted
 
 #Root directory of all scripts, outdata, logs etc
 EXP_ID=transient-deglaciation-prescribed-ice6g_r1i1p2f2-CR
-EXP_DIR_TRUNK=/work/bk1192/k204212/palmod_thirdBatch/transient-deglaciation-prescribed-ice6g_r1i1p2f2-CR
+EXP_DIR_TRUNK=/work/kd1292/k204212/palmod_errataBatch/transient-deglaciation-prescribed-ice6g_r1i1p2f2-CR
 
 # RAW Data - path and sub-simulations
 RAW_EXP_DIR_TRUNK=/work/bk1192/from_Mistral/bk1192/WG1/WP1.1/MPIM_transient_deglaciation_prescribed/
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p2f2-CR_cdocmorinfo b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p2f2-CR_cdocmorinfo
index 17fe635..68d1516 100644
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p2f2-CR_cdocmorinfo
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p2f2-CR_cdocmorinfo
@@ -33,7 +33,7 @@ REQUIRED_TIME_UNITS="days since 1-1-1 00:00:00"
 #PARENT_ACTIVITY_ID=none
 #PARENT_EXPERIMENT=none
 #cmip6-spinup-HR
-#PARENT_EXPERIMENT_ID=none
+PARENT_EXPERIMENT_ID="no parent"
 #PARENT_SOURCE_ID=none
 #PARENT_TIME_UNITS="days since 1850-1-1 00:00:00"
 #PARENT_VARIANT_LABEL=none
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p3f2-CR.runpp b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p3f2-CR.runpp
index fd5c954..b982c08 100755
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p3f2-CR.runpp
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p3f2-CR.runpp
@@ -44,7 +44,7 @@ alias ncatted=/sw/spack-levante/nco-5.0.6-3xkdth/bin/ncatted
 
 #Root directory of all scripts, outdata, logs etc
 EXP_ID=transient-deglaciation-prescribed-ice6g_r1i1p3f2-CR
-EXP_DIR_TRUNK=/work/bk1192/k204212/palmod_thirdBatch/transient-deglaciation-prescribed-ice6g_r1i1p3f2-CR
+EXP_DIR_TRUNK=/work/kd1292/k204212/palmod_errataBatch/transient-deglaciation-prescribed-ice6g_r1i1p3f2-CR
 
 # RAW Data - path and sub-simulations
 RAW_EXP_DIR_TRUNK=/work/bk1192/from_Mistral/bk1192/WG1/WP1.1/MPIM_transient_deglaciation_prescribed/
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p3f2-CR_cdocmorinfo b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p3f2-CR_cdocmorinfo
index 2389a00..4fb529b 100644
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p3f2-CR_cdocmorinfo
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-ice6g_r1i1p3f2-CR_cdocmorinfo
@@ -33,7 +33,7 @@ REQUIRED_TIME_UNITS="days since 1-1-1 00:00:00"
 #PARENT_ACTIVITY_ID=none
 #PARENT_EXPERIMENT=none
 #cmip6-spinup-HR
-#PARENT_EXPERIMENT_ID=none
+PARENT_EXPERIMENT_ID="no parent"
 #PARENT_SOURCE_ID=none
 #PARENT_TIME_UNITS="days since 1850-1-1 00:00:00"
 #PARENT_VARIANT_LABEL=none
-- 
GitLab