Skip to content

Commit 64b019b

Browse files
committed
add a xr_ds.yt.ds() test
1 parent 4bd0240 commit 64b019b

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

tests/test_accesor.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_load_uniform_grid():
9393
expected_field_list = [("stream", f) for f in flds]
9494
assert all([f in expected_field_list] for f in ds_yt.field_list)
9595

96-
ds_yt = ds.yt.ds() # should generate a ds with all fields
96+
ds_yt = ds.yt.load_uniform_grid() # should generate a ds with all fields
9797
flds = [tfield + "_0", tfield + "_1", tfield + "_2"]
9898
expected_field_list = [("stream", f) for f in flds]
9999
assert all([f in expected_field_list] for f in ds_yt.field_list)
@@ -107,7 +107,7 @@ def test_load_uniform_grid():
107107
z_name="altitude",
108108
coord_order=["z", "y", "x"],
109109
)
110-
ds_yt = ds.yt.ds()
110+
ds_yt = ds.yt.load_uniform_grid()
111111
assert ds_yt.coordinates.name == "geographic"
112112
assert all([f in expected_field_list] for f in ds_yt.field_list)
113113

@@ -153,3 +153,23 @@ def test_load_grid_from_callable():
153153

154154
f = ds.all_data()[flds[0]]
155155
assert len(f) == n_x * n_y * n_z
156+
157+
158+
def test_yt_ds_attr():
159+
tfield = "a_new_field"
160+
n_x = 3
161+
n_y = 4
162+
n_z = 5
163+
ds_xr = construct_minimal_ds(
164+
field_name=tfield,
165+
n_fields=3,
166+
n_x=n_x,
167+
n_y=n_y,
168+
n_z=n_z,
169+
z_name="depth",
170+
coord_order=["z", "y", "x"],
171+
)
172+
173+
ds = ds_xr.yt.ds() # alias to load_grid_from_callable but good to check
174+
for fld in list(ds_xr.data_vars):
175+
assert ("stream", fld) in ds.field_list

0 commit comments

Comments
 (0)