Skip to content

Commit

Permalink
FIX, DEP: rename function from export_rms_volumetrics to export_volum…
Browse files Browse the repository at this point in the history
…etrics
  • Loading branch information
jcrivenaes authored and ErichSuter committed Sep 26, 2024
1 parent 1114ef3 commit 17cabe2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
6 changes: 3 additions & 3 deletions docs/src/rms_oneliners.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ Example:

.. code-block:: python
from fmu.dataio.export.rms import export_rms_volumetrics
from fmu.dataio.export.rms import export_volumetrics
...
# here 'Geogrid' is the grid model name, and 'geogrid_volumes' is the name of the volume job
outfiles = export_rms_volumetrics(project, "Geogrid", "geogrid_volumes")
outfiles = export_volumetrics(project, "Geogrid", "geogrid_volumes")
print(f"Output volumes to {outfiles}")
Most ``dataio`` settings are here defaulted, but some keys can be altered optionally, e.g.:

.. code-block:: python
outfiles = export_rms_volumetrics(
outfiles = export_volumetrics(
project,
"Geogrid",
"geogrid_volumes",
Expand Down
4 changes: 2 additions & 2 deletions src/fmu/dataio/export/rms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .volumetrics import export_rms_volumetrics
from .volumetrics import export_rms_volumetrics, export_volumetrics

__all__ = ["export_rms_volumetrics"]
__all__ = ["export_volumetrics", "export_rms_volumetrics"]
16 changes: 15 additions & 1 deletion src/fmu/dataio/export/rms/volumetrics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import warnings
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Final
Expand Down Expand Up @@ -191,7 +192,7 @@ def export(self) -> dict[str, str]:
return self._export_volume_table()


def export_rms_volumetrics(
def export_volumetrics(
project: Any,
grid_name: str,
volume_job_name: str,
Expand Down Expand Up @@ -242,3 +243,16 @@ def export_rms_volumetrics(
classification=classification,
workflow=workflow,
).export()


# keep the old name for now but not log (will be removed soon as we expect close to
# zero usage so far)
def export_rms_volumetrics(*args, **kwargs) -> dict[str, str]: # type: ignore
"""Deprecated function. Use export_volumetrics instead."""
warnings.warn(
"export_rms_volumetrics is deprecated and will be removed in a future release. "
"Use export_volumetrics instead.",
FutureWarning,
stacklevel=2,
)
return export_volumetrics(*args, **kwargs)
4 changes: 2 additions & 2 deletions tests/test_export_rms/test_export_rms_volumetrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ def test_rms_volumetrics_export_function(
):
"""Test the public function."""

from fmu.dataio.export.rms import export_rms_volumetrics
from fmu.dataio.export.rms import export_volumetrics

os.chdir(rmssetup_with_fmuconfig)

result = export_rms_volumetrics(mock_project_variable, "Geogrid", "geogrid_volume")
result = export_volumetrics(mock_project_variable, "Geogrid", "geogrid_volume")
vol_table_file = result["volume_table"]

assert Path(vol_table_file).is_file()
Expand Down

0 comments on commit 17cabe2

Please sign in to comment.