Skip to content
This repository was archived by the owner on Apr 18, 2018. It is now read-only.

Commit 1847c03

Browse files
committed
Merge branch 'master' of https://github.com/altMITgcm/MITgcm into manual_edits
2 parents fde9baa + e720e29 commit 1847c03

File tree

5 files changed

+146
-7
lines changed

5 files changed

+146
-7
lines changed

.travis.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,43 @@ before_install:
1010
- docker exec -i fc11-testreport ls -altr /MITgcm
1111
- docker exec -i fc11-testreport yum install python-pip
1212
- docker exec -i fc11-testreport yum install gcc-gfortran
13+
- docker exec -i fc11-testreport yum install python-argparse
1314

1415
script:
1516
- echo `pwd`
16-
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; ./testreport -t tutorial_barotropic_gyre"
17+
# aim.5l_cs
18+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; ./testreport -t aim.5l_cs | tee aim.5l_cs/testreport_out.txt"
19+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; python verification_parser.py -filename 'aim.5l_cs/testreport_out.txt' -threshold 14 16"
20+
# global_ocean.cs32x15
21+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; ./testreport -t global_ocean.cs32x15 | tee global_ocean.cs32x15/testreport_out.txt"
22+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; python verification_parser.py -filename 'global_ocean.cs32x15/testreport_out.txt' -threshold 16 16 16 16 16"
23+
# global_ocean.90x40x15
24+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; ./testreport -t global_ocean.90x40x15 | tee global_ocean.90x40x15/testreport_out.txt"
25+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; python verification_parser.py -filename 'global_ocean.90x40x15/testreport_out.txt' -threshold 16 16 16"
26+
# hs94.cs-32x32x5
27+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; ./testreport -t hs94.cs-32x32x5 | tee hs94.cs-32x32x5/testreport_out.txt"
28+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; python verification_parser.py -filename 'hs94.cs-32x32x5/testreport_out.txt' -threshold 13 16"
29+
# isomip
30+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; ./testreport -t isomip | tee isomip/testreport_out.txt"
31+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; python verification_parser.py -filename 'isomip/testreport_out.txt' -threshold 16 16 16"
32+
# offline_exf_seaice
33+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; ./testreport -t offline_exf_seaice | tee offline_exf_seaice/testreport_out.txt"
34+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; python verification_parser.py -filename 'offline_exf_seaice/testreport_out.txt' -threshold 16 16 16 16 16"
35+
# tutorial advection in gyre
36+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; ./testreport -t tutorial_advection_in_gyre | tee tutorial_advection_in_gyre/testreport_out.txt"
37+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; python verification_parser.py -filename 'tutorial_advection_in_gyre/testreport_out.txt' -threshold 16"
38+
# tutorial cfc offline
39+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; ./testreport -t tutorial_cfc_offline | tee tutorial_cfc_offline/testreport_out.txt"
40+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; python verification_parser.py -filename 'tutorial_cfc_offline/testreport_out.txt' -threshold 16"
41+
# tutorial deep convection
42+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; ./testreport -t tutorial_deep_convection | tee tutorial_deep_convection/testreport_out.txt"
43+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; python verification_parser.py -filename 'tutorial_deep_convection/testreport_out.txt' -threshold 16 16"
44+
# tutorial global oce biogeo
45+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; ./testreport -t tutorial_global_oce_biogeo | tee tutorial_global_oce_biogeo/testreport_out.txt"
46+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; python verification_parser.py -filename 'tutorial_global_oce_biogeo/testreport_out.txt' -threshold 16"
47+
# tutorial global oce in p
48+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; ./testreport -t tutorial_global_oce_in_p | tee tutorial_global_oce_in_p/testreport_out.txt"
49+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; python verification_parser.py -filename 'tutorial_global_oce_in_p/testreport_out.txt' -threshold 16"
50+
# tutorial_plume_on_slope
51+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; ./testreport -t tutorial_plume_on_slope | tee tutorial_plume_on_slope/testreport_out.txt"
52+
- docker exec -i fc11-testreport bash -c "cd /MITgcm/verification; python verification_parser.py -filename 'tutorial_plume_on_slope/testreport_out.txt' -threshold 16"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[![Build Status](https://travis-ci.org/altMITgcm/MITgcm.svg?branch=master)](https://travis-ci.org/altMITgcm/MITgcm)
22

3-
# MITgcm66h
4-
M.I.T general circulation model as of checkpoint66h with author emails
3+
# MITgcm
4+
The M.I.T general circulation model

doc/_extensions/mitgcm.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from docutils import nodes
2+
3+
def setup(app):
4+
app.add_role('filelink', autolink('https://github.com/altMITgcm/MITgcm/blob/master/%s'))
5+
app.add_role('varlink', autolink('http://mitgcm.org/lxr/ident/MITgcm?_i=%s'))
6+
7+
def autolink(pattern):
8+
def role(name, rawtext, text, lineno, inliner, options={}, content=[]):
9+
url = pattern % (text,)
10+
node = nodes.reference(rawtext, text, refuri=url, **options)
11+
return [node], []
12+
return role

doc/conf.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
# add these directories to sys.path here. If the directory is relative to the
1717
# documentation root, use os.path.abspath to make it absolute, like shown here.
1818
#
19-
# import os
20-
# import sys
21-
# sys.path.insert(0, os.path.abspath('.'))
19+
import os
20+
import sys
21+
sys.path.insert(0, os.path.join(os.path.abspath('.'), '_extensions'))
2222

2323

2424
# -- General configuration ------------------------------------------------
@@ -33,7 +33,8 @@
3333
extensions = ['sphinx.ext.autodoc',
3434
'sphinx.ext.mathjax',
3535
'sphinx.ext.viewcode',
36-
'sphinxcontrib.bibtex']
36+
'sphinxcontrib.bibtex',
37+
'mitgcm']
3738

3839
# Add any paths that contain templates here, relative to this directory.
3940
templates_path = ['_templates']
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
"""Parse verification outputs."""
2+
3+
import re
4+
import glob
5+
import os
6+
7+
def verification_parser(filename, threshold):
8+
9+
# function should be given a threshold value for each sub test
10+
(directory, _) = os.path.split(filename)
11+
# how many additional tests are run with tweaks to this configuration
12+
num_exps = len(glob.glob(directory+'/input.*'))+1
13+
14+
# check that the correct number of values for `threshold` have been given
15+
if len(threshold) != num_exps:
16+
# some if statements to deal with grammar
17+
if len(threshold)==1:
18+
error_message = '{0} value given for threshold, '.format(len(threshold))
19+
else:
20+
error_message = '{0} values given for threshold, '.format(len(threshold))
21+
22+
if num_exps==1:
23+
error_message = error_message + 'but {0} subtest found.'.format(num_exps)
24+
else:
25+
error_message = error_message + 'but {0} subtests found.'.format(num_exps)
26+
27+
raise ValueError(error_message)
28+
29+
# open the testreport output to assess pass/fail
30+
with open(filename) as f:
31+
lines = f.readlines()
32+
33+
first_match = True
34+
35+
# extract lines from output
36+
for i, line in enumerate(lines):
37+
if line[:5] == '2 d e':
38+
if first_match:
39+
# skip the first match, since it doesn't contain output,
40+
# but set to false to catch next matches.
41+
first_match = False
42+
else:
43+
# save the line number where the output is found
44+
output_line = i
45+
break
46+
47+
# loop through each of the subexperiments:
48+
for j in xrange(len(threshold)):
49+
test_results = lines[output_line+2+j]
50+
51+
# split test_results into a list with values for each number.
52+
# this uses spaces and the < > characters to separate the numbers.
53+
test_results = re.split('[ ><]',test_results)
54+
# ignore the Genmake, depend, make, and run checks, as well as
55+
# the "pass" or "fail" and test name at the end of the line
56+
test_results = test_results[4:-3]
57+
# convert to floats
58+
dp_similarity = []
59+
for i, x in enumerate(test_results):
60+
try:
61+
dp_similarity.append(float(x))
62+
except ValueError:
63+
pass
64+
65+
66+
if len(dp_similarity) >= 17:
67+
# this means that the test wasn't an offline advection test.
68+
# Remove the means of u and v since they are constrained
69+
# to ~0 by domain geometry and can cause the test to fail
70+
# when it shouldn't.
71+
del dp_similarity[15]
72+
del dp_similarity[11]
73+
74+
assert all(elements >= threshold[j] for elements in dp_similarity)
75+
76+
if __name__ == '__main__':
77+
78+
import argparse
79+
80+
parser = argparse.ArgumentParser(description='Check that verification simulation passed the test.')
81+
82+
parser.add_argument('-filename', type=str,
83+
help='path to output file from the verification test')
84+
85+
parser.add_argument('-threshold',nargs='+', type=int, default=15,
86+
help='number of decimal places of similarity required for test to pass. Requires a value for each sub test. Separate values with a space.')
87+
88+
args = parser.parse_args()
89+
90+
verification_parser(**vars(args))

0 commit comments

Comments
 (0)