Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uamiv test using only raw uamiv variables #3485

Merged
merged 4 commits into from
Nov 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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