forked from fedef17/EnsClus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainCLUStool.sh
executable file
·58 lines (46 loc) · 2.55 KB
/
mainCLUStool.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
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# Information required by the CLUStool:
#-------------------------------about paths------------------------------------------
# Input data directory:
INPUT_PATH=/home/mavilia/DATA/historical/prRegrid/
# Input file names included the common string:
string=pr_Amon
# OUTPUT directory
OUTPUT_PATH=/home/mavilia/MAGIC/
# CLUStool directory
CLUSTOOL_PATH=/home/mavilia/MAGIC/EnsClus/clus/
#-------------------------------about data-------------------------------------------
# Write only letters or numbers, no punctuation marks!
# If you want to leave the field empty write 'no'
varname=pr #variable name in the file
varunits="kg m-2 s-1" #variable units (K, 'kg m-2 s-1')
model=ECEARTH31 #model name ECEARTH31 NCEPNCAR ERAInterim
numens=60 #total number of ensemble members
season=JJA #seasonal average
area=Eu #regional average (examples:'EAT':Euro-Atlantic
# 'PNA': Pacific North American
# 'NH': Northern Hemisphere)
# 'Eu': Europe)
kind=hist #hist: historical, scen:scenario
extreme=75th_percentile #75th_percentile, mean, maximum, std, trend
#---------------------about cluster analysis------------------------------------------
numclus=6 #number of clusters
#Either set perc or numpcs:
perc=80 #cluster analysis is applied on a number of PCs such as they explain
#'perc' of total variance
numpcs=no #number of PCs
#---------------------about plots------------------------------------------------------
field_to_plot='anomalies' #field to plot ('climatologies', 'anomalies', '75th_percentile', 'mean', 'maximum', 'std', 'trend')
name_outputs="${varname}_${model}_${numens}ens_${season}_${area}_${kind}"
##PRECOMPUTATION
filenames=`grep -rnl $INPUT_PATH -e $string`
for word in $filenames; do
echo $word
done
python ${CLUSTOOL_PATH}ens_anom.py "$filenames" "$OUTPUT_PATH" "$name_outputs" "$varname" "$numens" "$season" "$area" "$extreme"
##ENSEMBLE EOF and K-MEANS
python ${CLUSTOOL_PATH}ens_eof_kmeans.py "$OUTPUT_PATH" "$name_outputs" "$numens" "$numpcs" "$perc" "$numclus"
##PLOT AND SAVE FIGURES
python ${CLUSTOOL_PATH}ens_plots.py "$OUTPUT_PATH" "$name_outputs" "$numclus" "$field_to_plot"
ls -lrt ../OUTPUT
echo ">>>>>>>> ENDED SUCCESSFULLY!! <<<<<<<<<<<<"