forked from jmccreight/wrfHydroScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompTwoGroupsColdRestartNLast.sh
More file actions
executable file
·92 lines (70 loc) · 2.57 KB
/
compTwoGroupsColdRestartNLast.sh
File metadata and controls
executable file
·92 lines (70 loc) · 2.57 KB
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
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
help='
compTwoGroupsColdRestartNLast.sh :: Test equality of cold and restart outputs for different binaries.
Premise: Two groups each with three runs:
1) long N, a cold start run using N cores
2) short N, a restart from 1 also using N cores
3) short M, a restart from 1 but using M cores (generally N-1)
Ignore 3. Test equivalance between the two groups of 1 and 2.
Arguments:
1) prefix pattern speficying group 1
2) prefix pattern speficying group 2
TODO: check nFIRST
TODO: pass number of files in nLast/nFirst
TODO: what if the runs are of unequal length?
TODO: i think that testNLast first argument is the one which "tail" is performed.
TODO: that would be the corresponding arguemnt, the one with the shorter overlapping run
TODO: some sort of path specificiation
'
if [ -z $1 ] || [ -z $2 ]
then
echo "$help"
exit 1
fi
pattern1=$1
pattern2=$2
whsPath=`grep "wrfHydroScripts" ~/.wrfHydroScripts | cut -d '=' -f2 | tr -d ' '`
source $whsPath/helpers.sh
source $whsPath/sourceMe.sh
ncosPath=`grep "ncoScripts" ~/.wrfHydroScripts | cut -d '=' -f2 | tr -d ' '`
source $ncosPath/ncFilters.sh
## First check for ~/.wrfHydroRegressionTests.txt
#configFile=~/.wrfHydroRegressionTests.txt
#checkExist $configFile "$help" || exit 1
#attemptDir=`grep attemptDir $configFile | cut -d'=' -f2 | tr -d ' '`
## how i name the attempt in regTests
# attemptDir=$attemptDir/`basename $theBinary`.${nCores}cores.$theDate.`basename $testDir`
## setup test dir here.
## right now not really doing this as I will once
## base tests exist...
cd /home/jamesmcc/WRF_Hydro/TESTING/TESTS
matches1=`ls -1d *${pattern1}*`
nMatches1=`echo "$matches1" | wc -l`
long1=`echo "$matches1" | grep -i long`
short1=`echo "$matches1" | grep -i _short_ | tail -1`
matches2=`ls -1d *${pattern2}*`
nMatches2=`echo "$matches2" | wc -l`
long2=`echo "$matches2" | grep -i long`
short2=`echo "$matches2" | grep -i _short_ | tail -1`
accumReturns=0
## Cold start
echo
echo -e "\e[7;47;39mComparing cold start runs final files:\e[0m"
echo -e "testNLast 1 $long1/VERIFICATION/ \
$long2/VERIFICATION/"
testNLast 1 $long1/VERIFICATION/ \
$long2/VERIFICATION/
accumReturns=$(($accumReturns+$?))
echo
echo -e "\e[31mAccumulated errors at this point: $accumReturns\e[0m"
## REstart
echo
echo -e "\e[7;47;39mComparing REstart runs final files:\e[0m"
echo -e "testNLast 1 $short1/VERIFICATION/ \
$short2/VERIFICATION/"
testNLast 1 $short1/VERIFICATION/ \
$short2/VERIFICATION/
accumReturns=$(($accumReturns+$?))
echo
echo -e "\e[31mAccumulated errors: $accumReturns\e[0m"
exit $accumReturns