Skip to content

Commit

Permalink
Reintroduce grid_model key for backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrivenaes authored Sep 1, 2022
1 parent a9c8df9 commit c13e9ca
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/fmu/dataio/dataio.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ class ExportData:
Use with care and avoid if possible! (*) For absolute paths, the class
variable allow_forcefolder_absolute must set to True.
grid_model: Currently allowed but planned for deprecation
include_index: This applies to Pandas (table) data only, and if True then the
index column will be exported. Deprecated, use class variable
``table_include_index`` instead
Expand Down Expand Up @@ -437,6 +439,7 @@ class ExportData:
description: Union[str, list] = ""
fmu_context: str = "realization"
forcefolder: str = ""
grid_model: Optional[str] = None
is_observation: bool = False
is_prediction: bool = True
name: str = ""
Expand Down Expand Up @@ -503,12 +506,19 @@ def __post_init__(self):
logger.info("Ran __post_init__")

def _show_deprecations_or_notimplemented(self):
"""Warn on deprecated keys og on stuff not implemented yet."""
"""Warn on deprecated keys or on stuff not implemented yet."""

if self.runpath:
warn(
"The 'runpath' key has currently no function. It will be evaluated for "
"removal in fmu-dataio version 1. Use 'casepath' instead!",
"removal in fmu-dataio version 2. Use 'casepath' instead!",
PendingDeprecationWarning,
)

if self.grid_model:
warn(
"The 'grid_model' key has currently no function. It will be evaluated "
"for removal in fmu-dataio version 2.",
PendingDeprecationWarning,
)

Expand Down
6 changes: 6 additions & 0 deletions tests/test_units/test_dataio.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ def test_update_check_settings_shall_fail(globalconfig1):
PendingDeprecationWarning,
r"The 'runpath' key has currently no function",
),
(
"grid_model",
"some",
PendingDeprecationWarning,
r"The 'grid_model' key has currently no function",
),
],
)
def test_deprecated_keys(globalconfig1, regsurf, key, value, wtype, expected_msg):
Expand Down

0 comments on commit c13e9ca

Please sign in to comment.