Skip to content

Commit 2bf5167

Browse files
author
Joe Hamman
committed
Merge pull request #19 from mrstu/feature/test_calc_grid
Add lat lon fixtures and calc_grid shape test
2 parents 39fa39f + 3ce6548 commit 2bf5167

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

tests/test_vic2netcdf.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
#!/usr/local/env python
2-
"""
3-
vic2netcdf_unit_test.py
4-
5-
Set to run with pytest
2+
"""Set to run with pytest
63
7-
Usage: py.test (from RVIC or test directory)
4+
Usage: py.test
85
"""
6+
import pytest
7+
98
import numpy as np
109
from tonic.tonic import calc_grid
1110

1211

13-
def test_calc_grid_standard():
14-
lons = np.arange(0, 5, 0.25)
15-
lats = np.arange(0, 10, 0.5)
12+
@pytest.fixture(scope="function")
13+
def lons():
14+
return np.arange(0, 5, 0.25)
15+
16+
17+
@pytest.fixture(scope="function")
18+
def lats():
19+
return np.arange(0, 10, 0.5)
20+
21+
22+
def test_calc_grid_standard(lons, lats):
23+
shape = np.meshgrid(lons,lats)[0].shape
1624
target_grid = calc_grid(lons, lats, decimals=4)
1725
assert type(target_grid) == dict
26+
assert target_grid['mask'].shape == shape

0 commit comments

Comments
 (0)