Skip to content

Commit

Permalink
Merge branch 'master' into pvt_gor_bug
Browse files Browse the repository at this point in the history
  • Loading branch information
anders-kiaer committed May 23, 2023
2 parents 9d0300c + 3e3472c commit 7cd5a85
Show file tree
Hide file tree
Showing 35 changed files with 8,788 additions and 260 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UNRELEASED] - YYYY-MM-DD

### Added
- [#1217](https://github.com/equinor/webviz-subsurface/pull/1217) - New plugin `SimulationTimeSeriesOneByOne`, meant to replace the old `ReservoirSimulationTimeSeriesOneByOne`. Uses the `.arrow` summary provider and is implemented with WLF (Webviz Layout Framework).


## [0.2.19] - 2023-05-05

### Changed

- [#1211](https://github.com/equinor/webviz-subsurface/pull/1211) - `RftPlotter`: Parameter response view always displayed, also for sensitivity ensembles. Instead it is now possible to filter on SENSNAME.

### Added
- [#1207](https://github.com/equinor/webviz-subsurface/pull/1207) - New functionality in `ParameterAnalysis`: observations, resampling frequency and sensitivity filter.

## [0.2.18] - 2023-04-12

### Changed
Expand All @@ -17,7 +30,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- [#1199](https://github.com/equinor/webviz-subsurface/pull/1199) - Added more statistical options to the WellOverview tab in `WellAnalysis`, and the possibility to see injection rates.
- [#1207](https://github.com/equinor/webviz-subsurface/pull/1207) - New functionality in `ParameterAnalysis`: observations, resampling frequency and sensitivity filter.

## [0.2.17] - 2023-01-18

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"SegyViewer = webviz_subsurface.plugins._segy_viewer:SegyViewer",
"SeismicMisfit = webviz_subsurface.plugins._seismic_misfit:SeismicMisfit",
"SimulationTimeSeries = webviz_subsurface.plugins._simulation_time_series:SimulationTimeSeries",
"SimulationTimeSeriesOneByOne = webviz_subsurface.plugins._simulation_time_series_onebyone:SimulationTimeSeriesOneByOne",
"StructuralUncertainty = webviz_subsurface.plugins._structural_uncertainty:StructuralUncertainty",
"SubsurfaceMap = webviz_subsurface.plugins._subsurface_map:SubsurfaceMap",
"SurfaceViewerFMU = webviz_subsurface.plugins._surface_viewer_fmu:SurfaceViewerFMU",
Expand Down Expand Up @@ -96,7 +97,7 @@
"fmu-tools>=1.8",
"geojson>=2.5.0",
"jsonschema>=3.2.0",
"opm>=2020.10.1; sys_platform=='linux'",
"opm>=2020.10.1,<=2022.10; sys_platform=='linux'",
"pandas>=1.1.5,<2.0",
"pillow>=6.1",
"pyarrow>=5.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import warnings

# pylint: disable=no-name-in-module
from webviz_config.plugins import SimulationTimeSeriesOneByOne
from webviz_config.testing import WebvizComposite


def test_simulation_timeseries_onebyone(
_webviz_duo: WebvizComposite, shared_settings: dict
) -> None:
plugin = SimulationTimeSeriesOneByOne(
webviz_settings=shared_settings["SENS_SETTINGS"],
ensembles=shared_settings["SENS_ENSEMBLES"],
initial_vector="FOPT",
)
_webviz_duo.start_server(plugin)
logs = []
for log in _webviz_duo.get_logs():
if "dash_renderer" in log.get("message"):
warnings.warn(log.get("message"))
else:
logs.append(log)
assert not logs
2 changes: 2 additions & 0 deletions webviz_subsurface/_components/tornado/_tornado_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(
lambda x: str(len(x))
)
self._table["Response"] = tornado_data.response_name
self._table["Reference"] = tornado_data.reference_average
self._table.rename(
columns={
"sensname": "Sensitivity",
Expand Down Expand Up @@ -64,6 +65,7 @@ def columns(self) -> List[Dict]:
"True high",
"Low #reals",
"High #reals",
"Reference",
]
]

Expand Down
41 changes: 41 additions & 0 deletions webviz_subsurface/plugins/_map_viewer_fmu/_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import base64
import io
import math
from typing import List

from PIL import Image, ImageDraw


def round_to_significant(val: float, sig: int = 4) -> float:
"""Roud a number to a specified number of significant digits."""
if val == 0:
return 0
return round(val, sig - int(math.floor(math.log10(abs(val)))) - 1)


def rgb_to_hex(color: List[int]) -> str:
"""Convert an RGB color to a hex string."""
return f"#{color[1]:02x}{color[2]:02x}{color[3]:02x}"


def image_to_base64(img: Image) -> str:
"""Convert an image to a base64 string."""
buffer = io.BytesIO()
img.save(buffer, format="PNG")
buffer.seek(0)
return base64.b64encode(buffer.read()).decode("utf-8")


def create_colormap_image_string(
colors: List, width: int = 100, height: int = 20
) -> str:
"""Create a colormap image and return it as a base64 string."""
img = Image.new("RGB", (width, height))
draw = ImageDraw.Draw(img)

for i, color in enumerate(colors):
x_0 = int(i / len(colors) * width)
x_1 = int((i + 1) / len(colors) * width)
draw.rectangle([(x_0, 0), (x_1, height)], fill=rgb_to_hex(color))

return f"data:image/png;base64,{image_to_base64(img)}"
Loading

0 comments on commit 7cd5a85

Please sign in to comment.