forked from GFZ-Centre-for-Early-Warning/shakyground
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_and_validate.sh
executable file
·60 lines (46 loc) · 1.19 KB
/
run_and_validate.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
#!/bin/bash
ERROR=0
rm -vf "test.xml"
set -x
python3 service.py quakeml_test.xml MontalvaEtAl2016SInter USGSSlopeBasedTopographyProxy > "test.xml"
set +x
if ! [ -f "test.xml" ]; then
echo "Output file was not created"
exit 1
fi
# we have to shorten the grid data so xmllint has no parser problems
sed -i -e '19,500000d' "test.xml"
echo "Validating against schema ..."
if [ -x "$(command -v xmllint)" ]; then
xmllint --noout --schema "shakemap.xsd" "test.xml"
if [ "$?" != "0" ]; then
ERROR=1
fi
else
rm -vf "test.xml"
echo "xmllint is not installed"
exit 1
fi
rm -vf "test.xml"
set -x
python3 service.py quakeml_test_ns.xml MontalvaEtAl2016SInter USGSSlopeBasedTopographyProxy > "test.xml"
set +x
if ! [ -f "test.xml" ]; then
echo "Output file was not created"
exit 1
fi
# we have to shorten the grid data so xmllint has no parser problems
sed -i -e '19,40000d' "test.xml"
echo "Validating against schema ..."
if [ -x "$(command -v xmllint)" ]; then
xmllint --noout --schema "shakemap.xsd" "test.xml"
if [ "$?" != "0" ]; then
ERROR=1
fi
else
rm -vf "test.xml"
echo "xmllint is not installed"
exit 1
fi
rm -vf "test.xml"
exit $ERROR