Skip to content

Commit

Permalink
Rename from container (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
anders-kiaer authored Jan 8, 2020
1 parent 7e41ad0 commit b6244d9
Show file tree
Hide file tree
Showing 21 changed files with 110 additions and 78 deletions.
32 changes: 16 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@

setup(
name="webviz-subsurface",
description="Webviz config containers for subsurface data",
description="Webviz config plugins for subsurface data",
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
url="https://github.com/equinor/webviz-subsurface",
author="R&T Equinor",
packages=find_packages(exclude=["tests"]),
package_data={"webviz_subsurface": ["_abbreviations/*.json"]},
entry_points={
"webviz_config_containers": [
"ParameterDistribution = webviz_subsurface.containers:ParameterDistribution",
"ParameterCorrelation = webviz_subsurface.containers:ParameterCorrelation",
"webviz_config_plugins": [
"ParameterDistribution = webviz_subsurface.plugins:ParameterDistribution",
"ParameterCorrelation = webviz_subsurface.plugins:ParameterCorrelation",
"ParameterResponseCorrelation = "
+ "webviz_subsurface.containers:ParameterResponseCorrelation",
"DiskUsage = webviz_subsurface.containers:DiskUsage",
"SubsurfaceMap = webviz_subsurface.containers:SubsurfaceMap",
"HistoryMatch = webviz_subsurface.containers:HistoryMatch",
"Intersect = webviz_subsurface.containers:Intersect",
"MorrisPlot = webviz_subsurface.containers:MorrisPlot",
"InplaceVolumes = webviz_subsurface.containers:InplaceVolumes",
"InplaceVolumesOneByOne = webviz_subsurface.containers:InplaceVolumesOneByOne",
+ "webviz_subsurface.plugins:ParameterResponseCorrelation",
"DiskUsage = webviz_subsurface.plugins:DiskUsage",
"SubsurfaceMap = webviz_subsurface.plugins:SubsurfaceMap",
"HistoryMatch = webviz_subsurface.plugins:HistoryMatch",
"Intersect = webviz_subsurface.plugins:Intersect",
"MorrisPlot = webviz_subsurface.plugins:MorrisPlot",
"InplaceVolumes = webviz_subsurface.plugins:InplaceVolumes",
"InplaceVolumesOneByOne = webviz_subsurface.plugins:InplaceVolumesOneByOne",
"ReservoirSimulationTimeSeries = "
+ "webviz_subsurface.containers:ReservoirSimulationTimeSeries",
+ "webviz_subsurface.plugins:ReservoirSimulationTimeSeries",
"ReservoirSimulationTimeSeriesOneByOne = "
+ "webviz_subsurface.containers:ReservoirSimulationTimeSeriesOneByOne",
"SegyViewer = webviz_subsurface.containers:SegyViewer",
"WellCrossSection = webviz_subsurface.containers:WellCrossSection",
+ "webviz_subsurface.plugins:ReservoirSimulationTimeSeriesOneByOne",
"SegyViewer = webviz_subsurface.plugins:SegyViewer",
"WellCrossSection = webviz_subsurface.plugins:WellCrossSection",
]
},
install_requires=[
Expand Down
4 changes: 2 additions & 2 deletions tests/integration_tests/test_parameter_corr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import dash
import pandas as pd
from webviz_config.common_cache import CACHE
from webviz_config.containers import ParameterCorrelation
from webviz_config.plugins import ParameterCorrelation

# mocked functions
get_parameters = "webviz_subsurface.containers._parameter_correlation.get_parameters"
get_parameters = "webviz_subsurface.plugins._parameter_correlation.get_parameters"


def test_parameter_corr(dash_duo):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/test_surface_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import dash
from dash.dependencies import Input, Output
import dash_html_components as html
from webviz_subsurface._private_containers.surface_selector import SurfaceSelector
from webviz_subsurface._private_plugins.surface_selector import SurfaceSelector


surface_context = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
class TornadoPlot:
"""### TornadoPlot
This private container visualizes a Tornado plot.
It is meant to be used as a component in other containers.
The container is initialized with a dataframe of realizations with corresponding sensitivities,
This private plugin visualizes a Tornado plot.
It is meant to be used as a component in other plugin, and is initialized
with a dataframe of realizations with corresponding sensitivities,
but without the response values that are to be plotted.
Instead the container registers a dcc.Store which will contain the response values.
Instead we registers a dcc.Store which will contain the response values.
To use:
1. Initialize an instance of this class in a container
2. Add tornadoplot.layout to the container layout
1. Initialize an instance of this class in a plugin.
2. Add tornadoplot.layout to the plugin layout
3. Register a callback that writes a json dump to tornadoplot.storage_id
The format of the json dump must be:
{'ENSEMBLE': name of ensemble,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""### _Subsurface specific containers_
"""### _Subsurface specific plugins_
These are containers relevant within subsurface workflows. Most of them
These are plugins relevant within subsurface workflows. Most of them
rely on the setting `scratch_ensemble` configuration within the
`container_settings`.
`plugin_settings`.
I.e. you could have
```yaml
title: Reek Webviz Demonstration
Expand All @@ -16,7 +16,7 @@
- title: Front page
content:
- container: ReservoirSimulationTimeSeries
- plugin: ReservoirSimulationTimeSeries
ensembles:
- iter-0
- iter-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,25 @@
from dash.dependencies import Input, Output
from webviz_config.webviz_store import webvizstore
from webviz_config.common_cache import CACHE
from webviz_config import WebvizContainerABC
from webviz_config import WebvizPluginABC


class DiskUsage(WebvizContainerABC):
class DiskUsage(WebvizPluginABC):
"""### Disk usage
This container adds functionality for standard visualization of disk usage in
FMU projects. It adds a dashboard element where the user can choose between
Adds functionality for standard visualization of disk usage in FMU projects.
It adds a dashboard element where the user can choose between
showing disk usage, per user, either as a pie chart or as a bar chart.
* `scratch_dir`: Path to the directory you want to show disk usage for, e.g.
`/scratch/fmu`.
* `title`: Optional title for the container.
* `title`: Optional title for the plugin.
"""

def __init__(self, app, scratch_dir: str):

super().__init__()

self.scratch_dir = scratch_dir
self.chart_id = "chart-id-{}".format(uuid4())
self.plot_type_id = "plot-type-id-{}".format(uuid4())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@
from scipy.stats import chi2
import dash_html_components as html
import webviz_subsurface_components as wsc
from webviz_config import WebvizContainerABC
from webviz_config import WebvizPluginABC

from .._datainput.history_match import extract_mismatch


class HistoryMatch(WebvizContainerABC):
class HistoryMatch(WebvizPluginABC):
"""### History match
This container visualizes the quality of the history match.
Visualizes the quality of the history match.
* `ensembles`: List of the ensembles in `shared_settings` to visualize.
* `observation_File`: Path to the observation `.yaml` file.
* `title`: Optional title for the container.
* `title`: Optional title for the plugin.
"""

def __init__(self, app, ensembles, observation_file: Path):

super().__init__()

self.observation_file = observation_file
self.ens_paths = {
ens: app.webviz_settings["shared_settings"]["scratch_ensembles"][ens]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@
import webviz_core_components as wcc
from webviz_config.common_cache import CACHE
from webviz_config.webviz_store import webvizstore
from webviz_config import WebvizContainerABC
from webviz_config import WebvizPluginABC

from .._datainput.inplace_volumes import extract_volumes
from .._abbreviations import VOLUME_TERMINOLOGY


class InplaceVolumes(WebvizContainerABC):
class InplaceVolumes(WebvizPluginABC):
"""### InplaceVolumes
This container visualizes inplace volumetrics results from
This plugin visualizes inplace volumetrics results from
FMU ensembles.
Input can be given either as aggregated csv files for volumes or or as an ensemble name
defined in *container_settings* and volumetric csv files stored per realizations.
defined in *plugin_settings* and volumetric csv files stored per realizations.
#### Volumetric input
Expand Down Expand Up @@ -78,6 +78,9 @@ def __init__(
volfolder: str = "share/results/volumes",
response: str = "STOIIP_OIL",
):

super().__init__()

self.csvfile = csvfile if csvfile else None
self.colorway = app.webviz_settings.get("plotly_layout", {}).get("colorway", [])
if csvfile and ensembles:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
import dash_core_components as dcc
from dash.dependencies import Input, Output, State
import webviz_core_components as wcc
from webviz_config import WebvizContainerABC
from webviz_config import WebvizPluginABC
from webviz_config.common_cache import CACHE
from webviz_config.webviz_store import webvizstore

from .._private_containers.tornado_plot import TornadoPlot
from .._private_plugins.tornado_plot import TornadoPlot
from .._datainput.inplace_volumes import extract_volumes
from .._datainput.fmu_input import get_realizations
from .._abbreviations import VOLUME_TERMINOLOGY


class InplaceVolumesOneByOne(WebvizContainerABC):
class InplaceVolumesOneByOne(WebvizPluginABC):
# pylint: disable=too-many-instance-attributes
"""### InplaceVolumesOneByOne
Expand Down Expand Up @@ -104,6 +104,8 @@ def __init__(
response: str = "STOIIP_OIL",
):

super().__init__()

self.csvfile_vol = csvfile_vol if csvfile_vol else None
self.csvfile_reals = csvfile_reals if csvfile_reals else None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
from dash.dependencies import Input, Output, State
from dash_table import DataTable
from webviz_config.common_cache import CACHE
from webviz_config import WebvizContainerABC
from webviz_config import WebvizPluginABC

from .._datainput.fmu_input import scratch_ensemble
from .._datainput.intersect import load_surface, get_wfence, get_hfence


class Intersect(WebvizContainerABC):
class Intersect(WebvizPluginABC):
"""### Intersect
This container visualizes surfaces intersected along a well path.
This plugin visualizes surfaces intersected along a well path.
The input are surfaces from a FMU ensemble stored on standardized
format with standardized naming (share/results/maps/name--category.gri)
and a folder of well files stored in RMS well format.
Expand Down Expand Up @@ -65,16 +65,18 @@ class Intersect(WebvizContainerABC):
def __init__(
self,
app,
container_settings,
plugin_settings,
ensemble,
well_path,
surface_cat,
surface_names,
well_suffix=".rmswell",
):

super().__init__()

self.well_path = well_path
self.ensemble_path = container_settings["scratch_ensembles"][ensemble]
self.ensemble_path = plugin_settings["scratch_ensembles"][ensemble]
self.ensemble = scratch_ensemble(ensemble, self.ensemble_path)
self.well_suffix = well_suffix
self.surface_cat = surface_cat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,25 @@
from webviz_subsurface_components import Morris
from webviz_config.webviz_store import webvizstore
from webviz_config.common_cache import CACHE
from webviz_config import WebvizContainerABC
from webviz_config import WebvizPluginABC


class MorrisPlot(WebvizContainerABC):
class MorrisPlot(WebvizPluginABC):
"""### Morris
This container renders a visualization of the Morris sampling method.
Renders a visualization of the Morris sampling method.
The Morris method can be used to screen parameters for how they
influence model response, both individually and through interaction
effect with other parameters.
* `csv_file`: Input data
* `title`: Optional title for the container.
* `title`: Optional title for the plugin.
"""

def __init__(self, app, csv_file: Path):

super().__init__()

self.graph_id = "graph-{}".format(uuid4())
self.vector_id = "vector-{}".format(uuid4())
self.csv_file = csv_file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from dash.dependencies import Input, Output
from webviz_config.webviz_store import webvizstore
from webviz_config.common_cache import CACHE
from webviz_config import WebvizContainerABC
from webviz_config import WebvizPluginABC

from .._datainput.fmu_input import scratch_ensemble

Expand All @@ -24,10 +24,10 @@ def dropdown_from_dict(dom_id, dictionary):
)


class ParameterCorrelation(WebvizContainerABC):
class ParameterCorrelation(WebvizPluginABC):
"""### Parameter correlation
This container shows parameter correlation using a correlation matrix,
Shows parameter correlation using a correlation matrix,
and scatter plot for any given pair of parameters.
* `ensembles`: Which ensembles in `shared_settings` to visualize.
Expand All @@ -36,6 +36,8 @@ class ParameterCorrelation(WebvizContainerABC):

def __init__(self, app, ensembles, drop_constants: bool = True):

super().__init__()

self.ensembles = {
ens: app.webviz_settings["shared_settings"]["scratch_ensembles"][ens]
for ens in ensembles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
import dash_html_components as html
import dash_core_components as dcc
import webviz_core_components as wcc
from webviz_config import WebvizContainerABC
from webviz_config import WebvizPluginABC
from webviz_config.common_cache import CACHE
from webviz_config.webviz_store import webvizstore

from .._datainput.fmu_input import load_parameters


class ParameterDistribution(WebvizContainerABC):
class ParameterDistribution(WebvizPluginABC):
"""### ParameterDistribution
This container shows parameter distributions for FMU ensembles.
Shows parameter distributions for FMU ensembles.
Parameters are visualized per ensemble as a histogram, and as a boxplot showing
the parameter ranges for each ensemble.
Input can be given either as an aggregated csv files with parameter information
Expand All @@ -31,6 +31,8 @@ class ParameterDistribution(WebvizContainerABC):

def __init__(self, app, csvfile: Path = None, ensembles: list = None):

super().__init__()

self.csvfile = csvfile if csvfile else None

if csvfile and ensembles:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
import webviz_core_components as wcc
from webviz_config.webviz_store import webvizstore
from webviz_config.common_cache import CACHE
from webviz_config import WebvizContainerABC
from webviz_config import WebvizPluginABC

from .._datainput.fmu_input import load_parameters, load_csv


class ParameterResponseCorrelation(WebvizContainerABC):
class ParameterResponseCorrelation(WebvizPluginABC):
"""### Parameter and response correlation
This container shows correlation between numerical input parameters and responses.
This plugin shows correlation between numerical input parameters and responses.
Input can be given either as:
Expand Down Expand Up @@ -68,6 +68,8 @@ def __init__(
corr_method: str = "pearson",
):

super().__init__()

self.parameter_csv = parameter_csv if parameter_csv else None
self.response_csv = response_csv if response_csv else None
self.response_file = response_file if response_file else None
Expand Down
Loading

0 comments on commit b6244d9

Please sign in to comment.