Skip to content

Commit

Permalink
Add axis_name to __repr__
Browse files Browse the repository at this point in the history
  • Loading branch information
ecomodeller committed Oct 25, 2024
1 parent fcb93a2 commit 290d003
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mikeio/spatial/_grid_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ def default_dims(self) -> tuple[str, ...]:

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

def __str__(self) -> str:
return f"Grid1D (n={self.nx}, dx={self.dx:.4g})"
Expand Down Expand Up @@ -1139,10 +1142,11 @@ def __init__(
origin: tuple[float, float] = (0.0, 0.0),
orientation: float = 0.0,
) -> None:
"""Create equidistant 3D spatial geometry
"""Create equidistant 3D spatial geometry.
Parameters
----------
x : array_like, optional
x coordinates of cell centers
x0 : float, optional
Expand Down Expand Up @@ -1173,6 +1177,7 @@ def __init__(
user-defined origin, by default (0.0, 0.0)
orientation : float, optional
rotation angle in degrees, by default 0.0
"""
super().__init__(projection=projection)
self._origin = (0.0, 0.0) if origin is None else (origin[0], origin[1])
Expand Down

0 comments on commit 290d003

Please sign in to comment.