diff --git a/src/calliope/preprocess/data_sources.py b/src/calliope/preprocess/data_sources.py index f11bb668..8b47ed84 100644 --- a/src/calliope/preprocess/data_sources.py +++ b/src/calliope/preprocess/data_sources.py @@ -5,6 +5,7 @@ import logging from collections.abc import Hashable from pathlib import Path +import warnings import numpy as np import pandas as pd @@ -154,7 +155,7 @@ def node_dict(self, techs_incl_inheritance: AttrDict) -> AttrDict: techs_incl_inheritance[tech].get("base_tech", None) == "transmission" ): - self._raise_error( + self._raise_warning( "Cannot define transmission technology data over the `nodes` dimension" ) else: @@ -361,6 +362,10 @@ def _check_processed_tdf(self, tdf: pd.Series): if len(unique_index_names) != len(tdf.index.names): self._raise_error(f"Duplicate dimension names found: {tdf.index.names}") + def _raise_warning(self, message): + """Format warning message and then raise Calliope ModelWarning.""" + warnings.warn(self.MESSAGE_TEMPLATE.format(name=self.name, message=message), exceptions.ModelWarning) + def _raise_error(self, message): """Format error message and then raise Calliope ModelError.""" raise exceptions.ModelError(