Skip to content
Snippets Groups Projects
Commit 21c6d5e2 authored by Martin Schupfner's avatar Martin Schupfner
Browse files

Added Conventions to ncatted fixes

parent cd2b1617
No related branches found
No related tags found
No related merge requests found
......@@ -6,14 +6,17 @@ 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"
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)"
CONVENTIONS="CF-1.7 PalMod-2.0"
echo $TITLE
echo $REFERENCES
echo $NOMINAL_RESOLUTION
echo $SOURCE
echo $CONVENTIONS
exp_id=transient-deglaciation-prescribed-glac1d_r1i1p2f2-CR
ifolder=/work/bk1192/k204212/palmod/${exp_id}/archive/PalMod2/
ifolder=/work/ik1017/ESGF_Buff/k204212/PalMod2_test
ifiles=($(find $ifolder -type f))
echo ${#ifiles[@]} files found.
......@@ -22,7 +25,7 @@ for ifile in ${ifiles[@]}; do
i=$((i+1))
echo $i $ifile
# Run ncatted
ncatted -O -h -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 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"
# Adjust filename timestamp
table=$(echo $ifile | rev | cut -d '/' -f 1 | rev | cut -d '_' -f 2)
......@@ -34,12 +37,17 @@ echo $i $ifile
echo $time1 $time2
# Case 1 - Decadal data
if [[ "$table" == *"dec"* ]]; then
newtime1=$(printf "%05d" $(expr $time1 - 4))
newtime2=$(printf "%05d" $(expr $time2 + 5))
if [[ ${time1} == ${time2} ]]; then
newtime1=$(printf "%05d" $(expr $time1 - 4))
newtime2=$(printf "%05d" $(expr $time2 + 5))
else
newtime1=$(printf "%05d" ${time1} )
newtime2=$(printf "%05d" ${time2} )
fi
# Case 2 - the rest - annual and monthly data
elif [[ "$table" == *"mon"* ]]; then
newtime1=$(printf "%07d" ${time1} )
newtime2=$(printf "%07d" ${time2} )
newtime2=$(printf "%07d" ${time2} )
elif [[ "$table" == *"yr"* ]]; then
newtime1=$(printf "%05d" ${time1} )
newtime2=$(printf "%05d" ${time2} )
......@@ -58,5 +66,5 @@ echo $i $ifile
[[ "$ifile" != "$ifile_new" ]] && {
mv -v $ifile $ifile_new || echo "ERROR renaming $ifile to $ifile_new"
}
fi
fi
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment