Skip to content

Commit

Permalink
uamiv test using only raw uamiv variables (#3485)
Browse files Browse the repository at this point in the history
* uamiv test using only raw uamiv variables

Previous test relied on CF generated metadata, but this test is more robust.

* uamiv test using only raw uamiv variables

Previous test relied on CF generated metadata, but this test is more robust.

* uamiv test using only raw uamiv variables

Previous test relied on CF generated metadata, but this test is more robust.

* uamiv test using only raw uamiv variables
  • Loading branch information
barronh authored and dcherian committed Nov 5, 2019
1 parent af28c6b commit 4dce93f
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions xarray/tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -3400,20 +3400,17 @@ def test_uamiv_format_read(self):
actual = camxfile.variables["O3"]
assert_allclose(expected, actual)

data = np.array(["2002-06-03"], "datetime64[ns]")
data = np.array([[[2002154, 0]]], dtype="i")
expected = xr.Variable(
("TSTEP",),
("TSTEP", "VAR", "DATE-TIME"),
data,
dict(
bounds="time_bounds",
long_name=(
"synthesized time coordinate "
+ "from SDATE, STIME, STEP "
+ "global attributes"
),
long_name="TFLAG".ljust(16),
var_desc="TFLAG".ljust(80),
units="DATE-TIME".ljust(16),
),
)
actual = camxfile.variables["time"]
actual = camxfile.variables["TFLAG"]
assert_allclose(expected, actual)
camxfile.close()

Expand All @@ -3439,18 +3436,15 @@ def test_uamiv_format_mfread(self):
actual = camxfile.variables["O3"]
assert_allclose(expected, actual)

data1 = np.array(["2002-06-03"], "datetime64[ns]")
data = np.concatenate([data1] * 2, axis=0)
data = np.array([[[2002154, 0]]], dtype="i").repeat(2, 0)
attrs = dict(
bounds="time_bounds",
long_name=(
"synthesized time coordinate "
+ "from SDATE, STIME, STEP "
+ "global attributes"
),
long_name="TFLAG".ljust(16),
var_desc="TFLAG".ljust(80),
units="DATE-TIME".ljust(16),
)
expected = xr.Variable(("TSTEP",), data, attrs)
actual = camxfile.variables["time"]
dims = ("TSTEP", "VAR", "DATE-TIME")
expected = xr.Variable(dims, data, attrs)
actual = camxfile.variables["TFLAG"]
assert_allclose(expected, actual)
camxfile.close()

Expand Down

0 comments on commit 4dce93f

Please sign in to comment.