Commit faee0c39 authored by Sebastian Milinski's avatar Sebastian Milinski
Browse files

Output is now split into one file for each variable.

parent 48839302
...@@ -113,6 +113,28 @@ echo "running up to $pjobs parallel jobs" ...@@ -113,6 +113,28 @@ echo "running up to $pjobs parallel jobs"
outdir=${workdir}/${experiment} outdir=${workdir}/${experiment}
tmpdir=$SCRATCH/tmp/${experiment} tmpdir=$SCRATCH/tmp/${experiment}
varstring=$(echo $vars | sed "s/,/_/g") # replace , with _ so that variable list can be used in filename varstring=$(echo $vars | sed "s/,/_/g") # replace , with _ so that variable list can be used in filename
filestring=${experiment}_${yearstart}-${yearend}_ens_${run_0}-${run_n} # used for filenames
# create array from $vars by using , as a separator
IFS=',' read -r -a var_array <<< "$vars"
num_missfiles=0 #initiate counter for number
for var in "${var_array[@]}"
do
filename=${outdir}/${filestring}.${var}.nc
if [ ! -f $filename ]; then
num_missfiles=$[num_missfiles + 1]
echo "$filename is missing."
fi
done
if [ $num_missfiles -ge 1 ]; then
echo "At least one requested variable has not been processed. Starting processing..."
else
echo "All requested variables have already been processed. Nothing left to be done."
exit
fi
# test if all reuested variables have already been processed. If this is true, exit.
# for future version: do processing only for the missing variables
#============= Loop through each run #============= Loop through each run
for rrr in $(seq $run_0 $run_n); do for rrr in $(seq $run_0 $run_n); do
...@@ -147,8 +169,10 @@ for rrr in $(seq $run_0 $run_n); do ...@@ -147,8 +169,10 @@ for rrr in $(seq $run_0 $run_n); do
cdo -t echam6 -f nc select,name=${vars},year=${yearstart}/${yearend} ${ifiles} ${merged} cdo -t echam6 -f nc select,name=${vars},year=${yearstart}/${yearend} ${ifiles} ${merged}
fi fi
else else
echo "processed file found, skipping processing step." :
# echo "processed file found, skipping processing step."
fi fi
# if [[ $echam_filetype == ATM ]] && [[ $vars == q ]]; then # if [[ $echam_filetype == ATM ]] && [[ $vars == q ]]; then
# if [ ! -f $vertsum ]; then # if [ ! -f $vertsum ]; then
# #if input comes from 3D files and is specific humidity, calculate vertical sum # #if input comes from 3D files and is specific humidity, calculate vertical sum
...@@ -172,3 +196,8 @@ else ...@@ -172,3 +196,8 @@ else
fi fi
echo "file created: $ensfile" echo "file created: $ensfile"
echo "Splitting variables into files..."
cdo splitname $ensfile ${outdir}/${filestring}.
echo "Created output files in ${outdir}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment