Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions imod/common/interfaces/iagnosticpackage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from abc import abstractmethod

from imod.common.interfaces.ipackagebase import IPackageBase
from imod.typing import GridDataArray


class IAgnosticPackage(IPackageBase):
"""
Interface for packages for which the data is defined independent of the domain definition.
"""

@abstractmethod
def to_mf6_pkg(
self,
idomain: GridDataArray,
top: GridDataArray,
bottom: GridDataArray,
k: GridDataArray,
validate: bool = False,
strict_validation: bool = True,
) -> IPackageBase:
raise NotImplementedError
4 changes: 2 additions & 2 deletions imod/common/interfaces/ilinedatapackage.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from abc import abstractmethod
from typing import TYPE_CHECKING

from imod.common.interfaces.ipackagebase import IPackageBase
from imod.common.interfaces.iagnosticpackage import IAgnosticPackage

if TYPE_CHECKING:
import geopandas as gpd


class ILineDataPackage(IPackageBase):
class ILineDataPackage(IAgnosticPackage):
"""
Interface for packages for which the data is defined by lines independent of the domain definition.
"""
Expand Down
5 changes: 5 additions & 0 deletions imod/common/interfaces/ipackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ def _is_regridding_supported(self) -> bool:
@abstractmethod
def _is_grid_agnostic_package(self) -> bool:
raise NotImplementedError

@property
@abc.abstractmethod
def pkg_id(self) -> str:
raise NotImplementedError
4 changes: 2 additions & 2 deletions imod/common/interfaces/ipointdatapackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import numpy as np
from numpy.typing import NDArray

from imod.common.interfaces.ipackagebase import IPackageBase
from imod.common.interfaces.iagnosticpackage import IAgnosticPackage


class IPointDataPackage(IPackageBase):
class IPointDataPackage(IAgnosticPackage):
"""
Interface for packages for which the data is defined by x and y coordinates independent of the domain definition.
"""
Expand Down
7 changes: 4 additions & 3 deletions imod/mf6/hfb.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ def to_netcdf(

"""
kwargs.update({"encoding": self._netcdf_encoding()})
kwargs.update({"format": "NETCDF4"})

new = deepcopy(self)
new.dataset["geometry"] = new.line_data.to_json()
Expand Down Expand Up @@ -713,7 +714,7 @@ def to_mf6_pkg(
bottom: GridDataArray,
k: GridDataArray,
validate=True,
strict_hfb_validation=True,
strict_validation=True,
) -> Mf6HorizontalFlowBarrier:
"""
Write package to Modflow 6 package.
Expand All @@ -734,7 +735,7 @@ def to_mf6_pkg(
Grid with hydraulic conductivities.
validate: bool
Validate HorizontalFlowBarrier upon calling this method.
strict_hfb_validation: bool
strict_validation: bool
Turn on strict horizontal flow barrier validation.

Returns
Expand All @@ -743,7 +744,7 @@ def to_mf6_pkg(
Low level representation of the HFB package as MODFLOW 6 expects it.
"""
validation_context = ValidationSettings(
validate=validate, strict_hfb_validation=strict_hfb_validation
validate=validate, strict_hfb_validation=strict_validation
)

return self._to_mf6_pkg(idomain, top, bottom, k, validation_context)
Expand Down
Loading