Skip to content

Commit 290d003

Browse files
committed
Add axis_name to __repr__
1 parent fcb93a2 commit 290d003

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

mikeio/spatial/_grid_geometry.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ def default_dims(self) -> tuple[str, ...]:
148148

149149
def __repr__(self) -> str:
150150
out = ["<mikeio.Grid1D>", _print_axis_txt("x", self.x, self.dx)]
151-
return "\n".join(out)
151+
txt = "\n".join(out)
152+
if self._axis_name != "x":
153+
txt = txt.replace(")", f", axis_name='{self._axis_name}')")
154+
return txt
152155

153156
def __str__(self) -> str:
154157
return f"Grid1D (n={self.nx}, dx={self.dx:.4g})"
@@ -1139,10 +1142,11 @@ def __init__(
11391142
origin: tuple[float, float] = (0.0, 0.0),
11401143
orientation: float = 0.0,
11411144
) -> None:
1142-
"""Create equidistant 3D spatial geometry
1145+
"""Create equidistant 3D spatial geometry.
11431146
11441147
Parameters
11451148
----------
1149+
11461150
x : array_like, optional
11471151
x coordinates of cell centers
11481152
x0 : float, optional
@@ -1173,6 +1177,7 @@ def __init__(
11731177
user-defined origin, by default (0.0, 0.0)
11741178
orientation : float, optional
11751179
rotation angle in degrees, by default 0.0
1180+
11761181
"""
11771182
super().__init__(projection=projection)
11781183
self._origin = (0.0, 0.0) if origin is None else (origin[0], origin[1])

0 commit comments

Comments
 (0)