Skip to content

Commit

Permalink
Formatted Python code with black
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions authored and github-actions committed Aug 3, 2022
1 parent 9e08774 commit 9f0a922
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions mikeio/spatial/grid_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ def get_node_coordinates(self):
gn = Grid2D(x=xn, y=yn)
return gn.xy

def to_geometryFM(self,*,z=None, west=2, east=4, north=5,south=3):
def to_geometryFM(self, *, z=None, west=2, east=4, north=5, south=3):
"""convert Grid2D to GeometryFM
Parameters
Expand Down Expand Up @@ -681,7 +681,7 @@ def to_geometryFM(self,*,z=None, west=2, east=4, north=5,south=3):
zn = np.zeros_like(x)
if z is not None:
zn[:] = z

codes = np.zeros(n, dtype=int)
codes[y == y[-1]] = north
codes[x == x[-1]] = east
Expand Down
3 changes: 2 additions & 1 deletion tests/test_geometry_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,14 @@ def test_to_geometryFM():
assert g.codes[-2] == 5 # north
assert g.codes[-1] == 4 # east (upper right corner)


def test_to_geometryFM_custom_z_custom_code():
nx = 5
ny = 3
grd = Grid2D(nx=nx, dx=1, ny=ny, dy=2)
g = grd.to_geometryFM(z=-12.0, west=30)
assert isinstance(g, GeometryFM)
assert all(g.node_coordinates[:,2] == -12.0)
assert all(g.node_coordinates[:, 2] == -12.0)

assert g.codes[0] == 30

Expand Down

0 comments on commit 9f0a922

Please sign in to comment.