-
Notifications
You must be signed in to change notification settings - Fork 1
/
calculate_projected_means.sh
executable file
·47 lines (42 loc) · 1.26 KB
/
calculate_projected_means.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
#PBS -Pw85
#PBS -qnormal
#PBS -N calcpimeans
#PBS -m ae
#PBS -M [email protected]
#PBS -lwalltime=24:00:00
#PBS -lmem=32GB,ncpus=16,jobfs=4000MB
#PBS -W umask=0022
#PBS -joe
#PBS -lstorage=gdata/w85
module load nco/4.9.2
module load cdo/1.9.8
module list
FS=$IFS
BASEPATH=/g/data/$PROJECT/QFES_SWHA/hazard/input/pi
STARTYEAR=2020
MODELLIST="ACCESS1-0Q:ACCESS1-3Q:CCSM4Q:CNRM-CM5Q:CSIRO-Mk3-6-0Q:GFDL-CM3Q:GFDL-ESM2MQ:HadGEM2Q:MIROC5Q:MPI-ESM-LRQ:NorESM1-MQ"
RCPLIST="rcp45:rcp85"
COUNTER=0
IFS=":"
for i in {0..60..20}; do
YEAR=$(($STARTYEAR + $i))
ENDYEAR=$(($YEAR + 19))
DATESTR=$YEAR\_$ENDYEAR
for MODEL in $MODELLIST; do
for RCP in $RCPLIST; do
INPUTFILEPATTERN=$BASEPATH/Monthly/Cyclone_PI_$MODEL\_$RCP.Aust.*.nc
OUTPUTFILE=$BASEPATH/monthly/pcmin.$MODEL\_$RCP.$YEAR-$ENDYEAR.nc
INPUTFILE=`ls ${INPUTFILEPATTERN}`
echo $INPUTFILE
echo $OUTPUTFILE
cdo -ymonmean -selyear,${YEAR}/${ENDYEAR} ${INPUTFILE} ${OUTPUTFILE}
if [[ $? -ne 0 ]]; then
echo "Looks like the command failed when processing $INPUTFILE"
else
echo "Processed $INPUTFILE ($YEAR)"
fi
done
done
done
IFS=$FS