Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename from ecl2df to res2df #1253

Merged
merged 6 commits into from
Jan 25, 2024
Merged
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- [#1183](https://github.com/equinor/webviz-subsurface/pull/1183) - Reduced loading time by lazy loading only requested plugins when application starts.
- [#1182](https://github.com/equinor/webviz-subsurface/pull/1182) - `ParameterResponseCorrelation` can now allow default None column_keys when using arrow file as input
- [#1122](https://github.com/equinor/webviz-subsurface/pull/1122) - `opm` and `ecl2df` are now optional, making `windows-subsurface` possible to install and import on non-unix based systems. **NOTE:** a lot of the functionality in `webviz-subsurface` is built on `opm` and `ecl2df`, and issues are therefore expected on eg Windows and macOS. Use with care.
- [#1122](https://github.com/equinor/webviz-subsurface/pull/1122) - `opm` and `res2df` are now optional, making `windows-subsurface` possible to install and import on non-unix based systems. **NOTE:** a lot of the functionality in `webviz-subsurface` is built on `opm` and `res2df`, and issues are therefore expected on eg Windows and macOS. Use with care.
- [#1146](https://github.com/equinor/webviz-subsurface/pull/1146) - Converted the `BhpQc` plugin to WLF (Webviz Layout Framework).
- [#1184](https://github.com/equinor/webviz-subsurface/pull/1184) - `WellAnalysis`: changes to the settings layout in the `WellOverview` view

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"dash_bootstrap_components>=0.10.3",
"dash-daq>=0.5.0",
"defusedxml>=0.6.0",
"ecl2df>=0.15.0; sys_platform=='linux'",
"res2df>=1.0; sys_platform=='linux'",
"flask-caching",
"fmu-ensemble>=1.2.3",
"fmu-tools>=1.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pandas as pd

# The fmu.ensemble dependency ecl is only available for Linux,
# The fmu.ensemble dependency resdata is only available for Linux,
# hence, ignore any import exception here to make
# it still possible to use the PvtPlugin on
# machines with other OSes.
Expand Down
2 changes: 1 addition & 1 deletion webviz_subsurface/_datainput/fmu_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from webviz_config.common_cache import CACHE
from webviz_config.webviz_store import webvizstore

# The fmu.ensemble dependency ecl is only available for Linux,
# The fmu.ensemble dependency resdata is only available for Linux,
# hence, ignore any import exception here to make
# it still possible to use the PvtPlugin on
# machines with other OSes.
Expand Down
2 changes: 1 addition & 1 deletion webviz_subsurface/_datainput/history_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from webviz_config.common_cache import CACHE
from webviz_config.webviz_store import webvizstore

# The fmu.ensemble dependency ecl is only available for Linux,
# The fmu.ensemble dependency resdata is only available for Linux,
# hence, ignore any import exception here to make
# it still possible to use the PvtPlugin on
# machines with other OSes.
Expand Down
20 changes: 10 additions & 10 deletions webviz_subsurface/_datainput/pvt_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
import numpy as np
import pandas as pd

# opm and ecl2df are only available for Linux,
# opm and res2df are only available for Linux,
# hence, ignore any import exception here to make
# it still possible to use the PvtPlugin on
# machines with other OSes.
#
# NOTE: Functions in this file cannot be used
# on non-Linux OSes.
try:
import ecl2df
import res2df
from opm.io.ecl import EclFile
except ImportError:
pass
Expand Down Expand Up @@ -202,10 +202,10 @@ def load_pvt_dataframe(
) -> pd.DataFrame:
# pylint: disable=too-many-statements

def check_if_ecl2df_is_installed() -> None:
# If ecl2df is not loaded, this machine is probably not
def check_if_res2df_is_installed() -> None:
# If res2df is not loaded, this machine is probably not
# running Linux and the modules are not available.
if "ecl2df" not in sys.modules:
if "res2df" not in sys.modules:
raise ModuleNotFoundError(
"Your operating system does not support opening and reading"
" Eclipse files. An empty data frame will be returned and your"
Expand All @@ -214,14 +214,14 @@ def check_if_ecl2df_is_installed() -> None:
" to display PVT data anyways."
)

def ecl2df_pvt_data_frame(kwargs: Any) -> pd.DataFrame:
check_if_ecl2df_is_installed()
return ecl2df.pvt.df(kwargs["realization"].get_eclfiles())
def res2df_pvt_data_frame(kwargs: Any) -> pd.DataFrame:
check_if_res2df_is_installed()
return res2df.pvt.df(kwargs["realization"].get_eclfiles())

def init_to_pvt_data_frame(kwargs: Any) -> pd.DataFrame:
# pylint: disable-msg=too-many-locals
# pylint: disable=too-many-branches
check_if_ecl2df_is_installed()
check_if_res2df_is_installed()
ecl_init_file = EclFile(
kwargs["realization"].get_eclfiles().get_initfile().get_filename()
)
Expand Down Expand Up @@ -400,7 +400,7 @@ def init_to_pvt_data_frame(kwargs: Any) -> pd.DataFrame:

return filter_pvt_data_frame(
load_ensemble_set(ensemble_paths, ensemble_set_name).apply(
init_to_pvt_data_frame if use_init_file else ecl2df_pvt_data_frame
init_to_pvt_data_frame if use_init_file else res2df_pvt_data_frame
),
drop_ensemble_duplicates,
)
8 changes: 4 additions & 4 deletions webviz_subsurface/_datainput/relative_permeability.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .fmu_input import load_ensemble_set

try:
import ecl2df
import res2df
except ImportError:
pass

Expand All @@ -22,10 +22,10 @@ def load_satfunc(
ensemble_paths: dict,
ensemble_set_name: str = "EnsembleSet",
) -> pd.DataFrame:
def ecl2df_satfunc(kwargs: Any) -> pd.DataFrame:
return ecl2df.satfunc.df(kwargs["realization"].get_eclfiles())
def res2df_satfunc(kwargs: Any) -> pd.DataFrame:
return res2df.satfunc.df(kwargs["realization"].get_eclfiles())

return load_ensemble_set(ensemble_paths, ensemble_set_name).apply(ecl2df_satfunc)
return load_ensemble_set(ensemble_paths, ensemble_set_name).apply(res2df_satfunc)


@webvizstore
Expand Down
8 changes: 4 additions & 4 deletions webviz_subsurface/_datainput/well_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

import pandas as pd

# opm and ecl2df are only available for Linux,
# opm and res2df are only available for Linux,
# hence, ignore any import exception here to make
# it still possible to use the PvtPlugin on
# machines with other OSes.
#
# NOTE: Functions in this file cannot be used
# on non-Linux OSes.
try:
from ecl2df import EclFiles, common
from res2df.resdatafiles import ResdataFiles, common
except ImportError:
pass

Expand Down Expand Up @@ -44,7 +44,7 @@ def read_zone_layer_mapping(
) -> pd.DataFrame:
"""Searches for all zone->layer mapping files for an ensemble. \
The files should be on lyr format and can be parsed using functionality \
from ecl2df.
from res2df.
The results are returned as a dataframe with the following columns:
* REAL
Expand Down Expand Up @@ -157,7 +157,7 @@ def get_ecl_unit_system(ensemble_path: str) -> Optional[str]:
datafile = get_ecl_datafile(ensemble_path)
if datafile is None:
return None
ecl_deck = EclFiles(datafile).get_ecldeck()
ecl_deck = ResdataFiles(datafile).get_deck()
for keyword in ecl_deck:
if keyword.name in ["METRIC", "FIELD", "LAB", "PVT-M"]:
return keyword.name
Expand Down
2 changes: 1 addition & 1 deletion webviz_subsurface/_models/ensemble_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from webviz_config.common_cache import CACHE
from webviz_config.webviz_store import webvizstore

# The fmu.ensemble dependency ecl is only available for Linux,
# The fmu.ensemble dependency resdata is only available for Linux,
# hence, ignore any import exception here to make
# it still possible to use the PvtPlugin on
# machines with other OSes.
Expand Down
2 changes: 1 addition & 1 deletion webviz_subsurface/_models/gruptree_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def read_ensemble_gruptree(
self, df_files: Optional[pd.DataFrame] = None
) -> pd.DataFrame:
"""Reads the gruptree files for an ensemble from the scratch disk. These
files can be exported in the FMU workflow using the ECL2CSV
files can be exported in the FMU workflow using the RES2CSV
forward model with subcommand gruptree.
If tree_type == BRANPROP then GRUPTREE rows are filtered out
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pathlib import Path
from typing import Dict, List, Optional

# The fmu.ensemble dependency ecl is only available for Linux,
# The fmu.ensemble dependency resdata is only available for Linux,
# hence, ignore any import exception here to make
# it still possible to use the PvtPlugin on
# machines with other OSes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ def create_vector_metadata_from_field_meta(
"""Create VectorMetadata from keywords stored in the field's metadata"""

# Note that when we query the values in the field.metadata we always get byte strings
# back from pyarrow. Further, ecl2df writes all the values as strings, so we must
# back from pyarrow. Further, res2df writes all the values as strings, so we must
# convert these to the correct types before creating the VectorMetadata instance.
# See also ecl2df code:
# https://github.com/equinor/ecl2df/blob/0e30fb8046bf17fd338bb468584985c5d816e2f6/ecl2df/summary.py#L441
# See also res2df code:
# https://github.com/equinor/res2df/blob/0e30fb8046bf17fd338bb468584985c5d816e2f6/ecl2df/summary.py#L441

# Currently, based on the ecl2df code, we assume that all keys except for 'get_num'
# Currently, based on the res2df code, we assume that all keys except for 'get_num'
# and 'wgname' must be present in order to return a valid metadata object
# https://github.com/equinor/ecl2df/blob/0e30fb8046bf17fd338bb468584985c5d816e2f6/ecl2df/summary.py#L541-L552
# https://github.com/equinor/res2df/blob/0e30fb8046bf17fd338bb468584985c5d816e2f6/ecl2df/summary.py#L541-L552

meta_dict = field.metadata
if not meta_dict:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

import datacompy # pylint: disable=import-error, useless-suppression
import dateutil.parser # type: ignore
import ecl2df
import numpy as np
import pandas as pd
import res2df
from fmu.ensemble import ScratchEnsemble

from .ensemble_summary_provider import Frequency
Expand Down Expand Up @@ -92,14 +92,14 @@ def _load_smry_dataframe_using_fmu(
return df


def _load_smry_dataframe_using_ecl2df(
def _load_smry_dataframe_using_res2df(
ens_path: str, frequency: Optional[Frequency]
) -> pd.DataFrame:
time_index: str = "raw"
if frequency:
time_index = frequency.value

print(f"## Loading data into DataFrame using ECL2DF time_index={time_index}...")
print(f"## Loading data into DataFrame using res2df time_index={time_index}...")

realidxregexp = re.compile(r"realization-(\d+)")
globpattern = os.path.join(ens_path, "eclipse/model/*.UNSMRY")
Expand All @@ -122,8 +122,8 @@ def _load_smry_dataframe_using_ecl2df(

print(f"R={real}: {smry_file}")

eclfiles = ecl2df.EclFiles(smry_file.replace(".UNSMRY", ""))
real_df = ecl2df.summary.df(eclfiles, time_index=time_index)
eclfiles = res2df.resdatafiles.ResdataFiles(smry_file.replace(".UNSMRY", ""))
real_df = res2df.summary.df(eclfiles, time_index=time_index)
real_df.insert(0, "REAL", real)
real_df.index.name = "DATE"
per_real_df_arr.append(real_df)
Expand Down Expand Up @@ -277,7 +277,7 @@ def main() -> None:
print("## Loading data into reference DataFrame...")
# Note that for version 2.13.0 and earlier of ecl, loading via FMU will not give the
# correct results. This was remedied in https://github.com/equinor/ecl/pull/837
# reference_df = _load_smry_dataframe_using_ecl2df(ensemble_path, frequency)
# reference_df = _load_smry_dataframe_using_res2df(ensemble_path, frequency)
reference_df = _load_smry_dataframe_using_fmu(ensemble_path, frequency)

print("## Comparing get_vectors()...")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pathlib import Path
from typing import Dict, List, Optional

# The fmu.ensemble dependency ecl is only available for Linux,
# The fmu.ensemble dependency resdata is only available for Linux,
# hence, ignore any import exception here to make
# it still possible to use the PvtPlugin on
# machines with other OSes.
Expand Down
6 changes: 3 additions & 3 deletions webviz_subsurface/plugins/_group_tree/_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class GroupTree(WebvizPluginABC):
`gruptree_file` is a path to a file stored per realization (e.g. in \
`share/results/tables/gruptree.csv"`).
The `gruptree_file` file can be dumped to disk per realization by the `ECL2CSV` forward
model with subcommand `gruptree`. The forward model uses `ecl2df` to export a table
The `gruptree_file` file can be dumped to disk per realization by the `RES2CSV` forward
model with subcommand `gruptree`. The forward model uses `res2df` to export a table
representation of the Eclipse network:
[Link to ecl2csv gruptree documentation.](https://equinor.github.io/ecl2df/usage/gruptree.html).
[Link to res2csv gruptree documentation.](https://equinor.github.io/res2df/usage/gruptree.html).
**time_index**
Expand Down
2 changes: 1 addition & 1 deletion webviz_subsurface/plugins/_parameter_analysis/_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ParameterAnalysis(WebvizPluginABC):
and the resampling dropdown will be disabled.
---
?> `Arrow` format for simulation time series data can be generated using the `ECL2CSV` forward \
?> `Arrow` format for simulation time series data can be generated using the `RES2CSV` forward \
model in ERT. On existing ensembles the command line tool `smry2arrow_batch` can be used to \
generate arrow files.
Expand Down
2 changes: 1 addition & 1 deletion webviz_subsurface/plugins/_prod_misfit/_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ProdMisfit(WebvizPluginABC):
This plugin needs the following summary vectors to be stored with arrow format:
* WOPT+WOPTH and/or WWPT+WWPTH and/or WGPT+WGPTH
Summary files can be converted to arrow format with the `ECL2CSV` forward model.
Summary files can be converted to arrow format with the `RES2CSV` forward model.
`well_attributes_file`: Optional json file with well attributes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class PropertyStatistics(WebvizPluginABC):

---

?> `Arrow` format for simulation time series data can be generated using the `ECL2CSV` forward \
?> `Arrow` format for simulation time series data can be generated using the `RES2CSV` forward \
model in ERT. On existing ensembles the command line tool `smry2arrow_batch` can be used to \
generate arrow files.

Expand Down Expand Up @@ -143,7 +143,7 @@ def __init__(
except ValueError as error:
message = (
f"Some/all ensembles are missing arrow files at {rel_file_pattern}.\n"
"If no arrow files have been generated with `ERT` using `ECL2CSV`, "
"If no arrow files have been generated with `ERT` using `RES2CSV`, "
"the commandline tool `smry2arrow_batch` can be used to generate arrow "
"files for an ensemble"
)
Expand Down
8 changes: 4 additions & 4 deletions webviz_subsurface/plugins/_pvt_plot/_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class PvtPlot(WebvizPluginABC):
The minimum requirement is to define `ensembles`.
If no `pvt_relative_file_path` is given, the PVT data will be extracted automatically
from the simulation decks of individual realizations using `fmu_ensemble` and `ecl2df`.
from the simulation decks of individual realizations using `fmu_ensemble` and `res2df`.
If the `read_from_init_file` flag is set to True, the extraction procedure in
`ecl2df` will be replaced by an individual extracting procedure that reads the
`res2df` will be replaced by an individual extracting procedure that reads the
normalized Eclipse INIT file.
Note that the latter two extraction methods can be very slow for larger data and are therefore
not recommended unless you have a very simple model/data deck.
Expand All @@ -56,7 +56,7 @@ class PvtPlot(WebvizPluginABC):
* One column named `VISCOSITY` as the second covariate.
The file can e.g. be dumped to disc per realization by a forward model in ERT using
`ecl2df`.
`res2df`.
"""

class Ids(StrEnum):
Expand Down Expand Up @@ -110,7 +110,7 @@ def __init__(
raise ValueError(
(
"There has to be a KEYWORD or TYPE column with corresponding Eclipse keyword."
"When not providing a csv file, make sure ecl2df is installed."
"When not providing a csv file, make sure res2df is installed."
)
)

Expand Down
10 changes: 5 additions & 5 deletions webviz_subsurface/plugins/_relative_permeability.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class RelativePermeability(WebvizPluginABC):
The minimum requirement is to define `ensembles`.

If no `relpermfile` is defined, the relative permeability data will be extracted automatically
from the simulation decks of individual realizations using `fmu-ensemble`and `ecl2df` behind the
from the simulation decks of individual realizations using `fmu-ensemble`and `res2df` behind the
scenes. Note that this method can be very slow for larger data decks, and is therefore not
recommended unless you have a very simple model/data deck.

Expand All @@ -59,10 +59,10 @@ class RelativePermeability(WebvizPluginABC):
* One column **per** capillary pressure curve (e.g. `PCOW`).

The `relpermfile` file can e.g. be dumped to disk per realization by a forward model in ERT that
wraps the command `ecl2csv satfunc input_file -o output_file` (requires that you have `ecl2df`
wraps the command `res2csv satfunc input_file -o output_file` (requires that you have `res2df`
installed). A typical example could be:
`ecl2csv satfunc eclipse/include/props/relperm.inc -o share/results/tables/relperm.csv`.
[Link to ecl2csv satfunc documentation.](https://equinor.github.io/ecl2df/scripts.html#satfunc)
`res2csv satfunc eclipse/include/props/relperm.inc -o share/results/tables/relperm.csv`.
[Link to res2csv satfunc documentation.](https://equinor.github.io/res2df/scripts.html#satfunc)


`scalfile` is a path to __a single file of SCAL recommendations__ (for all
Expand Down Expand Up @@ -257,7 +257,7 @@ def __init__(
):
raise ValueError(
"Unrecognized saturation table keyword in data. This should not occur unless "
"there has been changes to ecl2df. Update of this plugin might be required."
"there has been changes to res2df. Update of this plugin might be required."
)
else:
self.family = 2
Expand Down
2 changes: 1 addition & 1 deletion webviz_subsurface/plugins/_rft_plotter/_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class RftPlotter(WebvizPluginABC):
01_drogon_ahm/realization-0/iter-0/share/results/tables/rft_ert.csv).
* **`rft.csv`**: A csv file containing simulated RFT data extracted from ECLIPSE RFT output files \
using [ecl2df](https://equinor.github.io/ecl2df/ecl2df.html#module-ecl2df.rft) \
using [res2df](https://equinor.github.io/res2df/res2df.html#module-res2df.rft) \
[(example file)](https://github.com/equinor/webviz-subsurface-testdata/blob/master/\
01_drogon_ahm/realization-0/iter-0/share/results/tables/rft.csv). \
Simulated RFT data can be visualized along MD if a "CONMD" column is present in \
Expand Down
2 changes: 1 addition & 1 deletion webviz_subsurface/plugins/_vfp_analysis/_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class VfpAnalysis(WebvizPluginABC):
---
The plugin uses an `.arrow` representation of the VFP curves, which can be exported to disk by
using the `ECL2CSV` forward model in ERT with subcommand `vfp`.
using the `RES2CSV` forward model in ERT with subcommand `vfp`.
So far, the plugin only vizualizes VFPPROD curves, but the plan is to extend it also to
VFPINJ curves soon.
Expand Down
Loading
Loading