Browse Source

Updated CI tests

lon0
Bill Ladwig 7 years ago
parent
commit
6f964a7c6a
  1. BIN
      test/ci_tests/ci_result_file.nc
  2. BIN
      test/ci_tests/ci_test_file.nc
  3. 13
      test/ci_tests/make_test_file.py
  4. 10
      test/ci_tests/utests.py
  5. 1
      test/utests.py

BIN
test/ci_tests/ci_result_file.nc

Binary file not shown.

BIN
test/ci_tests/ci_test_file.nc

Binary file not shown.

13
test/ci_tests/make_test_file.py

@ -146,17 +146,17 @@ def make_result_file(opts): @@ -146,17 +146,17 @@ def make_result_file(opts):
for latlonmeth in LATLON_METHS:
if latlonmeth == "xy":
# Hardcoded values from other unit tests
lats = [-55, -60, -65]
lons = [25, 30, 35]
lats = [22.0, 25.0, 27.0]
lons = [-90.0, -87.5, -83.75]
xy = ll_to_xy(infile, lats[0], lons[0])
add_to_ncfile(outfile, xy, "xy")
else:
# Hardcoded from other unit tests
i_s = np.asarray([10, 100, 150], int) - 1
j_s = np.asarray([10, 100, 150], int) - 1
x_s = np.asarray([10, 50, 90], int)
y_s = np.asarray([10, 50, 90], int)
ll = xy_to_ll(infile, i_s[0], j_s[0])
ll = xy_to_ll(infile, x_s[0], y_s[0])
add_to_ncfile(outfile, ll, "ll")
def main(opts):
@ -166,7 +166,8 @@ def main(opts): @@ -166,7 +166,8 @@ def main(opts):
if __name__ == "__main__":
DEFAULT_FILE = ("/Users/ladwig/Documents/wrf_files/"
"wrf_vortex_multi/wrfout_d02_2005-08-28_12:00:00")
"wrf_vortex_multi/moving_nest/"
"wrfout_d02_2005-08-28_12:00:00")
parser = argparse.ArgumentParser(description="Generate conda test files "
"for unit testing.")
parser.add_argument("-f", "--filename", required=False,

10
test/ci_tests/utests.py

@ -193,8 +193,8 @@ def make_latlon_test(testid, wrf_in, referent, single, multi=False, repeat=3, @@ -193,8 +193,8 @@ def make_latlon_test(testid, wrf_in, referent, single, multi=False, repeat=3,
# same whether there are multiple or single files
ref_vals = refnc.variables["xy"][:]
# Lats/Lons taken from NCL script, just hard-coding for now
lats = [-55, -60, -65]
lons = [25, 30, 35]
lats = [22.0, 25.0, 27.0]
lons = [-90.0, -87.5, -83.75]
xy = ll_to_xy(in_wrfnc, lats[0], lons[0])
@ -208,10 +208,10 @@ def make_latlon_test(testid, wrf_in, referent, single, multi=False, repeat=3, @@ -208,10 +208,10 @@ def make_latlon_test(testid, wrf_in, referent, single, multi=False, repeat=3,
# i_s, j_s taken from NCL script, just hard-coding for now
# NCL uses 1-based indexing for this, so need to subtract 1
i_s = np.asarray([10, 100, 150], int) - 1
j_s = np.asarray([10, 100, 150], int) - 1
x_s = np.asarray([10, 50, 90], int)
y_s = np.asarray([10, 50, 90], int)
ll = xy_to_ll(in_wrfnc, i_s[0], j_s[0])
ll = xy_to_ll(in_wrfnc, x_s[0], y_s[0])
nt.assert_allclose(to_np(ll), ref_vals)

1
test/utests.py

@ -32,6 +32,7 @@ def setUpModule(): @@ -32,6 +32,7 @@ def setUpModule():
os.environ["NCARG_ROOT"] = NCARG_ROOT
os.environ["NCARG_NCARG"] = os.path.join(NCARG_ROOT, "lib", "ncarg")
os.environ["OMP_NUM_THREADS"] = "4"
this_path = os.path.realpath(__file__)

Loading…
Cancel
Save