From 5452f190c83a3a31e842dbb0764a8d2d9ea23adc Mon Sep 17 00:00:00 2001
From: Martin Schupfner <k204212@levante1.lvt.dkrz.de>
Date: Tue, 7 Feb 2023 08:51:18 +0100
Subject: [PATCH] mpiesm TK: updated ncatted scripts, added scripts for
 transient_f2, finalized version_id

---
 cmor/mpiesm/scripts/ncatted_TK_ssp.sh         |  61 +-
 cmor/mpiesm/scripts/ncatted_TK_transient.sh   |  65 +-
 .../palmod2_aggregation_MPI-ESM1-2_mpiom.h    |   2 +-
 .../ssp119-future-methane_r1i1p1f1-CR.runpp   |   2 +-
 .../ssp126-future-methane_r1i1p1f1-CR.runpp   |   2 +-
 .../ssp245-future-methane_r1i1p1f1-CR.runpp   |   2 +-
 .../ssp370-future-methane_r1i1p1f1-CR.runpp   |   2 +-
 .../ssp585-future-methane_r1i1p1f1-CR.runpp   |   2 +-
 ...rescribed-glac1d-methane_r1i1p1f1-CR.runpp |   2 +-
 ...bed-glac1d-methane_r1i1p1f1-CR_cdocmorinfo |   1 +
 ...cribed-glac1d-methane_r1i1p1f2-CR.cmor_ctl |  76 +++
 ...bed-glac1d-methane_r1i1p1f2-CR.cmor_ctl.mk |  44 ++
 ...rescribed-glac1d-methane_r1i1p1f2-CR.runpp | 628 ++++++++++++++++++
 ...bed-glac1d-methane_r1i1p1f2-CR_cdocmorinfo | 115 ++++
 14 files changed, 950 insertions(+), 54 deletions(-)
 create mode 100755 cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR.cmor_ctl
 create mode 100755 cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR.cmor_ctl.mk
 create mode 100755 cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR.runpp
 create mode 100644 cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR_cdocmorinfo

diff --git a/cmor/mpiesm/scripts/ncatted_TK_ssp.sh b/cmor/mpiesm/scripts/ncatted_TK_ssp.sh
index 0b575e9..621e4eb 100644
--- a/cmor/mpiesm/scripts/ncatted_TK_ssp.sh
+++ b/cmor/mpiesm/scripts/ncatted_TK_ssp.sh
@@ -14,34 +14,45 @@ NOMINAL_RESOLUTION="500 km" # echam6, jsbach, mpiom, hamocc
 #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: unnamed (accelerated methane chemistry)\nland: JSBACH3.20, River Transport Model\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, prescribed\nseaIce: unnamed (thermodynamic (Semtner zero-layer) dynamic (Hibler 79) sea ice model)\nsolidLand: none, prescribed"
 CONVENTIONS="CF-1.7 PalMod-2.0"
-CREATION_DATE="2023-01-10T10:00:00Z"
-HISTORY="2023-01-10T10:00:00Z ; CMOR rewrote data to be consistent with PalMod2, CF-1.7 PalMod-2.0 and CF standards."
+CREATION_DATE="2023-02-02T10:00:00Z"
+HISTORY="2023-02-02T10:00:00Z ; CMOR rewrote data to be consistent with PalMod2, CF-1.7 PalMod-2.0 and CF standards."
 #PARENTEXPID="no parent"
 PARENTEXPID="transient-deglaciation-prescribed-glac1d-methane"
 declare -A TABLE_INFO
 # 00.00.02
-TABLE_INFO[Amon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Omon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Lmon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[dec]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[fx]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Ofx]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
+#dreqversion="00.00.02"
+#TABLE_INFO[Amon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
+#TABLE_INFO[Omon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
+#TABLE_INFO[Lmon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
+#TABLE_INFO[dec]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
+#TABLE_INFO[fx]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
+#TABLE_INFO[Ofx]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
 # 00.00.03
-TABLE_INFO[Amon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Omon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Lmon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[dec]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[fx]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Ofx]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Odec]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[dec]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[LImon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[SImon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Emon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[AERmon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-# 
+dreqversion="00.00.03"
+TABLE_INFO[AERmon]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[Amon]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[centennial]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[dec]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[Emon]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[EmonZ]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[fx]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[IcenAnt]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[IcenGre]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[IdecAnt]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[IdecGre]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[IyrAnt]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[IyrGre]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[LImon]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[Lmon]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[Odec]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[Ofx]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[Omon]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[Oyr]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[SImon]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+#
 #TABLE_INFO[]=
-VARIANT_INFO="PalMod MPI-ESM1-2-CR setup with full methane cycle. Model physics identical to MPI-ESM1-2-CR simulation transient-deglaciation-prescribed_r1i1p1f1."
+declare -A VARIANT_INFO
+VARIANT_INFO["1"]="PalMod MPI-ESM1-2-CR setup with full methane cycle. Model physics identical to MPI-ESM1-2-CR simulation transient-deglaciation-prescribed_r1i1p1f1."
 echo "------------------------"
 echo $TITLE
 echo $REFERENCES
@@ -69,12 +80,16 @@ 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}
+    forcing_index=${memberid:7:1}
+    realization_index=${memberid:1:1}
+    init_index=${memberid:3:1}
+    variantlabel=r${realization_index}i${init_index}p${physics_index}f${forcing_index}
     uuid="hdl:21.14105/$(uuidgen)"
 
     # Run ncatted
     #ncatted -O -h -a variant_info,global,m,c,"${VARIANTINFO}" -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 tracking_id,global,m,c,"$uuid" $ifile || echo "ERROR $ifile"
-    ncatted -O -h -a history,global,m,c,"$HISTORY" -a creation_date,global,m,c,"$CREATION_DATE" -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" $ifile || echo "ERROR $ifile"
+    ncatted -O -h -a history,global,m,c,"$HISTORY" -a creation_date,global,m,c,"$CREATION_DATE" -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" $ifile -a variant_info,global,m,c,"${VARIANT_INFO[$forcing_index]}" || echo "ERROR $ifile"
 
     # Adjust filename timestamp
     if [[ "$table" != *"fx"* ]]; then
diff --git a/cmor/mpiesm/scripts/ncatted_TK_transient.sh b/cmor/mpiesm/scripts/ncatted_TK_transient.sh
index f999862..098b915 100644
--- a/cmor/mpiesm/scripts/ncatted_TK_transient.sh
+++ b/cmor/mpiesm/scripts/ncatted_TK_transient.sh
@@ -8,40 +8,52 @@ module load nco
 
 # Attributes
 TITLE="MPI-ESM1-2 output prepared for PalMod2"
-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"
+REFERENCES="Kleinen, T., Gromov, S., Steil, B., and Brovkin, V. (2022). Atmospheric methane since the LGM was driven by wetland sources. Clim. Past Discuss. [preprint],  https://doi.org/10.5194/cp-2022-80.\nKleinen, 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: unnamed (accelerated methane chemistry)\nland: JSBACH3.20, River Transport Model\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, prescribed\nseaIce: unnamed (thermodynamic (Semtner zero-layer) dynamic (Hibler 79) sea ice model)\nsolidLand: none, prescribed"
 CONVENTIONS="CF-1.7 PalMod-2.0"
-CREATION_DATE="2023-01-10T10:00:00Z"
-HISTORY="2023-01-10T10:00:00Z ; CMOR rewrote data to be consistent with PalMod2, CF-1.7 PalMod-2.0 and CF standards."
+CREATION_DATE="2023-02-02T10:00:00Z"
+HISTORY="2023-02-02T10:00:00Z ; CMOR rewrote data to be consistent with PalMod2, CF-1.7 PalMod-2.0 and CF standards."
 PARENTEXPID="no parent"
 #PARENTEXPID="transient-deglaciation-prescribed-glac1d-methane"
 declare -A TABLE_INFO
 # 00.00.02
-TABLE_INFO[Amon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Omon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Lmon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[dec]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[fx]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Ofx]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
+#dreqversion="00.00.02"
+#TABLE_INFO[Amon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
+#TABLE_INFO[Omon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
+#TABLE_INFO[Lmon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
+#TABLE_INFO[dec]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
+#TABLE_INFO[fx]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
+#TABLE_INFO[Ofx]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
 # 00.00.03
-TABLE_INFO[Amon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Omon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Lmon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[dec]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[fx]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Ofx]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Odec]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[dec]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[LImon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[SImon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[Emon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-TABLE_INFO[AERmon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
-# 
+dreqversion="00.00.03"
+TABLE_INFO[AERmon]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[Amon]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[centennial]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[dec]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[Emon]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[EmonZ]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[fx]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[IcenAnt]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[IcenGre]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[IdecAnt]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[IdecGre]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[IyrAnt]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[IyrGre]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[LImon]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[Lmon]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[Odec]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[Ofx]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[Omon]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[Oyr]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+TABLE_INFO[SImon]="Creation Date:(1 February 2023) MD5:437d9b7f4524e7483e04d57b09f4aaaa"
+#
 #TABLE_INFO[]=
-VARIANT_INFO="PalMod MPI-ESM1-2-CR setup with full methane cycle. Model physics identical to MPI-ESM1-2-CR simulation transient-deglaciation-prescribed_r1i1p1f1."
+declare -A VARIANT_INFO
+VARIANT_INFO["1"]="PalMod MPI-ESM1-2-CR setup with full methane cycle. Model physics identical to MPI-ESM1-2-CR simulation transient-deglaciation-prescribed_r1i1p1f1."
+VARIANT_INFO["2"]="Palmod CR setup with full methane cycle. Model physics identical to MPI-ESM1-2-CR simulation transient-deglaciation-prescribed_r1i1p1f1. This simulation branched of transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1 at 7001-01-01 00:00 (corresponding to 18ka BP). Compared to the original simulation it includes a meltwater perturbation: Meltwater from Laurentide ice sheet stored from 15.2 ka BP to 12.8 ka BP, then released to ocean for 1200 years. This induces an AMOC collapse, leading to a Younger Dryas event, including recovery, as described in Kleinen et al. (2022)."
 echo "------------------------"
 echo $TITLE
 echo $REFERENCES
@@ -54,6 +66,7 @@ echo ${TABLE_INFO[@]}
 echo "-------------------------"
 
 exp_id=transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1-CR
+exp_id=transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR
 ifolder=/work/kd1292/k204212/palmod_TK/${exp_id}/archive/PalMod2/
 
 ifiles=($(find $ifolder -type f))
@@ -65,12 +78,16 @@ 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}
+    forcing_index=${memberid:7:1}
+    realization_index=${memberid:1:1}
+    init_index=${memberid:3:1}
+    variantlabel=r${realization_index}i${init_index}p${physics_index}f${forcing_index}
     uuid="hdl:21.14105/$(uuidgen)"
 
     # Run ncatted
     #ncatted -O -h -a variant_info,global,m,c,"${VARIANTINFO}" -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 tracking_id,global,m,c,"$uuid" $ifile || echo "ERROR $ifile"
-    ncatted -O -h -a history,global,m,c,"$HISTORY" -a creation_date,global,m,c,"$CREATION_DATE" -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" $ifile || echo "ERROR $ifile"
+    ncatted -O -h -a history,global,m,c,"$HISTORY" -a creation_date,global,m,c,"$CREATION_DATE" -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 forcing_index,global,m,l,$forcing_index -a variant_label,global,m,c,$variantlabel -a variant_info,global,m,c,"${VARIANT_INFO[$forcing_index]}" $ifile || echo "ERROR $ifile"
 
     # Adjust filename timestamp
     if [[ "$table" != *"fx"* ]]; then
diff --git a/cmor/mpiesm/scripts/palmod2_aggregation_MPI-ESM1-2_mpiom.h b/cmor/mpiesm/scripts/palmod2_aggregation_MPI-ESM1-2_mpiom.h
index 6f8e730..fd4d44d 100644
--- a/cmor/mpiesm/scripts/palmod2_aggregation_MPI-ESM1-2_mpiom.h
+++ b/cmor/mpiesm/scripts/palmod2_aggregation_MPI-ESM1-2_mpiom.h
@@ -4,7 +4,7 @@
 
 #--mpiom: fx and masks
 { ( { if_requested $member $ocemod mpiom fx $chunk || if_requested $member $ocemod mpiom gridfile $chunk ; } || continue
-    find_file "$rawsdir" "*_mpiom_fx_*" ifile
+    find_file "$rawsdir" "*_mpiom_fx_${ocemod_fxyear}*" ifile
     ln -sf $ifile $sdir/mpiom_fx.nc || echo ERROR fx file
     # In case these land-sea-masks change with time, this needs an update...
     $cdo selname,amsuo,amsue $ifile $sdir/grid_mpiom_fx.nc || echo ERROR grid file
diff --git a/cmor/mpiesm/scripts/ssp119-future-methane_r1i1p1f1-CR.runpp b/cmor/mpiesm/scripts/ssp119-future-methane_r1i1p1f1-CR.runpp
index ee5adc8..bcb801f 100755
--- a/cmor/mpiesm/scripts/ssp119-future-methane_r1i1p1f1-CR.runpp
+++ b/cmor/mpiesm/scripts/ssp119-future-methane_r1i1p1f1-CR.runpp
@@ -126,7 +126,7 @@ ca+=([jsbach]="${SCRIPT_ROOT}/cdocmorinfo_jsbach_CR")
 experiment=ssp119-future-methane
 member=r1i1p1f1
 mip=PalMod2
-vd=v20230105
+vd=v20230201
 #vd=v$(date '+%Y%m%d') #CMOR version directory name, should be a date in format YYYYMMDD
 
 #Where to store errors
diff --git a/cmor/mpiesm/scripts/ssp126-future-methane_r1i1p1f1-CR.runpp b/cmor/mpiesm/scripts/ssp126-future-methane_r1i1p1f1-CR.runpp
index 6f81fce..a0d9b37 100755
--- a/cmor/mpiesm/scripts/ssp126-future-methane_r1i1p1f1-CR.runpp
+++ b/cmor/mpiesm/scripts/ssp126-future-methane_r1i1p1f1-CR.runpp
@@ -126,7 +126,7 @@ ca+=([jsbach]="${SCRIPT_ROOT}/cdocmorinfo_jsbach_CR")
 experiment=ssp126-future-methane
 member=r1i1p1f1
 mip=PalMod2
-vd=v20230105
+vd=v20230201
 #vd=v$(date '+%Y%m%d') #CMOR version directory name, should be a date in format YYYYMMDD
 
 #Where to store errors
diff --git a/cmor/mpiesm/scripts/ssp245-future-methane_r1i1p1f1-CR.runpp b/cmor/mpiesm/scripts/ssp245-future-methane_r1i1p1f1-CR.runpp
index cb0c6e7..89ed2d1 100755
--- a/cmor/mpiesm/scripts/ssp245-future-methane_r1i1p1f1-CR.runpp
+++ b/cmor/mpiesm/scripts/ssp245-future-methane_r1i1p1f1-CR.runpp
@@ -126,7 +126,7 @@ ca+=([jsbach]="${SCRIPT_ROOT}/cdocmorinfo_jsbach_CR")
 experiment=ssp245-future-methane
 member=r1i1p1f1
 mip=PalMod2
-vd=v20230105
+vd=v20230201
 #vd=v$(date '+%Y%m%d') #CMOR version directory name, should be a date in format YYYYMMDD
 
 #Where to store errors
diff --git a/cmor/mpiesm/scripts/ssp370-future-methane_r1i1p1f1-CR.runpp b/cmor/mpiesm/scripts/ssp370-future-methane_r1i1p1f1-CR.runpp
index 767c9b4..c3f97e1 100755
--- a/cmor/mpiesm/scripts/ssp370-future-methane_r1i1p1f1-CR.runpp
+++ b/cmor/mpiesm/scripts/ssp370-future-methane_r1i1p1f1-CR.runpp
@@ -126,7 +126,7 @@ ca+=([jsbach]="${SCRIPT_ROOT}/cdocmorinfo_jsbach_CR")
 experiment=ssp370-future-methane
 member=r1i1p1f1
 mip=PalMod2
-vd=v20230105
+vd=v20230201
 #vd=v$(date '+%Y%m%d') #CMOR version directory name, should be a date in format YYYYMMDD
 
 #Where to store errors
diff --git a/cmor/mpiesm/scripts/ssp585-future-methane_r1i1p1f1-CR.runpp b/cmor/mpiesm/scripts/ssp585-future-methane_r1i1p1f1-CR.runpp
index 2477892..4f72411 100755
--- a/cmor/mpiesm/scripts/ssp585-future-methane_r1i1p1f1-CR.runpp
+++ b/cmor/mpiesm/scripts/ssp585-future-methane_r1i1p1f1-CR.runpp
@@ -126,7 +126,7 @@ ca+=([jsbach]="${SCRIPT_ROOT}/cdocmorinfo_jsbach_CR")
 experiment=ssp585-future-methane
 member=r1i1p1f1
 mip=PalMod2
-vd=v20230105
+vd=v20230201
 #vd=v$(date '+%Y%m%d') #CMOR version directory name, should be a date in format YYYYMMDD
 
 #Where to store errors
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 18425fc..064bb66 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
@@ -124,7 +124,7 @@ ca+=([jsbach]="${SCRIPT_ROOT}/cdocmorinfo_jsbach_CR")
 experiment=transient-deglaciation-prescribed-glac1d-methane
 member=r1i1p1f1
 mip=PalMod2
-vd=v20230105
+vd=v20230201
 #vd=v$(date '+%Y%m%d') #CMOR version directory name, should be a date in format YYYYMMDD
 
 #Where to store errors
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 92c96fa..4d851d4 100644
--- a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1-CR_cdocmorinfo
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1-CR_cdocmorinfo
@@ -44,6 +44,7 @@ SUB_EXPERIMENT=none
 SOURCE_ID=MPI-ESM1-2-CR-CH4
 #MODEL_ID=MPI-ESM1-2-CR-CH4
 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"
+#Kleinen, T., Gromov, S., Steil, B., and Brovkin, V. (2022). Atmospheric methane since the LGM was driven by wetland sources. Clim. Past Discuss. [preprint],  https://doi.org/10.5194/cp-2022-80.
 #\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: unnamed (accelerated methane chemistry)\nland: JSBACH3.20, River Transport Model\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, prescribed\nseaIce: unnamed (thermodynamic (Semtner zero-layer) dynamic (Hibler 79) sea ice model)\nsolidLand: none, prescribed"
 SOURCE_TYPE="AOGCM CHEM"
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR.cmor_ctl b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR.cmor_ctl
new file mode 100755
index 0000000..c42cb5e
--- /dev/null
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR.cmor_ctl
@@ -0,0 +1,76 @@
+#! /bin/sh -e
+#SBATCH --account=bk1192
+##SBATCH --qos=esgf
+#SBATCH --time=48:00:00
+#SBATCH --partition=shared
+#SBATCH --mail-type=FAIL
+#SBATCH --output=%x_%j.log
+
+
+# Number of sub-simulations
+n_subsim=1
+#initial and final year of the experiment
+spinup=0
+#initial and final year of the experiment
+iniyeararr=( 2000 ) # 24000-1 BP
+finyeararr=( 9499 )
+iniyearoffset=0 # offset by 2000 years so time axis is comparable to MK's transient-glaciation experiments
+iniyear=( 7001 )
+finyear=( 14500 )
+#offset compared to startyear
+inioffsetarr=( 5001 ) # 24000-1 BP
+# Time axis (24000-1 BP)
+##     exp time       total yrs   new exp time   offset    with iniyearoffset     with iniyearoffset and spinup
+#a -  24000-18001 BP - 6000 yrs -     1- 6000 -   - 2999       2001 -  8000          2001 -  7000
+#b -  18000-11001 BP - 7000 yrs -  6001-13000 -     4001       8001 - 15000          7001 - 14000
+#b_A- 18000-10501 BP - 7500 yrs -  7001-14500 - 2000+4001-1000
+#c -  11000- 4001 BP - 7000 yrs - 13001-20000 -    11001      15001 - 22000         14001 - 21000
+#d -   4000-    1 BP - 4000 yrs - 20001-24000 -    18001      22001 - 26000         21001 - 25000
+#
+# /work/bk1192/WG2/WP2.3/transient_deglaciation_2020 contains a transient deglaciation experiment,
+# from 24900 yrs BP to 0 BP (present = 1950CE). For technical reasons it is split into 4 parts:
+#
+# pmt0585_a   (24000-18001 BP = 3000-8999);
+# pmt0585_b   (18000-11001 BP = 2000-8999);
+# pmt0585_b_A (18000-10501 BP = 2000-9499);
+# pmt0585_c   (11000-4001 BP = 2000-8999);
+# pmt0585_d   (4000-1 BP = 2000-5999)
+#
+# Chunksize
+#  Note that there are prerequisites concerning the chunksize:
+#  - the defined decadal timeslizes may not overlap between two chunks!
+#  - decadal bounds have to be defined accordingly - "???01231" in this case 
+#  - usually this is the case by default due to decadal model output!
+chunksize=100
+
+# Create list
+for i in $(seq 0 $(( n_subsim - 1 )) )
+do
+  for yyyy in $(seq ${iniyeararr[$i]} ${finyeararr[$i]} )
+  do
+    paramarr+=( "$i $yyyy" )
+  done
+done
+
+rm -f cmor_ctl_list_methane_r1f2
+in=0
+for i in $(seq $((iniyear-iniyear)) $chunksize $((finyear-iniyear)))
+do
+  [[ $i -eq $((iniyear-iniyear)) ]] && continue
+  li=$(echo ${paramarr[$in]} | cut -d " " -f1)
+  ly=$(echo ${paramarr[$in]} | cut -d " " -f2)
+  ui=$(echo ${paramarr[$((i-1))]} | cut -d " " -f1)
+  uy=$(echo ${paramarr[$((i-1))]} | cut -d " " -f2)
+  in=$i
+  echo "$li $ui $ly $uy" >> cmor_ctl_list_methane_r1f2
+done
+[[ $i -ne $((finyear-iniyear)) ]] && {
+  li=$(echo ${paramarr[$in]} | cut -d " " -f1)
+  ly=$(echo ${paramarr[$in]} | cut -d " " -f2)
+  ui=$(echo ${paramarr[$((finyear-iniyear))]} | cut -d " " -f1)
+  uy=$(echo ${paramarr[$((finyear-iniyear))]} | cut -d " " -f2)
+  echo "$li $ui $ly $uy" >> cmor_ctl_list_methane_r1f2
+}
+
+make -k -j 19 -f  transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR.cmor_ctl.mk "$@"
+
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR.cmor_ctl.mk b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR.cmor_ctl.mk
new file mode 100755
index 0000000..ec73494
--- /dev/null
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR.cmor_ctl.mk
@@ -0,0 +1,44 @@
+EXP_ID = transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR
+
+ACCOUNT = bk1192
+PARTITION = prepost,compute,compute2
+
+SUFFIX =
+ARCHIVE_SUFFIX =
+
+TARGET_STEP=cmor
+NUMCHUNKS=$(shell cat cmor_ctl_list_methane_r1f2 | wc -l )
+
+AGGR_TIME = 00:10:00
+DIAGS_TIME = 00:30:00
+CMOR_TIME = 02:30:00
+
+CMOR_FLAGS =
+
+SBATCHFLAGS=-W
+
+MESSAGE = $$(date +%Y-%m-%dT%H:%M:%S): CMIP6 diagnostics and CMOR rewriting ($(SUFFIX:_%=%))
+
+.PHONY: all
+.PRECIOUS: targets/$(EXP_ID).aggr$(SUFFIX).% targets/$(EXP_ID).diags$(SUFFIX).% targets/$(EXP_ID).cmor$(SUFFIX).% 
+
+
+
+all:
+	@echo "$(MESSAGE) started"
+	mkdir -vp targets
+	$(MAKE) $(MFLAGS) -f $(MAKEFILE_LIST) $(addprefix targets/$(EXP_ID).$(TARGET_STEP)$(SUFFIX).,$(shell seq 1 $(NUMCHUNKS)))
+	@echo "$(MESSAGE) finished"
+
+targets/$(EXP_ID).aggr$(SUFFIX).%:
+	sbatch $(SBATCHFLAGS) --time=$(AGGR_TIME) --job-name=$(EXP_ID)_runpp_aggr$(SUFFIX) --output=%x_%j.log --comment=$* $(EXP_ID).runpp -s '$(SUFFIX)' -S '$(ARCHIVE_SUFFIX)' -A $(shell sed -n '$(*)'p < cmor_ctl_list_methane_r1f2)
+	@touch $@
+
+targets/$(EXP_ID).diags$(SUFFIX).%: targets/$(EXP_ID).aggr$(SUFFIX).%
+	sbatch $(SBATCHFLAGS) --time=$(DIAGS_TIME) --job-name=$(EXP_ID)_runpp_diag$(SUFFIX) --output=%x_%j.log --comment=$* $(EXP_ID).runpp -s '$(SUFFIX)' -S '$(ARCHIVE_SUFFIX)' -d $(shell sed -n '$(*)'p < cmor_ctl_list_methane_r1f2)
+	@touch $@
+
+targets/$(EXP_ID).cmor$(SUFFIX).%: targets/$(EXP_ID).diags$(SUFFIX).%
+	sbatch $(SBATCHFLAGS) --time=$(CMOR_TIME) --job-name=$(EXP_ID)_runpp_cmor$(SUFFIX) --output=%x_%j.log --comment=$* $(EXP_ID).runpp -s '$(SUFFIX)' -S '$(ARCHIVE_SUFFIX)' -c $(CMOR_FLAGS) $(shell sed -n '$(*)'p < cmor_ctl_list_methane_r1f2)
+	@touch $@
+
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR.runpp b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR.runpp
new file mode 100755
index 0000000..d1251cf
--- /dev/null
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR.runpp
@@ -0,0 +1,628 @@
+#!/bin/ksh
+#
+# PalMod .runpp
+#
+# Wrapper Script Agg+Diag+CMOR MPI-ESM1-2 by Martin Schupfner, DKRZ
+#
+### Batch Queuing System is SLURM
+#SBATCH --partition=compute
+#SBATCH --nodes=1
+#SBATCH --mem=100G
+#SBATCH --time=01:30:00
+#SBATCH --mail-type=none
+#SBATCH --account=bk1192
+##SBATCH --qos=esgf
+#SBATCH --exclusive
+#SBATCH --output=transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR.runpp_%j.log
+
+DEBUG_LEVEL=${DEBUG_LEVEL:-0}
+
+# Support log style output
+export LANG=C
+print () { command print "$(date +'%F %T'):" "$@"; }
+print_re='^[0-9]+-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}'
+
+warn () { print 'Hey:' "$@" >&2; }
+die () { print 'Oops:' "$@" >&2; return 1; }
+
+# Bail out on error
+trap 'print Error at line $LINENO >&2' ERR
+set -eu
+
+# Disable core file creation
+ulimit -c 0
+
+# Print command info
+[[ $DEBUG_LEVEL -ge 2 ]] && set -x
+
+#module load nco || { echo "Oops: Could not load NCO!" && exit 1 ; }
+alias ncatted=/sw/spack-levante/nco-5.0.6-3xkdth/bin/ncatted
+
+#########################################
+# Define specifics about the simulation
+#########################################
+
+#Root directory of all scripts, outdata, logs etc
+EXP_ID=transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR
+EXP_DIR_TRUNK=/work/kd1292/k204212/palmod_TK/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR
+#EXP_DIR_TRUNK=/work/bk1192/k204212/palmod_TK/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR
+
+#initial files for aggregation
+INPUT_DIR_TRUNK=/work/bk1192/WG2/WP2.3/transient_deglaciation_2022_perturbed/
+
+# RAW Data - path and sub-simulations
+RAW_EXP_DIR_TRUNK=/work/bk1192/WG2/WP2.3/transient_deglaciation_2022_perturbed/
+# As usually the Experiment is composed of several sub-simulations, define them as array
+RAW_EXP_IDS=( pmt0585_b_A )
+# Parent experiment that the first RAW_EXP_ID branched from
+#  (used for input data of the parent that is required for aggregation)
+# !! spinup - the aggregation will fail if the spinup period
+# !!          is as long or longer than
+# !!          the length of the first sub simulation!
+spinup=0
+RAW_EXP_ID_PARENT=( pmt0585_a )
+#if [[ $spinup -ne 0 ]]; then   # INPUT file included in this experiment's directory
+    RAW_EXP_ID_PARENT[0]=${RAW_EXP_IDS[0]}
+#fi
+
+echo ${RAW_EXP_IDS[@]}
+echo ${RAW_EXP_ID_PARENT[@]}
+
+#Work dir
+WORK_DIR_TRUNK=$EXP_DIR_TRUNK/work
+
+#Where to find the scripts (runpp etc.)
+SCRIPT_DIR=${EXP_DIR_TRUNK}/scripts
+SCRIPT_DIR=/work/bm0021/PalMod2/cmor/mpiesm/scripts
+
+
+
+############################
+#Define necessary variables
+############################
+
+#Where to find cdo (incl. CMOR operator), eg.:
+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}
+
+#Where to find the functions
+fpath=/work/bm0021/PalMod2/cmor/functions
+
+#Where to find the configuration
+cpath=${SCRIPT_ROOT}/conf
+
+#Models
+atmmod=echam6
+ocemod=mpiom
+srfmod=jsbach
+esmod=MPI-ESM1-2
+
+#Chunks
+chunks+=([echam6]=" 0 1 2 3 4 5 6 7 8 9 ")
+chunks+=([jsbach]=" 0 1 2 3 4 5 6 7 8 9 ")
+chunks+=([mpiom]=" 0 ")
+chunks+=([jsbachdec]=" 0 ")
+atmmod_dec_chunk="???0123124"
+srfmod_dec_chunk="???0123124"
+srfmod_input_dec_chunk="???1123124"
+ocemod_dec_chunk="???1123124"
+icemod_dec_chunk="???1123124"
+ocemod_fxyear=2000
+
+#InfoTable(s)
+# Define here the "cdocmorinfo"-File or "eum"-Files
+# Multiple files possible with "," as delimiter, eg:
+#  it=expinfo.txt,userinfo.txt,modelinfo.txt
+it_temp="${SCRIPT_ROOT}/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR_cdocmorinfo"
+ca+=([mpiom]="${SCRIPT_ROOT}/cdocmorinfo_mpiom_CR")
+ca+=([echam6]="${SCRIPT_ROOT}/cdocmorinfo_echam6_CR")
+ca+=([jsbach]="${SCRIPT_ROOT}/cdocmorinfo_jsbach_CR")
+
+#Experiment etc
+experiment=transient-deglaciation-prescribed-glac1d-methane
+member=r1i1p1f2
+mip=PalMod2
+vd=v20230201
+#vd=v$(date '+%Y%m%d') #CMOR version directory name, should be a date in format YYYYMMDD
+
+#Where to store errors
+errdir=${EXP_DIR_TRUNK}/logs/errors
+errdir_cmor=${errdir}_cmor
+errdir_diag=${errdir}_diag
+errdir_agg=${errdir}_agg
+
+#initial and final year of the experiment
+iniyeararr=(2000) # 24000-1 BP
+finyeararr=(9499)
+iniyearoffset=0 # offset by 2000 years so time axis is comparable to MK's transient-glaciation experiments
+iniyear=7001
+finyear=25000
+#offset compared to startyear
+inioffsetarr=( 5001 ) # 24000-1 BP
+# Time axis (24000-1 BP)
+##     exp time       total yrs   new exp time   offset    with iniyearoffset     with iniyearoffset and spinup
+#a -  24000-18001 BP - 6000 yrs -     1- 6000 -   - 2999       2001 -  8000          2001 -  7000
+#b -  18000-11001 BP - 7000 yrs -  6001-13000 -     4001       8001 - 15000          7001 - 14000
+#b_A- 18000-10501 BP - 7500 yrs -  7001-14500 - 2000+4001-1000=5001
+#c -  11000- 4001 BP - 7000 yrs - 13001-20000 -    11001      15001 - 22000         14001 - 21000
+#d -   4000-    1 BP - 4000 yrs - 20001-24000 -    18001      22001 - 26000         21001 - 25000
+
+# /work/bk1192/WG2/WP2.3/transient_deglaciation_2020 contains a transient deglaciation experiment,
+# from 24900 yrs BP to 0 BP (present = 1950CE). For technical reasons it is split into 4 parts:
+#
+# pmt0585_a   (24000-18001 BP = 3000-8999);
+# pmt0585_b   (18000-11001 BP = 2000-8999);
+# pmt0585_b_A (18000-10501 BP = 2000-9499);
+# pmt0585_c   (11000-4001 BP = 2000-8999);
+# pmt0585_d   (4000-1 BP = 2000-5999)
+#
+
+# Command line options
+RUN_AGG=true
+RUN_DIAGS=true
+RUN_CMOR=true
+SUFFIX=
+CLIMSUFFIX=
+ARCHIVE_SUFFIX=
+USE_CHUNKS=false
+REMOVE_CHUNKS=false
+PROCESS_CLIM=false
+while [[ "$1" == -* ]]
+do
+    OPT=
+    ARG=
+    case "$1" in
+        -d|--diags|--diags-only) RUN_CMOR=false; RUN_AGG=false;;
+        -c|--cmor|--cmor-only) RUN_DIAGS=false; RUN_AGG=false;;
+        -A|--agg|--agg-only) RUN_DIAGS=false; RUN_CMOR=false;;
+        -C|--clim) PROCESS_CLIM=true;;
+        -s|--suffix) OPT=-s; ARG=SUFFIX;;
+        -S|--archive-suffix) OPT=-S; ARG=ARCHIVE_SUFFIX;;
+        -f|--force) REMOVE_CHUNKS=true;;
+        -a|--append) USE_CHUNKS=true;;
+        --) shift; break;;
+        -*) die "invalid option '$1'";;
+    esac
+    if [[ -n "$OPT" ]]
+    then
+        shift
+        [[ $# -lt 1 ]] && die "missing argument for option '$OPT'"
+        eval "$ARG='$1'"
+    fi
+    shift
+done
+
+echo "-----------------"
+echo $0 $1 $2 $3 $4
+echo "-----------------"
+
+#Write Output to:
+dr_trunk=${EXP_DIR_TRUNK}/archive$ARCHIVE_SUFFIX
+
+
+
+###############################################################################
+# No user input beyond this line necessary (usually)
+###############################################################################
+
+# Store parameters
+par1=$1
+par2=$2
+par3=$3
+par4=$4
+n_arr=${#inioffsetarr[@]}
+
+#time interval of the experiment to standardize
+if [[ ${#iniyeararr[@]} != ${#inioffsetarr[@]} ]] || [[ ${#iniyeararr[@]} != ${#finyeararr[@]} ]] || [[ ${#iniyeararr[@]} != ${#RAW_EXP_IDS[@]} ]]; then
+  die 'Each sub-simulation needs a specified iniyear, finyear and inioffset!'
+else
+  for y in $(seq 0 $(( n_arr - 1 )) ); do
+    SDIR+=( ${EXP_DIR_TRUNK}/${RAW_EXP_IDS[$y]} )
+    RAWSDIR+=( ${RAW_EXP_DIR_TRUNK}/${RAW_EXP_IDS[$y]} )
+    WORK_DIR+=( ${WORK_DIR_TRUNK}/${RAW_EXP_IDS[$y]} )
+  done
+  [[ -z "$2" ]] && [[ "$PROCESS_CLIM" == "false" ]] && die 'invalid number of parameters; need index of start and end simulations, start year (of first index) and end year (of second index) as YYYY'
+  [[ -z "$3" ]] && [[ "$PROCESS_CLIM" == "false" ]] && die 'invalid number of parameters; need index of start and end simulations, start year (of first index) and end year (of second index) as YYYY'
+  [[ -z "$4" ]] && [[ "$PROCESS_CLIM" == "false" ]] && die 'invalid number of parameters; need index of start and end simulations, start year (of first index) and end year (of second index) as YYYY'
+  for y in $(seq 0 $(( n_arr - 1 )) ); do
+    if [[ $y -lt $par1 ]] || [[ $y -gt $par2 ]]; then
+      lrel=-1
+      urel=-1
+      labs=-1
+      uabs=-1
+    elif [[ $y -eq $1 ]] && [[ $1 -eq $2 ]]; then
+      lrel=$3
+      urel=$4
+      labs=$(( $3 + ${inioffsetarr[$y]} - $spinup ))
+      uabs=$(( $4 + ${inioffsetarr[$y]} - $spinup ))
+    elif [[ $y -eq $1 ]]; then
+      lrel=$3
+      urel=${finyeararr[$y]}
+      labs=$(( $3 + ${inioffsetarr[$y]} - $spinup ))
+      uabs=$(( ${finyeararr[$y]} + ${inioffsetarr[$y]} - $spinup ))
+    elif [[ $y -eq $2 ]]; then
+      lrel=${iniyeararr[$y]}
+      urel=$4
+      labs=$(( ${iniyeararr[$y]} + ${inioffsetarr[$y]} - $spinup ))
+      uabs=$(( $4 + ${inioffsetarr[$y]} - $spinup ))
+    else
+      lrel=${iniyeararr[$y]}
+      urel=${finyeararr[$y]}
+      labs=$(( ${iniyeararr[$y]} + ${inioffsetarr[$y]} - $spinup ))
+      uabs=$(( ${finyeararr[$y]} + ${inioffsetarr[$y]} - $spinup ))
+    fi
+    [[ $urel -lt $lrel ]] && die 'iniyear, finyear arrays not properly set up!'
+    [[ $uabs -lt $labs ]] && die 'iniyear, finyear arrays not properly set up!'
+    SUB_SIM_REL_L+=( $lrel )
+    SUB_SIM_REL_U+=( $urel )
+    SUB_SIM_ABS_L+=( $labs )
+    SUB_SIM_ABS_U+=( $uabs )
+    [[ $lrel -eq -1 ]] && continue
+    [[ "$PROCESS_CLIM" == "false" ]] && { [[ ${SUB_SIM_REL_L[$y]} -lt ${iniyeararr[$y]} ]] || [[ ${SUB_SIM_REL_L[$y]} -gt ${finyeararr[$y]} ]] ; } && die 'erroneous input - input does not make sense along with the configured iniyear, finyear arrays'
+    [[ "$PROCESS_CLIM" == "false" ]] && { [[ ${SUB_SIM_REL_U[$y]} -lt ${iniyeararr[$y]} ]] || [[ ${SUB_SIM_REL_U[$y]} -gt ${finyeararr[$y]} ]] ; } && die 'erroneous input - input does not make sense along with the configured iniyear, finyear arrays'
+  done
+  echo ${SUB_SIM_REL_L[@]}
+  echo ${SUB_SIM_REL_U[@]}
+  echo ${SUB_SIM_ABS_L[@]}
+  echo ${SUB_SIM_ABS_U[@]}
+  [[ $1 -ge ${#iniyeararr[@]} ]] && die 'erroneous input - input does not make sense along with the configured iniyear, finyear arrays'
+  [[ $2 -ge ${#iniyeararr[@]} ]] && die 'erroneous input - input does not make sense along with the configured iniyear, finyear arrays'
+  [[ $1 -gt $2 ]] && die 'erroneous input - input does not make sense along with the configured iniyear, finyear arrays'
+  cmorstart=$(( $3 + ${inioffsetarr[$1]} - $spinup ))
+  cmorend=$(( $4 + ${inioffsetarr[$2]} -spinup ))
+fi
+MESSAGE='PalMod2'
+$RUN_AGG && MESSAGE+=' - Aggregation - '
+$RUN_DIAGS && MESSAGE+=' - Diagnostics - '
+$RUN_CMOR && MESSAGE+=" - CMOR rewriting - "
+$PROCESS_CLIM && MESSAGE+=' for only climatological variables'
+print "$(date +%Y-%m-%dT%H:%M:%S): $MESSAGE started for ${cmorstart}-${cmorend} $SUFFIX"
+print "  ... translating to ${RAW_EXP_IDS[$1]}@$3 to ${RAW_EXP_IDS[$2]}@$4"
+
+#exit 0
+
+
+
+##############################
+# Load the required functions
+#   function_Read_request_config: read data request / user configuration and initialize the if_requested check
+#   function_if_requested: checks if the currently processed variable is requested for the current timestep
+#   function_find_file: searches for inputfiles
+##############################
+. $fpath/function_Read_request_config_palmod
+. $fpath/function_if_requested
+. $fpath/function_find_file
+
+#Load predefined timeslices (depends on $iniyear/$finyear)
+. $cpath/TimeSlices.h
+
+##Additionally define custom TimeSlices
+## Example on how to define TimeSlices
+## format: YYYYMMDDHH-YYYYMMDDHH
+##
+#TimeSlices+=([custom1]=(1850010100-1850010100))
+#TimeSlices+=([custom2]=(1850010100-1850123124))
+##TimeSlice dependend on variable
+#TimeSlices+=([custom3]=(${iniyear}010100-${iniyear}123124))
+##TimeSlice dependend on arithmetics using variable
+#TimeSlices+=([custom4]=($((iniyear+121))010100-$((iniyear+150))123124))
+
+##Define SettingsContainer
+## The following Option 3hrtest will activate the listed 3hr variables and deactivate any other variable for the given member (= realisation)
+## The UserSettings for the given experiment have to contain the line:
+## Option: 3hrtest = True
+## or the setting will not be active!
+#SettingsContainer+=([3hrtest]=([3hr]=(clt hfls hfss pr prc ps rlds rlus rsds rsus tas tos uas vas)))
+#SettingsContainer[3hrtest]+=([${member}]=(${member}:False))
+
+#Initialize DataRequest/User Configuration for the if_requested function
+# This will read all SettingsContainers, TimeSlices and the configuration file
+rrc_option=-s
+[[ $DEBUG_LEVEL -ge 1 ]] && rrc_option=
+[[ $DEBUG_LEVEL -ge 2 ]] && rrc_option=-v
+
+
+
+#################################
+# Run agg, diag and cmor-rewrite
+#################################
+
+function run_agg
+{
+    # Loop over file output periods and load diagnostic script fragment
+    if $RUN_AGG; then
+
+    for y in $(seq ${par1} ${par2}); do
+
+    # perform time shift for selected variables
+    cdochain="-shifttime,$((inioffsetarr[$y] - spinup))year -shifttime,-3day"
+
+    for period in $(seq ${SUB_SIM_REL_L[$y]} ${SUB_SIM_REL_U[$y]}); do
+        # Define the chunk that is tested by if_requested (YYYYMMDDHH-YYYYMMDDHH)
+        chunk=$( echo $(( ${period} + ${inioffsetarr[$y]} - $spinup )) | awk '{ printf "%06d", $0 }')010100-$( echo $(( ${period} + ${inioffsetarr[$y]} - $spinup )) | awk '{ printf "%06d", $0 }')123124
+        l_chunk=$(echo $chunk | cut -d "-" -f1)
+        r_chunk=$(echo $chunk | cut -d "-" -f2)
+
+        l_chunk_year=${l_chunk%??????}
+        r_chunk_year=${r_chunk%??????}
+
+        inv_chunk_year=$(( 1 + ${finyear} - ${l_chunk_year##+(0)} ))
+        print "Aggregation $chunk ($period): Reading forcing/input of year $inv_chunk_year"
+
+        # Clean up stdout/stderr from previous run of this script
+        errtemp_agg="${errdir_agg}${SUFFIX}${CLIMSUFFIX}/${RAW_EXP_IDS[$y]}/${RAW_EXP_IDS[$y]}_${period}"
+        mkdir -p ${errtemp_agg}
+        err="${errtemp_agg}/err${period}"
+        rm -f ${err}*
+
+        # Read input file
+        if [[ "${iniyeararr[$y]}" == "$period" ]]
+        then
+            echo "Reading from parent ${RAW_EXP_ID_PARENT[$y]} jsbach_T31GR30_11tiles_5layers_natural-veg_${inv_chunk_year}k.nc"
+            input_file_jsbach=$INPUT_DIR_TRUNK/${RAW_EXP_ID_PARENT[$y]}/topo/jsbach_T31GR30_11tiles_5layers_natural-veg_${inv_chunk_year}k.nc
+        else
+            echo "Reading from ${RAW_EXP_IDS[$y]} jsbach_T31GR30_11tiles_5layers_natural-veg_${inv_chunk_year}k.nc"
+            input_file_jsbach=$INPUT_DIR_TRUNK/${RAW_EXP_IDS[$y]}/topo/jsbach_T31GR30_11tiles_5layers_natural-veg_${inv_chunk_year}k.nc
+        fi
+
+        # Perform aggregation for each submodel
+        for submodel in $atmmod $ocemod $srfmod; do # $bgcmod; do
+
+            # Chunking
+            [[ "${chunks[$submodel]}" == *" ${period: -1} "* ]] && {
+
+            # Show progress
+            print "$(date +%Y-%m-%dT%H:%M:%S): Aggregation started for ${RAW_EXP_IDS[$y]} $submodel $chunk ($period) ..."
+            sh -c 'scontrol update JobId=$SLURM_JOB_ID Comment="$*"' scomment aggr/${RAW_EXP_IDS[$y]}/$submodel/$period
+
+            # Location of input/output
+            sdir=${SDIR[$y]}/outdata/$submodel
+            rawsdir=${RAWSDIR[$y]}/outdata/$submodel
+            echo "... writing output to $sdir/out_aggr"
+            echo "... writing log to $errtemp_agg"
+
+            # Create output dirs
+            mkdir -p ${sdir}/tmp_aggr
+            mkdir -p ${sdir}/out_aggr
+
+            # Create softlinks to raw model output
+            echo "... creating links from '$rawsdir' for $period, $submodel"
+            ln -sf $rawsdir/*_${period}* $sdir/ 2>/dev/null 1>&2 || { echo "ERROR creating links for $period ${RAW_EXP_IDS[$y]} $submodel" && exit 1 ; }
+
+            # Load and run the aggr ScriptFragment
+            . ${SCRIPT_DIR}/palmod2_aggregation_${esmod}_${submodel}.h
+            wait
+            print "$(date +%Y-%m-%dT%H:%M:%S): Aggregation ended for ${RAW_EXP_IDS[$y]} $submodel $chunk ($period) ..."
+            }
+
+        done # submodel
+    done # period
+    done # EXP ID Index y
+    fi # if RUN_AGG
+}
+
+function run_diag
+{
+    # Loop over file output periods and load diagnostic script fragment
+    if $RUN_DIAGS; then
+    for y in $(seq ${par1} ${par2}); do
+
+    for period in $(seq ${SUB_SIM_REL_L[$y]} ${SUB_SIM_REL_U[$y]}); do
+        # Define the chunk that is tested by if_requested (YYYYMMDDHH-YYYYMMDDHH)
+        chunk=$( echo $(( ${period} + ${inioffsetarr[$y]} - $spinup )) | awk '{ printf "%06d", $0 }')010100-$( echo $(( ${period} + ${inioffsetarr[$y]} - $spinup )) | awk '{ printf "%06d", $0 }')123124
+
+        # Clean up stdout/stderr from previous run of this script
+        errtemp_diag="${errdir_diag}${SUFFIX}${CLIMSUFFIX}/${RAW_EXP_IDS[$y]}/${RAW_EXP_IDS[$y]}_${period}"
+        mkdir -p ${errtemp_diag}
+        err="${errtemp_diag}/err${period}"
+        rm -f ${err}*
+
+        # Perform diagnostic for each submodel
+        for submodel in $atmmod $ocemod $srfmod; do # $bgcmod; do
+
+            # Chunking
+            [[ "${chunks[$submodel]}" == *" ${period: -1} "* ]] && {
+
+            # Show progress
+            print "$(date +%Y-%m-%dT%H:%M:%S): Diagnostic started for ${RAW_EXP_IDS[$y]} $submodel $chunk ($period) ..."
+            sh -c 'scontrol update JobId=$SLURM_JOB_ID Comment="$*"' scomment diag/${RAW_EXP_IDS[$y]}/$submodel/$period
+
+            #Location of input/output
+            sdir=${SDIR[$y]}/outdata/$submodel
+            rawsdir=${RAWSDIR[$y]}/outdata/$submodel
+            echo "... writing output to $sdir/out_diag"
+            echo "... writing log to $errtemp_diag"
+
+            # Diagnostic Output
+            mkdir -p ${sdir}/tmp_diag
+            mkdir -p ${sdir}/out_diag
+
+            # Load and run the diag ScriptFragment
+            . ${SCRIPT_DIR}/palmod2_diagnostic_${esmod}_${submodel}_auto.h
+            wait
+            print "$(date +%Y-%m-%dT%H:%M:%S): Diagnostic ended for ${RAW_EXP_IDS[$y]} $submodel $chunk ($period) ..."
+            }
+
+        done # submodel
+    done # period
+    done # EXP ID Index y
+    fi # if RUN_DIAG
+}
+
+function run_cmor
+{
+    # Loop over file output periods and load CMOR-Rewrite script fragment
+    if $RUN_CMOR; then
+
+    for y in $(seq ${par1} ${par2}); do
+
+    # Use working directory to hold .CHUNK and other tmp files
+    current_dir=${WORK_DIR[$y]}/cmor${SUFFIX}_${cmorstart}-${cmorend}${CLIMSUFFIX}
+    if [[ -e $current_dir ]] && [[ "$PROCESS_CLIM" == "false" ]]
+    then
+        if $USE_CHUNKS
+        then
+            warn "appending to existing chunk"
+        elif $REMOVE_CHUNKS
+        then
+            warn "moving chunk info to backup"
+            mkdir -p ${WORK_DIR[$y]}/backup
+            mv -v --backup=numbered $current_dir ${WORK_DIR[$y]}/backup
+        else
+            die "please check if cmor is running or has already been run for this chunk. Use --force to re-run"
+        fi
+    else
+        if $USE_CHUNKS
+        then
+            die "cannot find chunk info for appending"
+        fi
+    fi
+    mkdir -p $current_dir
+    previous_dir=$PWD
+    # Link gridinfo files
+    ln -sf $SCRIPT_DIR/gridinfo*nc $current_dir/
+    cd $current_dir
+
+    # perform time shift
+    cdochain="-shifttime,$((inioffsetarr[$y] - spinup))year -shifttime,-3day"
+
+    # Define DRS root dir
+    dr=$dr_trunk/cmor${SUFFIX}_${cmorstart}-${cmorend}${CLIMSUFFIX}
+    mkdir -p $dr
+
+    for period in $(seq ${SUB_SIM_REL_L[$y]} ${SUB_SIM_REL_U[$y]}); do
+        # Define the chunk that is tested by if_requested (YYYYMMDDHH-YYYYMMDDHH)
+        chunk=$( echo $(( ${period} + ${inioffsetarr[$y]} - $spinup )) | awk '{ printf "%06d", $0 }')010100-$( echo $(( ${period} + ${inioffsetarr[$y]} - $spinup )) | awk '{ printf "%06d", $0 }')123124
+        # Define decadal interval
+        di="$(( ${period} + ${inioffsetarr[$y]} - 9 - $spinup )),$(( ${period} + ${inioffsetarr[$y]} - $spinup ))"
+        dioce="$(( ${period} + ${inioffsetarr[$y]} - $spinup )),$(( ${period} + ${inioffsetarr[$y]} - $spinup + 9 ))"
+
+        # Clean up stdout/stderr from previous run of this script
+        errtemp_cmor="${errdir_cmor}${SUFFIX}${CLIMSUFFIX}/${RAW_EXP_IDS[$y]}/${RAW_EXP_IDS[$y]}_${period}"
+        mkdir -p ${errtemp_cmor}
+        err="${errtemp_cmor}/err${period}"
+        rm -f ${err}*
+
+        # Perform CMOR rewrite for each submodel
+        for submodel in $atmmod $ocemod $srfmod; do # $bgcmod; do
+
+            # Chunking
+            [[ "${chunks[$submodel]}" == *" ${period: -1} "* ]] && {
+
+            # Show progress
+            print "$(date +%Y-%m-%dT%H:%M:%S): CMORisation started for ${RAW_EXP_IDS[$y]} $submodel $chunk ($period) ..."
+            sh -c 'scontrol update JobId=$SLURM_JOB_ID Comment="$*"' scomment cmor/${RAW_EXP_IDS[$y]}/$submodel/$period
+
+            #Location of input/output
+            sdir=${SDIR[$y]}/outdata/$submodel
+            rawsdir=${RAWSDIR[$y]}/outdata/$submodel
+            echo "... writing output to $dr/$submodel"
+            echo "... writing log to $errtemp_cmor"
+
+            # Output
+            mkdir -p $dr/$submodel
+
+            #Location of Mapping table:
+            mt="${SCRIPT_DIR}/tables/${esmod}_${submodel}_${mip}_mapping.txt"
+
+            #Define cdocmorinfo
+            it="${it_temp},${ca[${submodel}]}"
+
+            # Load and run the CMOR-Rewrite ScriptFragment
+            . ${SCRIPT_DIR}/palmod2_cmor-rewrite_${esmod}_${submodel}_auto.h
+            wait
+            print "$(date +%Y-%m-%dT%H:%M:%S): CMORisation ended for ${RAW_EXP_IDS[$y]} $submodel $chunk ($period) ..."
+            }
+
+        done # submodel
+    done # period
+    cd $previous_dir
+    done # EXP ID Index y
+
+    # Run NCO ncatted cleanup of unappropriate/unnecessary attributes
+    #  this is necessary since CMOR sets attributes necessary only for CMIP6
+    #  that are unnecessary/wrong for PalMod
+    post_nco
+
+    fi # if RUN_CMOR
+}
+
+function post_nco {
+
+print "$(date +%Y-%m-%dT%H:%M:%S): NCO cleanup started for $dr"
+# Load nco
+#module load nco || { echo "Oops: Could not load NCO!" && exit 1 ; }
+
+# Post Processing with ncatted
+#Find netCDF files in DRS directory
+flist=( $( find $dr -name "*.nc" -type f | sort ) )
+
+#Loop and run ncatted
+echo "-> Looping over ${#flist[@]} netCDF files!"
+for f in ${flist[@]}
+do
+    echo "... editing $f"
+    ncatted -O -h -a further_info_url,global,d,, $f && echo "... deleted 'further_info_url'." || echo "... failed (ERROR)"
+    [[ "$(basename $f)" == *"cen"* ]] && {
+        ncatted -O -h -a frequency,global,m,c,"cen" $f && echo "... changed frequency to 'cen'." || echo "... failed (ERROR)"
+    }
+done
+
+print "$(date +%Y-%m-%dT%H:%M:%S): NCO cleanup ended for $dr"
+
+}
+
+
+
+#Initialize DataRequest/User Configuration for the if_requested function
+# This will read all SettingsContainers, TimeSlices and the configuration file
+# Thereafter run aggregation, diagnostic, cmorization
+if $PROCESS_CLIM
+then
+    # Overwrite cmorstart/cmorend:
+    cmorstart=$iniyear
+    cmorend=$finyear
+
+    # Read settings for clim1
+    CLIMSUFFIX=_clim
+    Read_request_config $rrc_option AllExp ${cpath}/${mip}_requested_vars_AllExp${SUFFIX}${CLIMSUFFIX}.conf || die "error while reading request config"
+    # Run diag&cmor
+    run_diag
+    run_cmor
+
+    if [[ "$experiment" != "ssp"* ]]
+    then
+        # Reset Read_requested_config
+        l_linu=0
+        unset DreqSettings
+        unset SliceSettings
+        unset UserSettings
+        unset TimeSlicesBounds
+        unset PriorityOrder
+
+        # Read settings for clim2
+        CLIMSUFFIX=_clim2
+        Read_request_config $rrc_option AllExp ${cpath}/${mip}_requested_vars_AllExp${SUFFIX}${CLIMSUFFIX}.conf || die "error while reading request config"
+        # Run diag&cmor
+        run_diag
+        run_cmor
+    fi
+else
+    Read_request_config $rrc_option AllExp ${cpath}/${mip}_requested_vars_AllExpTK$SUFFIX.conf || die "error while reading request config"
+    $RUN_AGG && run_agg || echo "Could not run agg"
+    $RUN_DIAGS && run_diag || echo "Could not run diag"
+    $RUN_CMOR && run_cmor || echo "Could not run cmor"
+    wait
+fi
+
+
+
+print "$(date +%Y-%m-%dT%H:%M:%S): $MESSAGE finished for $cmorstart-$cmorend$SUFFIX"
+
+# Update run dates and submit job scripts
+
+# $Id$
+
+
diff --git a/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR_cdocmorinfo b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR_cdocmorinfo
new file mode 100644
index 0000000..6351079
--- /dev/null
+++ b/cmor/mpiesm/scripts/transient-deglaciation-prescribed-glac1d-methane_r1i1p1f2-CR_cdocmorinfo
@@ -0,0 +1,115 @@
+#
+# experiment info:
+#
+_CONTROLLED_VOCABULARY_FILE=PalMod2_CV.json
+_FORMULA_VAR_FILE=PalMod2_formula_terms.json
+_AXIS_ENTRY_FILE=PalMod2_coordinate.json
+CONVENTIONS="CF-1.7 PalMod-2.0"
+TITLE="MPI-ESM1-2 output prepared for PalMod2"
+_history_template="%s ; CMOR rewrote data to be consistent with <activity_id>, <Conventions> and CF standards."
+
+EXPERIMENT_ID=transient-deglaciation-prescribed-glac1d-methane
+EXPERIMENT="transient deglaciation with GLAC-1D ice sheets, with methane cycle"
+#Specify VARIANT_LABEL explicitly or realization_index, physics_index, initialization_index and forcing_index:
+VARIANT_LABEL=r1i1p1f2
+REALIZATION_INDEX=1
+INITIALIZATION_INDEX=1
+PHYSICS_INDEX=1
+FORCING_INDEX=2
+VARIANT_INFO="Palmod CR setup with full methane cycle. Model physics identical to MPI-ESM1-2-CR simulation transient-deglaciation-prescribed_r1i1p1f1. This simulation branched of transient-deglaciation-prescribed-glac1d-methane_r1i1p1f1 at 7001-01-01 00:00 (corresponding to 18ka BP). Compared to the original simulation it includes a meltwater perturbation: Meltwater from Laurentide ice sheet stored from 15.2 ka BP to 12.8 ka BP, then released to ocean for 1200 years. This induces an AMOC collapse, leading to a Younger Dryas event, including recovery, as described in Kleinen et al. (2022)."
+ACTIVITY_ID=PalMod2
+#MIP_ERA=PalMod2                   #ONLY CMIP6
+PROJECT_ID=PalMod2
+REQUIRED_TIME_UNITS="days since 1-1-1 00:00:00"
+#FURTHER_INFO_URL="https://furtherinfo.es-doc.org/<mip_era>.<institution_id>.<source_id>.<experiment_id>.<sub_experiment_id>.<variant_label>
+#Branch Info: If needed use the following 2 attributes to define the branch time
+#  in Parent_Time_Units and Required_Time_Units (=child)
+#  else use BRANCH_DATES to give the dates in YYYYMMDD,YYYYMMDD format
+#BRANCH_TIME_IN_PARENT=
+#BRANCH_TIME_IN_CHILD=
+#BRANCH_DATES=19000101,18500101
+#BRANCH_METHOD="standard"
+#PARENT_MIP_ERA=none              #ONLY CMIP6
+#PARENT_ACTIVITY_ID=none
+#PARENT_EXPERIMENT=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
+SUB_EXPERIMENT_ID=none
+SUB_EXPERIMENT=none
+#
+#model info:
+#
+SOURCE_ID=MPI-ESM1-2-CR-CH4
+#MODEL_ID=MPI-ESM1-2-CR-CH4
+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"
+#Kleinen, T., Gromov, S., Steil, B., and Brovkin, V. (2022). Atmospheric methane since the LGM was driven by wetland sources. Clim. Past Discuss. [preprint],  https://doi.org/10.5194/cp-2022-80.
+#\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: unnamed (accelerated methane chemistry)\nland: JSBACH3.20, River Transport Model\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, prescribed\nseaIce: unnamed (thermodynamic (Semtner zero-layer) dynamic (Hibler 79) sea ice model)\nsolidLand: none, prescribed"
+SOURCE_TYPE="AOGCM CHEM"
+#CALENDAR=proleptic_gregorian
+#MAPPING_TABLE_DIR=cmip6_mapping_tables
+#MAPPING_TABLE=MPIESM1_CMIP6.txt
+#GRID_FILE_DIR=__GRID_FILE_DIR
+#GRID_FILE=__GRID_FILE
+GRID=gn
+GRID_LABEL=gn
+#NOMINAL_RESOLUTION read from external file
+#For MPIOM/HAMOCC CR / GR30
+#NOMINAL_RESOLUTION="500 km"
+#For ECHAM6/JSBACH CR / T31
+#NOMINAL_RESOLUTION="500 km"
+#
+CHAR_AXIS_VEGTYPE=bare_land,glacier,tropical_evergreen_trees,tropical_deciduous_trees,extra-tropical_evergreen_trees,extra-tropical_deciduous_trees,raingreen_shrubs,deciduous_shrubs,C3_grass,C4_grass,C3_pasture,C4_pasture,C3_crops,C4_crops
+CHAR_AXIS_SOILPOOLS=acid-soluble_below_ground_leaf_litter,acid-soluble_below_ground_woody_litter,water-soluble_below_ground_leaf_litter,water-soluble_below_ground_woody_litter,ethanol-soluble_below_ground_leaf_litter,ethanol-soluble_below_ground_woody_litter,non-soluble_below_ground_leaf_litter,non-soluble_below_ground_woody_litter,humus_from_leaf_litter,humus_from_woody_litter
+CHAR_AXIS_LANDUSE=primary_and_secondary_land,crops,pastures,urban
+CHAR_AXIS_BASIN=global_ocean,atlantic_arctic_ocean,indian_pacific_ocean
+CHAR_AXIS_OLINE=barents_opening,bering_strait,canadian_archipelago,denmark_strait,drake_passage,english_channel,pacific_equatorial_undercurrent,faroe_scotland_channel,florida_bahamas_strait,fram_strait,iceland_faroe_channel,indonesian_throughflow,mozambique_channel,taiwan_luzon_straits,windward_passage
+CHAR_AXIS_SILINE=barents_opening,bering_strait,canadian_archipelago,fram_strait
+#spectband for the 3 aeropt variables
+CHAR_AXIS_SPECTBAND_aeroptbnd=1818182
+CHAR_AXIS_SPECTBAND_aeroptbnd_BOUNDS=2262443,1600000
+CHAR_AXIS_SPECTBAND_aeroptbnd_UNITS="m-1"
+CHAR_AXIS_SPECTBAND_aerssabnd=1818182
+CHAR_AXIS_SPECTBAND_aerssabnd_BOUNDS=2262443,1600000
+CHAR_AXIS_SPECTBAND_aerssabnd_UNITS="m-1"
+CHAR_AXIS_SPECTBAND_aerasymbnd=1818182
+CHAR_AXIS_SPECTBAND_aerasymbnd_BOUNDS=2262443,1600000
+CHAR_AXIS_SPECTBAND_aerasymbnd_UNITS="m-1"
+# 2d-spectband for the albedos
+CHAR_AXIS_SPECTBAND_albdirbnd=3225689,766690
+CHAR_AXIS_SPECTBAND_albdirbnd_BOUNDS=5000000,1451379,1451379,82001
+CHAR_AXIS_SPECTBAND_albdirbnd_UNITS="m-1"
+CHAR_AXIS_SPECTBAND_albdiffbnd=3225689,766690
+CHAR_AXIS_SPECTBAND_albdiffbnd_BOUNDS=5000000,1451379,1451379,82001
+CHAR_AXIS_SPECTBAND_albdiffbnd_UNITS="m-1"
+CHAR_AXIS_SPECTBAND_solbnd=1818182
+CHAR_AXIS_SPECTBAND_solbnd_BOUNDS=2262443,1600000
+CHAR_AXIS_SPECTBAND_solbnd_UNITS="m-1"
+# PalMod
+CHAR_AXIS_TYPELICE="ice sheet","ice shelf","ocean","ice-free land"
+#T_AXIS="cmip" causes the time axis to be rewritten according to the requested time stamps
+T_AXIS="cmip"
+#OUTPUT_MODE="r"
+OUTPUT_MODE="a"
+MAX_SIZE=0
+SAVE_CHUNK="n"
+#For files without time axis, if one is requested:
+#firsttimeval=1 (1850-01-02 00:00:00 wenn days since 1850-01-01 00:00:00)
+FIRSTTIMEVAL=1
+#
+# institution and contact info:
+#
+# none of these can be set in the command line
+#
+DEFLATE_LEVEL=1
+CONTACT=palmod2-mpi-esm@dkrz.de
+#
+# MPI-M
+#
+INSTITUTION_ID=MPI-M
+INSTITUTION="Max Planck Institute for Meteorology, Hamburg 20146, Germany"
+LICENSE="PalMod2 model data produced by MPI-M is licensed under a Creative Commons Attribution ShareAlike 4.0 International License (https://creativecommons.org/licenses). The data producers and data providers make no warranty, either express or implied, including, but not limited to, warranties of merchantability and fitness for a particular purpose. All liabilities arising from the supply of the information (including any liability arising in negligence) are excluded to the fullest extent permitted by law."
+#MIP_TABLE_DIR="/pool/data/CMIP6/cmip6-cmor-tables/Tables/"
+MIP_TABLE_DIR="/work/bm0021/PalMod2/cmor_tables/"
-- 
GitLab