Skip to content

Commit

Permalink
Make remapping weights test less expensive. #52
Browse files Browse the repository at this point in the history
  • Loading branch information
Nic Hannah committed Nov 22, 2017
1 parent fc1885a commit da0ba5b
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions test/test_remapping_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import numba
import netCDF4 as nc

from util import wait_for_qsub

EARTH_RADIUS = 6370997.0

def calc_regridding_err(weights, src, dest):
Expand Down Expand Up @@ -147,22 +145,31 @@ def test_build_esmf(self):
os.chdir(curdir)

assert ret == 0
assert os.path.exists(os.path.join(contrib_dir, 'bin', ESMF_RegridWeightGen)
assert os.path.exists(os.path.join(contrib_dir, 'bin', 'ESMF_RegridWeightGen')


def test_create_weights(self):
"""
Create weights
"""

cmd = os.path.join('tools', 'make_remap_weights.sh'))
qsub_id = sp.check_output(['qsub', cmd])
# Build ESMF_RegridWeightGen if it doesn't already exist
if not os.path.exists(os.path.join(contrib_dir, 'bin', 'ESMF_RegridWeightGen'):
self.test_build_esmf()

ret = sp.call(['./get_input_data.py'])
assert ret == 0

# Wait for job to complete.
wait_for_qsub(qsub_id.strip())
cmd = os.path.join(os.getcwd(), 'tools', 'make_remap_weights.py'))
input_dir = os.path.join(os.getcwd(), 'input')
jra55_dir = '/g/data1/ua8/JRA55-do/RYF/v1-3/'
ret = sp.call([cmd, input_dir, jra55_dir, '--ocean', 'MOM1'])
assert ret == 0

# Check that weights files have been created.
ocn = ['MOM1', 'MOM025', 'MOM01']
ocn = ['MOM1']
# We do not test the more expensive weight creation.
# ocn = ['MOM1', 'MOM025', 'MOM01']
atm = ['JRA55', 'JRA55_runoff', 'CORE2']
method = ['patch', 'conserve2nd']

Expand All @@ -171,4 +178,3 @@ def test_create_weights(self):
for m in method:
filename = '{}_{}_{}.nc'.format(a, o, m)
assert os.path.exists(os.path.join('tools', filename))

0 comments on commit da0ba5b

Please sign in to comment.