Skip to content

Commit

Permalink
Merge pull request #773 from DHI/missing_class_docstrings
Browse files Browse the repository at this point in the history
Added missing class level one-line summary docstring.
  • Loading branch information
ecomodeller authored Jan 14, 2025
2 parents 98d4bc6 + 4b77f23 commit d385382
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 3 deletions.
2 changes: 2 additions & 0 deletions mikeio/dataset/_data_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,8 @@ def __init__(self, da: DataArray) -> None:


class _DatasetPlotter:
"""Class for plotting scatter plots from datasets."""

def __init__(self, ds: Dataset) -> None:
self.ds = ds

Expand Down
2 changes: 2 additions & 0 deletions mikeio/dfs/_dfs0.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def _write_dfs0(


class Dfs0:
"""Class for reading/writing dfs0 files."""

def __init__(self, filename: str | Path):
"""Create a Dfs0 object for reading, writing.
Expand Down
2 changes: 2 additions & 0 deletions mikeio/dfs/_dfs1.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def _write_dfs1_header(filename: str | Path, ds: Dataset, title: str) -> DfsFile


class Dfs1(_Dfs123):
"""Class for reading/writing dfs1 files."""

_ndim = 1

def __init__(self, filename: str | Path) -> None:
Expand Down
2 changes: 2 additions & 0 deletions mikeio/dfs/_dfs2.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def _write_dfs2_spatial_axis(


class Dfs2(_Dfs123):
"""Class for reading/writing dfs2 files."""

_ndim = 2

def __init__(
Expand Down
2 changes: 2 additions & 0 deletions mikeio/dfs/_dfs3.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def _write_dfs3_header(filename: str | Path, ds: Dataset, title: str) -> DfsFile


class Dfs3(_Dfs123):
"""Class for reading/writing dfs3 files."""

_ndim = 3

def __init__(self, filename: str | Path):
Expand Down
2 changes: 2 additions & 0 deletions mikeio/dfsu/_dfsu.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ def _get_dfsu_info(filename: str | Path) -> _DfsuInfo:


class Dfsu2DH:
"""Class for reading/writing dfsu 2d horizontal files."""

show_progress = False

def __init__(self, filename: str | Path) -> None:
Expand Down
2 changes: 2 additions & 0 deletions mikeio/dfsu/_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ def dfsu(filename: str | Path) -> Any:


class Dfsu:
"""Factory class for dfsu files."""

def __new__(self, filename: str | Path) -> Any:
return dfsu(filename)
4 changes: 4 additions & 0 deletions mikeio/dfsu/_layered.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ def append(self, ds: Dataset, validate: bool = True) -> None:


class Dfsu2DV(DfsuLayered):
"""Class for reading/writing dfsu 2d vertical files."""

def plot_vertical_profile(
self,
values: np.ndarray | DataArray,
Expand Down Expand Up @@ -465,6 +467,8 @@ def plot_vertical_profile(


class Dfsu3D(DfsuLayered):
"""Class for reading/writing dfsu 3d files."""

@property
def geometry2d(self) -> GeometryFM2D:
"""The 2d geometry for a 3d object."""
Expand Down
2 changes: 2 additions & 0 deletions mikeio/dfsu/_spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@


class DfsuSpectral:
"""Dfsu for Spectral data."""

show_progress = False

def __init__(self, filename: str | Path) -> None:
Expand Down
2 changes: 1 addition & 1 deletion mikeio/eum/_eum.py
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ def __repr__(self) -> str:


class ItemInfo:
"""ItemInfo.
"""Info for dynamicc items (variables).
Parameters
----------
Expand Down
2 changes: 2 additions & 0 deletions mikeio/pfs/_pfssection.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class PfsNonUniqueList(list):


class PfsSection(SimpleNamespace, MutableMapping[str, Any]):
"""Class for reading/writing sections in a pfs file."""

@staticmethod
def from_dataframe(df: pd.DataFrame, prefix: str) -> "PfsSection":
"""Create a PfsSection from a DataFrame.
Expand Down
2 changes: 2 additions & 0 deletions mikeio/spatial/_FM_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,8 @@ def __eq__(self, value: Any) -> bool:


class GeometryFM2D(_GeometryFM):
"""Flexible 2d mesh geometry."""

def __init__(
self,
node_coordinates: np.ndarray,
Expand Down
4 changes: 4 additions & 0 deletions mikeio/spatial/_FM_geometry_layered.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,8 @@ def _calc_dz(self) -> np.ndarray:


class GeometryFM3D(_GeometryFMLayered):
"""Flexible 3d mesh geometry."""

def __init__(
self,
*,
Expand Down Expand Up @@ -708,6 +710,8 @@ def find_index(


class GeometryFMVerticalProfile(_GeometryFMLayered):
"""Flexible mesh 2d vertical profile geometry."""

def __init__(
self,
node_coordinates: np.ndarray,
Expand Down
6 changes: 6 additions & 0 deletions mikeio/spatial/_FM_geometry_spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@


class GeometryFMPointSpectrum(_Geometry):
"""Flexible mesh point spectrum."""

def __init__(
self,
frequencies: np.ndarray | None = None,
Expand Down Expand Up @@ -126,6 +128,8 @@ def directions(self) -> np.ndarray | None:

# TODO reconsider inheritance to avoid overriding method signature
class GeometryFMAreaSpectrum(_GeometryFMSpectrum):
"""Flexible mesh area spectrum geometry."""

def isel( # type: ignore
self, idx: Sequence[int], **kwargs: Any
) -> "GeometryFMPointSpectrum" | "GeometryFMAreaSpectrum":
Expand Down Expand Up @@ -178,6 +182,8 @@ def elements_to_geometry( # type: ignore

# TODO this inherits indirectly from GeometryFM2D, which is not ideal
class GeometryFMLineSpectrum(_GeometryFMSpectrum):
"""Flexible mesh line spectrum geometry."""

def isel( # type: ignore
self, idx: Sequence[int], axis: str = "node"
) -> GeometryFMPointSpectrum | GeometryFMLineSpectrum:
Expand Down
6 changes: 4 additions & 2 deletions mikeio/spatial/_grid_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def _print_axis_txt(name: str, x: np.ndarray, dx: float) -> str:

@dataclass
class Grid1D(_Geometry):
"""1D grid (node-based)."""

_dx: float
_nx: int
_x0: float
Expand All @@ -89,9 +91,9 @@ def __init__(
node_coordinates: np.ndarray | None = None,
axis_name: str = "x",
):
"""1D grid (node-based).
"""Create a Grid1D.
axis is increasing and equidistant
The axis is increasing and equidistant
Parameters
----------
Expand Down

0 comments on commit d385382

Please sign in to comment.