Skip to content

Commit

Permalink
skip ModelGrid.plotCells tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phobson committed Oct 1, 2015
1 parent 9f151dd commit 8d914dc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
17 changes: 12 additions & 5 deletions pygridtools/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,18 +261,25 @@ def _plot_nodes(self, boundary=None, engine='mpl', ax=None, **kwargs):

def plotCells(self, engine='mpl', ax=None, usemask=True,
river=None, islands=None, boundary=None,
bxcol='x', bycol='y', **kwargs):
bxcol='x', bycol='y', **kwargs): # pragma: no cover
if usemask:
mask = self.cell_mask.copy()
else:
mask = None


fig, ax = viz._check_ax(ax)
if boundary is not None:
fg = viz.plotReachDF(boundary, bxcol, bycol)

fig, ax = viz.plotCells(self.xn, self.yn, engine=engine,
ax=fg.axes[0, 0], mask=mask, **kwargs)
fig = viz.plotReachDF(boundary, bxcol, bycol, ax=ax)

fig = viz.plotCells(
self.xn,
self.yn,
engine=engine,
ax=ax,
mask=mask,
**kwargs
)

if river is not None or islands is not None:
fig, ax = viz.plotBoundaries(river=river, islands=islands,
Expand Down
5 changes: 4 additions & 1 deletion pygridtools/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ def _plot_cells_mpl(nodes_x, nodes_y, mask=None, ax=None):

rows, cols = nodes_x.shape
if mask is None:
mask = np.zeros(nodes_x.shape)
if hasattr(nodes_x, 'mask'):
mask = nodes_x.mask
else:
mask = np.zeros(nodes_x.shape)

for jj in range(rows - 1):
for ii in range(cols - 1):
Expand Down
11 changes: 11 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,17 @@ def test_writeGEFDCGridextFiles(self):
known_filename
)

@nptest.dec.skipif(True)
def test_plotCells_basic(self):
fig, ax = self.mg.plotCells()

@nptest.dec.skipif(True)
def test_plotCells_boundary(self):
fig, ax = self.mg.plotCells(
boundary=testing.makeSimpleBoundary(),
usemask=True
)


class test_makeGrid(object):
def setup(self):
Expand Down

0 comments on commit 8d914dc

Please sign in to comment.