Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
patnr committed Sep 5, 2023
1 parent 708f756 commit 43ceab1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion TPFA_ResSim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ def __setattr__(self, key, val):
Values should be betwen `0` and `Lx` or `Ly`.
.. warning:: The wells get co-located with grid nodes, not distributed over nearby ones.
.. warning:: The wells get co-located with grid nodes, ref `xy2sub`.
This is a design choice, not a mathematical necessity.
An alternative would be to distribute them over nearby nodes.
"""
prod_xy: np.ndarray = None
"""Like `inj_xy`, but for producing wells."""
Expand Down
12 changes: 7 additions & 5 deletions TPFA_ResSim/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ class Grid2D:
You can compute cell boundaries (i.e. non-central nodes) by adding or subtracting
`hx`/2 and `hy`/2 (i.e. you will miss either boundary at 0 or `Lx` or `Ly`).
.. warning:: `xy2sub` and `xy2ind` *round* to nearest cell center (they are not injective).
The alternative would be to return some kind
of interpolation weights distributing `(x, y)` over multiple nodes.
Test of round-trip capability of grid mapping computations:
>>> ij = (0, 4)
>>> grid.xy2sub(X[ij], Y[ij]) == ij
Expand Down Expand Up @@ -108,7 +104,13 @@ def ind2sub(self, ind):
return np.asarray([ix, iy])

def xy2sub(self, x, y):
"""Convert physical coordinate tuple to `(ix, iy)`, ix ∈ {0, ..., Nx-1}."""
"""Convert physical coordinate tuple to `(ix, iy)`, ix ∈ {0, ..., Nx-1}.
.. warning:: `xy2sub` and `xy2ind` *round* to nearest cell center.
I.e. they are not injective.
The alternative would be to return some kind
of interpolation weights distributing `(x, y)` over multiple nodes.
"""
x = np.asarray(x)
y = np.asarray(y)
# Don't silence errors! Validation is useful in optimisation (e.g.)
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ pycodestyle = ["+*",
"-E731", # don't assign lambda
]

[tool.flakeheaven.exceptions."tests/test_fig6.py"]
pycodestyle = ["-E225"]


#############
# Testing #
#############
Expand Down

0 comments on commit 43ceab1

Please sign in to comment.