-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiag_norcpm.sh
executable file
·82 lines (69 loc) · 3.2 KB
/
diag_norcpm.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
#################################################################################
## diag_norcpm
## This package is used to plot figures for ensembled seasonal prediction.
## Development for NorCPM.
##
## by Ping-Gin Chiu, start at 28Feb2019
## v2 at 23Apr2019
#################################################################################
#--------------------------- get data dir from argument -----------------------
## dirs as arguments, plot all figures
## each dir in BASEDIR should contain members of simulation
## if the member path:
## /path/to/model_ver/ana_19800115_me_hindcasts/ana_19800115_me_20090115/ana_19800115_me_20090115_mem09/atm/hist/
## then the arguments should be:
## /path/to/model_ver/ana_19800115_me_hindcasts
BASEDIR="${1}"
if [ -z "${BASEDIR}" ];then
echo "$0 <hindcasts_dir>"
exit
fi
BASEDIR="$(readlink -f ${BASEDIR}|head -n1)" ## make sure it is absolute path
#--------------------------- case settings begin -----------------------
# plotCase: name of this plot, get upper dirname
Dir=$(basename ${BASEDIR})
plotCase=$(basename $(dirname ${BASEDIR}))-${Dir} ## {model_ver}_{hindcasts}
# prefixRun: ana_19800115_me_ #
RUNPRE=${Dir%hindcasts} # remove "hindcast" string
if [ -z "$(ls $BASEDIR/$RUNPRE*)" ]; then # if not, take first forecast run and remove tailling date
RUNPRE=$(ls -d $BASEDIR/*_????????|head -n1)
RUNPRE=$(basename $RUNPRE | sed "s/[0-9]\{8\}$//")
fi
# plotRecipes: figures you want to plot, if none or empty means *.yml in Recipes/, Split with comma
plotRecipes='mpiexm/A01_mpiexm_annualvar.yml'
plotRecipes='16_AnoCor_seaice_frac.yml'
plotRecipes=''
#--------------------------- case settings end -------------------------
# Machine related settings
#--------------------------- machine settings begin -----------------------
## figures and webpages output directory, default is "$(pwd)/${plotCase}"
outputDir="$(pwd)/${plotCase}"
## observation or reanalysis data to compare, not done yet, heavily depends on machine
obsDataDir='/cluster/projects/nn9039k/NorCPM/Obs'
## root directory of this package, sould contain doplot.py
diag_norcpm_Root="${HOME}/work/diag_norcpm"
## root directory of this package, sould contain doplot.py
defaultRecipe="${diag_norcpm_Root}/Defaults.yml"
## python used to run doplot.py, develop with python3.4, but other version should ok.
echo before module load
module -q purge
module -q load NCO/4.7.2-intel-2018a
module -q load CDO/1.9.3-intel-2018a
module -q load NCL/6.5.0-intel-2018a
module -q unload LibTIFF/4.0.9/GCCcore-6.4.0
module -q load Python/3.6.4-intel-2018a
PYTHON=$(which python)
NCL=$(which ncl)
#--------------------------- machine settings end -----------------------
# do plot
export plotCase BASEDIR plotRecipes RUNPRE
export outputDir obsDataDir diag_norcpm_Root defaultRecipe
export PYTHON NCL
echo '================================= diag settings:'
echo "plotCase: ${plotCase}"
echo "Data dir: ${BASEDIR}"
echo "Case prefix: ${RUNPRE}"
echo "outputDir: ${outputDir}"
echo '================================= '
"$PYTHON" "${diag_norcpm_Root}/doplot.py"