From da0ba5b8f4fcc95d6d003446a804ced342ec8b23 Mon Sep 17 00:00:00 2001 From: Nic Hannah Date: Wed, 22 Nov 2017 13:48:21 +1100 Subject: [PATCH] Make remapping weights test less expensive. #52 --- test/test_remapping_weights.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/test/test_remapping_weights.py b/test/test_remapping_weights.py index 6d67638..9abc351 100644 --- a/test/test_remapping_weights.py +++ b/test/test_remapping_weights.py @@ -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): @@ -147,7 +145,7 @@ 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): @@ -155,14 +153,23 @@ 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'] @@ -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)) -