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

cmor mpiesm mpism - update to runpp regarding time axis

parent ef947aeb
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@ SOURCE="MPI-ESM1.2-CR (2017): \naerosol: none, prescribed Kinne (2010)\natmos: E
CONVENTIONS="CF-1.7 PalMod-2.0"
CREATION_DATE="2022-02-22T22:00:00Z"
HISTORY="2022-02-22T22:00:00Z ; CMOR rewrote data to be consistent with PalMod2, CF-1.7 PalMod-2.0 and CF standards."
PARENTEXPID="no parent"
declare -A TABLE_INFO
# 00.00.02
TABLE_INFO[Amon]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e36561826e6b0"
......@@ -23,6 +24,18 @@ TABLE_INFO[dec]="Creation Date:(14 February 2022) MD5:26bac4b397da7babac4e365618
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"
#
#TABLE_INFO[]=
declare -A VARIANT_INFO
......@@ -44,6 +57,8 @@ echo "-------------------------"
exp_id=transient-deglaciation-prescribed-glac1d_r1i1p1f1-CR
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/ik1017/ESGF_Buff/k204212/PalMod2_test
ifiles=($(find $ifolder -type f))
......@@ -57,7 +72,7 @@ echo $i $ifile
physics_index=${memberid:5:1}
# Run ncatted
#ncatted -O -h -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 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"
# Adjust filename timestamp
......@@ -69,9 +84,9 @@ echo $i $ifile
echo $time1 $time2
# Case 1 - Decadal data
if [[ "$table" == *"dec"* ]]; then
if [[ "${time1: -1}" == "5" ]]; then
newtime1=$(printf "%05d" $(expr $time1 - 4))
newtime2=$(printf "%05d" $(expr $time2 + 5))
if [[ "${time1: -1}" == "6" ]]; then
newtime1=$(printf "%05d" $(expr $time1 - 5))
newtime2=$(printf "%05d" $(expr $time2 + 4))
else
newtime1=$(printf "%05d" ${time1} )
newtime2=$(printf "%05d" ${time2} )
......
......@@ -2,6 +2,9 @@
# Editor Note: This variable needs to be converted to the correct units. So it should bmelt*ice_density (917)*secondsperyear. Requires aggregation to account for leap years. Added recipe just for testing.
{ (if_requested $member $icemod IdecAnt libmassbffl $chunk '???1123124' && {
find_file -e "$sdir" "pism_ant_${period}*.nc" ifile
echo "$cdo -f nc -O \
-expr,'libmassbffl=bmelt*917*86400*365;' \
$ifile ${sdir}/out_diag/IdecAnt_libmassbffl_${period}.nc"
$cdo -f nc -O \
-expr,'libmassbffl=bmelt*917*86400*365;' \
$ifile ${sdir}/out_diag/IdecAnt_libmassbffl_${period}.nc || echo ERROR
......@@ -11,6 +14,9 @@
# Editor Note: This variable needs to be converted to the correct units. So it should bmelt*ice_density (917)*secondsperyear. Requires aggregation to account for leap years. Added recipe just for testing.
{ (if_requested $member $icemod IdecGre libmassbffl $chunk '???1123124' && {
find_file -e "$sdir" "pism_nh_${period}*.nc" ifile
echo "$cdo -f nc -O \
-expr,'libmassbffl=bmelt*917*86400*365;' \
$ifile ${sdir}/out_diag/IdecGre_libmassbffl_${period}.nc"
$cdo -f nc -O \
-expr,'libmassbffl=bmelt*917*86400*365;' \
$ifile ${sdir}/out_diag/IdecGre_libmassbffl_${period}.nc || echo ERROR
......@@ -19,6 +25,9 @@
#-- Diagnostic for mpism (ESM: MPI-ESM1-2) variable sftgifIt / table IdecAnt
{ (if_requested $member $icemod IdecAnt sftgifIt $chunk '???1123124' && {
find_file -e "$sdir" "pism_ant_${period}*.nc" ifile
echo "$cdo -f nc -O \
${cdochain-} -expr,'ifl=mask==0;gi=mask==2;fi=mask==3;o=mask==4;' \
$ifile ${sdir}/out_diag/IdecAnt_sftgifIt_$period.nc"
$cdo -f nc -O \
${cdochain-} -expr,'ifl=mask==0;gi=mask==2;fi=mask==3;o=mask==4;' \
$ifile ${sdir}/out_diag/IdecAnt_sftgifIt_$period.nc || echo ERROR
......@@ -27,6 +36,9 @@
#-- Diagnostic for mpism (ESM: MPI-ESM1-2) variable sftgifIt / table IdecGre
{ (if_requested $member $icemod IdecGre sftgifIt $chunk '???1123124' && {
find_file -e "$sdir" "pism_nh_${period}*.nc" ifile
echo "$cdo -f nc -O \
${cdochain-} -expr,'ifl=mask==0;gi=mask==2;fi=mask==3;o=mask==4;' \
$ifile ${sdir}/out_diag/IdecGre_sftgifIt_$period.nc"
$cdo -f nc -O \
${cdochain-} -expr,'ifl=mask==0;gi=mask==2;fi=mask==3;o=mask==4;' \
$ifile ${sdir}/out_diag/IdecGre_sftgifIt_$period.nc || echo ERROR
......
......@@ -11,12 +11,12 @@
n_subsim=1
#initial and final year of the experiment
spinup=0
iniyeararr=( $(( 4000 + spinup )) )
finyeararr=( 4999 )
iniyeararr=( $(( 1 + spinup )) )
finyeararr=( 1000 )
iniyear=$(( 1 + spinup ))
finyear=26000
#offset compared to startyear
inioffsetarr=( -3999 )
inioffsetarr=( 0 )
# Time axis (26000-1 BP)
## exp time total yrs new exp time offset
......@@ -37,7 +37,7 @@ chunksize=100
for i in 0
do
#for yyyy in $(seq ${iniyeararr[$i]} ${finyeararr[$i]} )
for yyyy in $(seq 4100 4299)
for yyyy in $(seq 4000 4199)
do
paramarr+=( "$i $yyyy" )
done
......
......@@ -13,7 +13,7 @@
#SBATCH --account=bm0021
#SBATCH --qos=esgf
#SBATCH --exclusive
#SBATCH --output=transient-deglaciation-prescribed-glac1d_r1i1p1f1-CR.runpp_%j.log
#SBATCH --output=pismtest.runpp_%j.log
DEBUG_LEVEL=${DEBUG_LEVEL:-0}
......@@ -113,7 +113,7 @@ it_temp="${SCRIPT_ROOT}/pismtest_cdocmorinfo"
ca+=([mpiom]="${SCRIPT_ROOT}/cdocmorinfo_mpiom_CR")
ca+=([echam6]="${SCRIPT_ROOT}/cdocmorinfo_echam6_CR")
ca+=([jsbach]="${SCRIPT_ROOT}/cdocmorinfo_jsbach_CR")
ca+=([mpism]="${SCRIPT_ROOT}/cdocmorinfo_jsbach_CR")
ca+=([mpism]="${SCRIPT_ROOT}/cdocmorinfo_mpism_CR")
#Experiment etc
experiment=transient-deglaciation-prescribed-glac1d
......@@ -329,9 +329,6 @@ function run_agg
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
......@@ -340,6 +337,8 @@ function run_agg
l_chunk_year=${l_chunk%??????}
r_chunk_year=${r_chunk%??????}
period_bk=$period
inv_chunk_year=$(( 1 + ${finyear} - ${l_chunk_year##+(0)} ))
print "Aggregation $chunk ($period): Reading forcing/input of year $inv_chunk_year"
......@@ -353,6 +352,16 @@ function run_agg
# Perform aggregation for each submodel
for submodel in $icemod; do #$atmmod $ocemod $srfmod $bgcmod; do
if [[ "$submodel" == "$icemod" ]]; then
period=$(( inv_chunk_year - 10 ))
# perform time shift for selected variables
cdochain="-shifttime,-5year -shifttime,${finyear}year" # for decadal time intervals only!
else
period=$period_bk
# perform time shift for selected variables
cdochain="-shifttime,$((inioffsetarr[$y] - spinup))year -shifttime,-3day"
fi
# Chunking
[[ "${chunks[$submodel]}" == *" ${period: -1} "* ]] && {
......@@ -374,11 +383,11 @@ function run_agg
# Create softlinks to raw model output - PISM requires special treatment
if [[ $submodel == "mpism" ]]; then
#ln -sf $rawsdir_pism_ant/pism_-$(printf "%06d" ${inv_chunk_year})/pism_-$(printf "%06d" ${inv_chunk_year}).nc $sdir/pism_ant_${period}.nc
#ln -sf $rawsdir_pism_nh/pism_-$(printf "%06d" ${inv_chunk_year})/pism_-$(printf "%06d" ${inv_chunk_year}).nc $sdir/pism_nh_${period}.nc
cp -v $rawsdir_pism_ant/pism_-$(printf "%06d" ${inv_chunk_year})/pism_-$(printf "%06d" ${inv_chunk_year}).nc $sdir/pism_ant_${period}.nc
#ln -sf $rawsdir_pism_ant/pism_-$(printf "%06d" $((inv_chunk_year - 10)))/pism_-$(printf "%06d" $((inv_chunk_year - 10))).nc $sdir/pism_ant_${period}.nc
#ln -sf $rawsdir_pism_nh/pism_-$(printf "%06d" $((inv_chunk_year - 10)))/pism_-$(printf "%06d" $((inv_chunk_year - 10))).nc $sdir/pism_nh_${period}.nc
cp -v $rawsdir_pism_ant/pism_-$(printf "%06d" $((inv_chunk_year - 10)))/pism_-$(printf "%06d" $((inv_chunk_year - 10))).nc $sdir/pism_ant_${period}.nc
ncatted -O -h -a scale_factor_at_projection_origin,mapping,o,d,1.0 $sdir/pism_ant_${period}.nc || { echo "ERROR ncatted $sdir/pism_ant_${period}.nc" ; exit 1 ; }
cp -v $rawsdir_pism_nh/pism_-$(printf "%06d" ${inv_chunk_year})/pism_-$(printf "%06d" ${inv_chunk_year}).nc $sdir/pism_nh_${period}.nc
cp -v $rawsdir_pism_nh/pism_-$(printf "%06d" $((inv_chunk_year - 10)))/pism_-$(printf "%06d" $((inv_chunk_year - 10))).nc $sdir/pism_nh_${period}.nc
ncatted -O -h -a ellipsoid,mapping,o,c,WGS84 -a grid_mapping_name,mapping,o,c,polar_stereographic -a false_easting,mapping,o,d,0. -a false_northing,mapping,o,d,0. -a latitude_of_projection_origin,mapping,o,d,90. -a standard_parallel,mapping,o,d,70. -a straight_vertical_longitude_from_pole,mapping,o,d,-45. -a scale_factor_at_projection_origin,mapping,o,d,1.0 $sdir/pism_nh_${period}.nc || { echo "ERROR ncatted $sdir/pism_nh_${period}.nc" ; exit 1 ; }
else
ln -sf $rawsdir/*_${period}* $sdir/ 2>/dev/null 1>&2 || { echo "ERROR creating links for $period ${RAW_EXP_IDS[$y]} $submodel" && exit 1 ; }
......@@ -408,6 +417,7 @@ function run_diag
l_chunk=$(echo $chunk | cut -d "-" -f1)
r_chunk=$(echo $chunk | cut -d "-" -f2)
period_bk=$period
l_chunk_year=${l_chunk%??????}
r_chunk_year=${r_chunk%??????}
......@@ -423,6 +433,16 @@ function run_diag
# Perform diagnostic for each submodel
for submodel in $icemod; do #$atmmod $ocemod $srfmod $bgcmod; do
if [[ "$submodel" == "$icemod" ]]; then
period=$(( inv_chunk_year - 10 ))
# perform time shift for selected variables
cdochain="-shifttime,-5year -shifttime,${finyear}year" # for decadal time intervals only!
else
period=$period_bk
# perform time shift for selected variables
cdochain="-shifttime,$((inioffsetarr[$y] - spinup))year -shifttime,-3day"
fi
# Chunking
[[ "${chunks[$submodel]}" == *" ${period: -1} "* ]] && {
......@@ -430,11 +450,6 @@ function run_diag
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
# cdochain - perform a timeshift
cdochain="-shifttime,$((inioffsetarr[$y] - spinup))year -shifttime,-3day"
# for PISM
[[ "$submodel" == "$icemod" ]] && cdochain="-shifttime,${l_chunk_year}year -shifttime,-5year -shifttime,${inv_chunk_year}year"
#Location of input/output
sdir=${SDIR[$y]}/outdata/$submodel
rawsdir=${RAWSDIR[$y]}/outdata/$submodel
......@@ -501,6 +516,7 @@ function run_cmor
l_chunk=$(echo $chunk | cut -d "-" -f1)
r_chunk=$(echo $chunk | cut -d "-" -f2)
period_bk=$period
l_chunk_year=${l_chunk%??????}
r_chunk_year=${r_chunk%??????}
......@@ -508,7 +524,6 @@ function run_cmor
inv_chunk_year=$(( 1 + ${finyear} - ${l_chunk_year##+(0)} ))
# 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
......@@ -520,6 +535,18 @@ function run_cmor
# Perform CMOR rewrite for each submodel
for submodel in $icemod; do #$atmmod $ocemod $srfmod $bgcmod; do
if [[ "$submodel" == "$icemod" ]]; then
period=$(( inv_chunk_year - 10 ))
# perform time shift for selected variables
cdochain="-shifttime,-5year -shifttime,${finyear}year" # for decadal time intervals only!
di=${l_chunk_year##+(0)},$(( ${l_chunk_year##+(0)} + 9 ))
else
period=$period_bk
# perform time shift for selected variables
cdochain="-shifttime,$((inioffsetarr[$y] - spinup))year -shifttime,-3day"
di="$(( ${period} + ${inioffsetarr[$y]} - 9 - $spinup )),$(( ${period} + ${inioffsetarr[$y]} - $spinup ))"
fi
# Chunking
[[ "${chunks[$submodel]}" == *" ${period: -1} "* ]] && {
......@@ -527,11 +554,6 @@ function run_cmor
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
# cdochain - perform a timeshift
cdochain="-shifttime,$((inioffsetarr[$y] - spinup))year -shifttime,-3day"
# for PISM
[[ "$submodel" == "$icemod" ]] && cdochain="-shifttime,${l_chunk_year}year -shifttime,-5year -shifttime,${inv_chunk_year}year"
#Location of input/output
sdir=${SDIR[$y]}/outdata/$submodel
rawsdir=${RAWSDIR[$y]}/outdata/$submodel
......@@ -624,7 +646,7 @@ then
run_cmor
fi
else
Read_request_config $rrc_option AllExpPISM ${cpath}/${mip}_requested_vars_AllExp$SUFFIX.conf || die "error while reading request config"
Read_request_config $rrc_option AllExp ${cpath}/${mip}_requested_vars_AllExpPISM$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"
......
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