Commit 061c4c4d authored by Sebastian Milinski's avatar Sebastian Milinski
Browse files

Added option to change path for output, disabled ATM processing because of #4.

parent b2b70114
#!/bin/bash
# version: 8.3.2018
# contributions from Sebastian Milinski and Dian Putrasahan
# extract selected variables from range of experiments
# merge all ensemble members into one file with dimensions (ens|time|lat|lon)
usage ()
{
echo 'This script gathers one or more variables from an experiment of the MPI-ESM-GE and creates a merged file that has an ensemble dimension.'
echo 'By default, the historial ensemble is used and variable is gathered from the ECHAM BOT files.'
echo 'At least -v has to be specified, other arguments are optional.'
echo 'Usage : gather_variable.sh -e <experiment> (options: hist,onepct,rcp26,rcp45,rcp85)'
echo ' -v <variables> (options: single variable name or comma separated list.'
echo ' Make sure the variables are available in the selected filetype.)'
echo ' -r0 <first member> (options: Integer from 1 to 100, default is 1)'
echo ' -rn <last member> (options: Integer from 1 to 100, default is 100)'
echo ' -f <echam filetype> (options: ATM or BOT)'
echo ' -P <parallel jobs> NOT IMPLEMENTED! (options: any integer, default is 1)'
echo 'Usage : gather_variable.sh -e <experiment> (options: hist,onepct,rcp26,rcp45,rcp85)'
echo ' -v <variables> (options: single variable name or comma separated list.'
echo ' Make sure the variables are available in the selected filetype.)'
echo ' -r0 <first member> (options: Integer from 1 to 100, default is 1)'
echo ' -rn <last member> (options: Integer from 1 to 100, default is 100)'
echo ' -f <echam filetype> (options: ATM or BOT)'
echo ' -o <output directory> (directory for output, default is /scratch/m/$USER )'
echo ' -P <parallel jobs> NOT IMPLEMENTED! (options: any integer, default is 1)'
echo ' -h show help'
exit
}
......@@ -57,6 +64,9 @@ while [ "$1" != "" ]; do
-P ) shift
pjobs=$1
;;
-o ) shift
workdir=$1
;;
-h | --help ) usage
exit
;;
......@@ -66,6 +76,11 @@ while [ "$1" != "" ]; do
shift
done
if [[ $echam_filetype == ATM ]]; then
echo "Sorry, processing of ATM files currently disabled because of bug (see issue #4)"
exit
fi
if [[ $experiment == onepct ]]; then
yearstart=1850
yearend=1999
......@@ -114,21 +129,22 @@ for rrr in $(seq $run_0 $run_n); do
# ####### processing
ifiles=${datdir}/${expid}_echam6_${echam_filetype}_mm_????.grb
merged=${curtmpdir}/${expid}_echam6_${varstring}_mm.nc
vertsum=${curtmpdir}/${expid}_echam6_${varstring}_mm_vertsum.nc
if [ ! -f $merged ] && [ ! -f $vertsum ]; then
# vertsum=${curtmpdir}/${expid}_echam6_${varstring}_mm_vertsum.nc
# if [ ! -f $merged ] && [ ! -f $vertsum ]; then
if [ ! -f $merged ]; then
cdo -t echam6 -f nc select,name=${vars},year=${yearstart}/${yearend} ${ifiles} ${merged}
else
echo "processed file found, skipping processing step."
fi
if [[ $echam_filetype == ATM ]] && [[ $vars == q ]]; then
if [ ! -f $vertsum ]; then
#if input comes from 3D files and is specific humidity, calculate vertical sum
cdo vertsum ${merged} ${vertsum}
rm ${merged}
else
echo "Vertical sum file found, skipping processing step."
fi
fi
# if [[ $echam_filetype == ATM ]] && [[ $vars == q ]]; then
# if [ ! -f $vertsum ]; then
# #if input comes from 3D files and is specific humidity, calculate vertical sum
# cdo vertsum ${merged} ${vertsum}
# rm ${merged}
# else
# echo "Vertical sum file found, skipping processing step."
# fi
# fi
done
# merge ensemble into one file
......
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