diff --git a/mlair/helpers/mergetime_cdo_files.sh b/mlair/helpers/mergetime_cdo_files.sh new file mode 100644 index 0000000000000000000000000000000000000000..91459be176de6e17273438df6d0fb9281557cbe7 --- /dev/null +++ b/mlair/helpers/mergetime_cdo_files.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +# This scipt uses cdo mergetime to combine hourly files into two files per month +# example file: wrfout_d01_2009-02-03_07:00:00.nc + +for i in "$@"; do + case $i in + -s=*|--startyear=*) + startyear="${i#*=}" + shift # past argument=value + ;; + -e=*|--endyear=*) + endyear="${i#*=}" + shift # past argument=value + ;; + -f=*|--filestarter=*) + filestarter="${i#*=}" + shift # past argument=value + ;; + -p=*|--datapath=*) + datapath="${i#*=}" + shift # past argument=value + ;; + -n=*|--newpath=*) + newpath="${i#*=}" + shift # past argument=value + ;; + --default) + DEFAULT=YES + shift # past argument with no value + ;; + *) + # unknown option + ;; + esac +done + +# source mergetime_cdo_files.sh -s=2009 -e=2009 -f=wrfout_d01_ +# source mergetime_cdo_files.sh -s=2009 -e=2009 -f=wrfout_d01_ -p=hourly/ -n=monthly/ + +for year in $(seq "$startyear" "$endyear") +do + echo "$year" + for month in $(seq -w 1 12) + do + echo "##########################################" + echo "Processing: cdo mergetime ${datapath}${filestarter}${year}-${month}-[0-1][0-9]_??:??:??.nc ${newpath}${filestarter}${year}-${month}_first_part.nc &" + # cdo mergetime ${datapath}${filestarter}${year}-${month}-[0-1][0-9]_??:??:??.nc ${newpath}${filestarter}${year}-${month}_first_part.nc & + echo "Processing: cdo mergetime ${datapath}${filestarter}${year}-${month}-[2-3][0-9]_??:??:??.nc ${newpath}${filestarter}${year}-${month}_second_part.nc &" +# cdo mergetime ${datapath}${filestarter}${year}-${month}-[2-3][0-9]_??:??:??.nc ${newpath}${filestarter}${year}-${month}_second_part.nc & + done +done + +echo "############ YOUR OPTIONS ############" +echo "startyear: $startyear" +echo "endyear: $endyear" +echo "filestarter: $filestarter" +echo "datapath: $datapath" +echo "newpath: $newpath" \ No newline at end of file