Skip to content

Commit

Permalink
Merge branch 'main' into dfs-slim
Browse files Browse the repository at this point in the history
  • Loading branch information
ecomodeller authored Mar 1, 2024
2 parents e2ac907 + eeae08a commit f3c7dbf
Show file tree
Hide file tree
Showing 17 changed files with 461 additions and 1,506 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ build: typecheck test
lint:
ruff .

pylint:
pylint --disable=all --enable=attribute-defined-outside-init mikeio/

test:
pytest --disable-warnings

Expand Down
9 changes: 0 additions & 9 deletions mikeio/_spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ def plot_2dspectrum(
Returns
-------
<matplotlib.axes>
Examples
--------
>>> dfs = Dfsu("area_spectrum.dfsu")
>>> ds = dfs.read(items="Energy density")
>>> spectrum = ds[0][0, 0, :, :] # first timestep, element 0
>>> dfs.plot_spectrum(spectrum, plot_type="patch")
>>> dfs.plot_spectrum(spectrum, rmax=9, title="Wave spectrum T<9s")
"""

import matplotlib.pyplot as plt
Expand Down
5 changes: 4 additions & 1 deletion mikeio/dataset/_dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ def __call__(self, tail: bool = True) -> "DataArray":
item = ItemInfo(EUMType.Significant_wave_height)
g = self.da.geometry
if isinstance(g, GeometryFMPointSpectrum):
geometry: Any = GeometryPoint2D(x=g.x, y=g.y)
if g.x is not None and g.y is not None:
geometry: Any = GeometryPoint2D(x=g.x, y=g.y)
else:
geometry = GeometryUndefined()
elif isinstance(g, GeometryFMLineSpectrum):
geometry = Grid1D(
nx=g.n_nodes,
Expand Down
4 changes: 2 additions & 2 deletions mikeio/dataset/_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1883,9 +1883,9 @@ def _to_dfs1(self, filename: str | Path) -> None:
write_dfs1(filename=filename, ds=self)

def _to_dfsu(self, filename: str | Path) -> None:
from ..dfsu._dfsu import _write_dfsu
from ..dfsu import write_dfsu

_write_dfsu(filename, self)
write_dfsu(filename, self)

def to_xarray(self) -> "xarray.Dataset":
"""Export to xarray.Dataset"""
Expand Down
4 changes: 2 additions & 2 deletions mikeio/dfsu/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ._dfsu import _write_dfsu, Dfsu2DH
from ._dfsu import write_dfsu, Dfsu2DH
from ._mesh import Mesh
from ._factory import Dfsu
from ._layered import Dfsu2DV, Dfsu3D
Expand All @@ -7,7 +7,7 @@
__all__ = [
"Mesh",
"Dfsu",
"_write_dfsu",
"write_dfsu",
"Dfsu2DH",
"Dfsu2DV",
"Dfsu3D",
Expand Down
Loading

0 comments on commit f3c7dbf

Please sign in to comment.