Skip to content

Commit 0675325

Browse files
committed
New geom.at_z method
1 parent 4061c41 commit 0675325

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

stagpy/_step.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ def threed(self):
163163
"""Whether the grid is 3 dimensional."""
164164
return not self.twod
165165

166+
def at_z(self, zval):
167+
"""Return iz closest to given zval position.
168+
169+
This is different than radial position in spherical geometry.
170+
"""
171+
return np.argmin(np.abs(self.z_coord - zval))
172+
173+
166174
def __getattr__(self, attr):
167175
# provide nDtot, D_coord, D_mesh and nbtot
168176
# with D = x, y, z or t, p, r

0 commit comments

Comments
 (0)