Skip to content

Commit 4dce93f

Browse files
barronhdcherian
authored andcommitted
uamiv test using only raw uamiv variables (#3485)
* 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
1 parent af28c6b commit 4dce93f

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

xarray/tests/test_backends.py

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3400,20 +3400,17 @@ def test_uamiv_format_read(self):
34003400
actual = camxfile.variables["O3"]
34013401
assert_allclose(expected, actual)
34023402

3403-
data = np.array(["2002-06-03"], "datetime64[ns]")
3403+
data = np.array([[[2002154, 0]]], dtype="i")
34043404
expected = xr.Variable(
3405-
("TSTEP",),
3405+
("TSTEP", "VAR", "DATE-TIME"),
34063406
data,
34073407
dict(
3408-
bounds="time_bounds",
3409-
long_name=(
3410-
"synthesized time coordinate "
3411-
+ "from SDATE, STIME, STEP "
3412-
+ "global attributes"
3413-
),
3408+
long_name="TFLAG".ljust(16),
3409+
var_desc="TFLAG".ljust(80),
3410+
units="DATE-TIME".ljust(16),
34143411
),
34153412
)
3416-
actual = camxfile.variables["time"]
3413+
actual = camxfile.variables["TFLAG"]
34173414
assert_allclose(expected, actual)
34183415
camxfile.close()
34193416

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

3442-
data1 = np.array(["2002-06-03"], "datetime64[ns]")
3443-
data = np.concatenate([data1] * 2, axis=0)
3439+
data = np.array([[[2002154, 0]]], dtype="i").repeat(2, 0)
34443440
attrs = dict(
3445-
bounds="time_bounds",
3446-
long_name=(
3447-
"synthesized time coordinate "
3448-
+ "from SDATE, STIME, STEP "
3449-
+ "global attributes"
3450-
),
3441+
long_name="TFLAG".ljust(16),
3442+
var_desc="TFLAG".ljust(80),
3443+
units="DATE-TIME".ljust(16),
34513444
)
3452-
expected = xr.Variable(("TSTEP",), data, attrs)
3453-
actual = camxfile.variables["time"]
3445+
dims = ("TSTEP", "VAR", "DATE-TIME")
3446+
expected = xr.Variable(dims, data, attrs)
3447+
actual = camxfile.variables["TFLAG"]
34543448
assert_allclose(expected, actual)
34553449
camxfile.close()
34563450

0 commit comments

Comments
 (0)