Skip to content

Commit

Permalink
Merge pull request #758 from DHI/mesh_repr
Browse files Browse the repository at this point in the history
FM reprs, nodes before elements
  • Loading branch information
ecomodeller authored Nov 22, 2024
2 parents 8a7f514 + fb57792 commit daf0dc3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions mikeio/dfsu/_layered.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ def __init__(self, filename: str | Path) -> None:
self._items = self._read_items(self._filename)

def __repr__(self) -> str:
out = [f"<mikeio.{self.__class__.__name__}>"]

out.append(f"number of elements: {self.geometry.n_elements}")
out.append(f"number of nodes: {self.geometry.n_nodes}")
out.append(f"projection: {self.geometry.projection_string}")
out.append(f"number of sigma layers: {self.geometry.n_sigma_layers}")
out = [
f"<mikeio.{self.__class__.__name__}>"
f"number of nodes: {self.geometry.n_nodes}",
f"number of elements: {self.geometry.n_elements}",
f"projection: {self.geometry.projection_string}",
f"number of sigma layers: {self.geometry.n_sigma_layers}",
]
if (
self._type == DfsuFileType.DfsuVerticalProfileSigmaZ
or self._type == DfsuFileType.Dfsu3DSigmaZ
Expand Down
2 changes: 1 addition & 1 deletion mikeio/dfsu/_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def _read_header(self, filename: str | Path) -> GeometryFM2D:
def __repr__(self) -> str:
out = [
"<Mesh>",
f"number of elements: {self.n_elements}",
f"number of nodes: {self.n_nodes}",
f"number of elements: {self.n_elements}",
f"projection: {self.geometry.projection_string}",
]
return str.join("\n", out)
Expand Down
2 changes: 1 addition & 1 deletion mikeio/dfsu/_spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def __repr__(self) -> str:
out = [f"<mikeio.{self.__class__.__name__}>"]

if self._type is not DfsuFileType.DfsuSpectral0D:
out.append(f"number of nodes: {self.geometry.n_nodes}")
if self._type is not DfsuFileType.DfsuSpectral1D:
out.append(f"number of elements: {self.geometry.n_elements}")
out.append(f"number of nodes: {self.geometry.n_nodes}")
if self.geometry.is_spectral:
if self.geometry.n_directions > 0:
out.append(f"number of directions: {self.geometry.n_directions}")
Expand Down

0 comments on commit daf0dc3

Please sign in to comment.