Skip to content

Commit

Permalink
feat: raise if realization 'output_root' is set. close #151
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraney committed Aug 14, 2024
1 parent 54a3318 commit fcd04d1
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion python/ngen_cal/src/ngen/cal/ngen.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ def check_for_partitions(cls, values: dict):
@root_validator
def _validate_model(cls, values: dict) -> dict:
NgenBase._verify_hydrofabric(values)
realization: Optional[NgenRealization] = values.get("ngen_realization")
NgenBase._verify_ngen_realization(realization)
return values

@staticmethod
Expand Down Expand Up @@ -322,7 +324,29 @@ def _verify_hydrofabric(values: dict) -> None:
if cats is not None or nex is not None or x is not None:
warnings.warn("GeoJSON support will be deprecated in a future release, use geopackage hydrofabric.", DeprecationWarning)

return values
@staticmethod
def _verify_ngen_realization(realization: Optional[NgenRealization]) -> None:
"""
Verify `ngen_realization` uses supported features.
Args:
realization: maybe an `NgenRealization` instance
Raises:
UnsupportedFeatureError: If `realization.output_root` is not None.
Feature not supported.
Returns:
None
"""
if realization is None:
return None

if realization.output_root is not None:
from .errors import UnsupportedFeatureError
raise UnsupportedFeatureError(
"ngen realization `output_root` field is not supported by ngen.cal. will be removed in future; see https://github.com/NOAA-OWP/ngen-cal/issues/150"
)

def update_config(self, i: int, params: 'pd.DataFrame', id: str = None, path=Path("./")):
"""_summary_
Expand Down

0 comments on commit fcd04d1

Please sign in to comment.