Skip to content

Commit ba4a48c

Browse files
committed
misc fixes
1 parent 47e67cb commit ba4a48c

3 files changed

Lines changed: 13 additions & 5 deletions

File tree

schismviz/suxarray.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,11 @@ def read_hgrid_gr3(path_hgrid):
498498
n_faces, n_nodes = [int(x) for x in f.readline().strip().split()[:2]]
499499
# Read the node section. Read only up to the fourth column
500500
df_nodes = pd.read_csv(path_hgrid, skiprows=2, header=None,
501-
nrows=n_nodes, delim_whitespace=True, usecols=range(4))
501+
nrows=n_nodes, sep=r'\s+', usecols=range(4))
502502
# Read the face section. Read only up to the sixth column. The last column
503503
# may exist or not.
504504
df_faces = pd.read_csv(path_hgrid, skiprows=2 + n_nodes, header=None,
505-
nrows=n_faces, delim_whitespace=True, names=range(6))
505+
nrows=n_faces, sep=r'\s+', names=range(6))
506506
# TODO Read boundary information, if any
507507
# Create suxarray grid
508508
ds = xr.Dataset()

setup.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,3 @@ addopts =
1515
markers =
1616
serial: execute test serially (to avoid race conditions)
1717

18-
[bdist_wheel]
19-
universal=1
20-

tests/test_suxarray.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@
99

1010
import schismviz.suxarray as sx
1111

12+
_TESTDATA_DIR = Path(__file__).parent / "testdata"
13+
_NC_DATA_AVAILABLE = (_TESTDATA_DIR / "out2d_1.nc").exists()
14+
requires_nc_data = pytest.mark.skipif(
15+
not _NC_DATA_AVAILABLE,
16+
reason="testdata NC files (out2d_1.nc etc.) not available in this environment"
17+
)
1218

19+
20+
@requires_nc_data
1321
def test_suxarray_init_with_out2d():
1422
""" Test suxarray initialization with a SCHISM out2d file """
1523
# Test with a HelloSCHISM v5.10 out2d file
@@ -20,6 +28,7 @@ def test_suxarray_init_with_out2d():
2028
assert grid.ds.dims['nSCHISM_hgrid_node'] == 2639
2129

2230

31+
@requires_nc_data
2332
def test_get_topology_variable():
2433
""" Test get_topology_variable """
2534
# Test with a HelloSCHISM v5.10 out2d file
@@ -48,6 +57,8 @@ def test_triangulate(grid_test):
4857
def grid_test_dask():
4958
""" Test out2d_dask fixture """
5059
p_cur = Path(__file__).parent.absolute()
60+
if not (p_cur / "testdata/out2d_1.nc").exists():
61+
pytest.skip("testdata NC files not available in this environment")
5162
path_out2d = [str(p_cur / "testdata/out2d_{}.nc".format(i))
5263
for i in range(1, 3)]
5364
ds_out2d = xr.open_mfdataset(path_out2d, mask_and_scale=False, data_vars='minimal')

0 commit comments

Comments
 (0)