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

GridViewer with provider #1025

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
1ceb160
Eclipse grid viewer
HansKallekleiv Apr 2, 2022
6b6aed1
dependency
HansKallekleiv Apr 2, 2022
3788dcf
Only send scalars
HansKallekleiv Apr 2, 2022
2fbdeaa
Added cropping
HansKallekleiv Apr 4, 2022
24c1e90
Very hacky, inaccurate way to get readout of selected cell
HansKallekleiv Apr 4, 2022
a25dd47
Use VTK for finding selected cell. Still issues with precision
HansKallekleiv Apr 5, 2022
7e42e37
Add back grid
HansKallekleiv Apr 5, 2022
0f2359e
Unhide inactive cells before picking
HansKallekleiv Apr 5, 2022
3f838db
todo
HansKallekleiv Apr 5, 2022
a5e6995
Colorpreset
HansKallekleiv Apr 5, 2022
df42875
Only show first k layer on startup
HansKallekleiv Apr 5, 2022
ceb5ae4
Use base64 encoding
HansKallekleiv Apr 6, 2022
fdd5e9a
Use float32
HansKallekleiv Apr 6, 2022
28b533e
Fix readout
HansKallekleiv Apr 7, 2022
34160d7
Return first ACTIVE cell, not first cell intersected by ray
HansKallekleiv Apr 7, 2022
bf1be14
Added pick representation
HansKallekleiv Apr 7, 2022
901079d
Use scaled position for glyph placement
HansKallekleiv Apr 7, 2022
911c810
lint
HansKallekleiv Apr 7, 2022
f9a7e0a
Show axes
HansKallekleiv Apr 7, 2022
e5bf5e7
FindsCellsAlongLine returned cells in random order, use IntersectWith…
HansKallekleiv Apr 8, 2022
ff917e4
lint
HansKallekleiv Apr 8, 2022
1090f7c
Set test repo. Add temporary dash-vtk tarball. Add scalarbar. [deploy…
HansKallekleiv Apr 8, 2022
38a0077
lint
HansKallekleiv Apr 8, 2022
1709c98
[deploy test]
HansKallekleiv Apr 8, 2022
7955b35
[deploy test]
HansKallekleiv Apr 8, 2022
1cbcd86
[deploy test]
HansKallekleiv Apr 8, 2022
ca8364b
[deploy test]
HansKallekleiv Apr 8, 2022
6c0cab2
Do not clear pick data if clicking outside the representation
HansKallekleiv Apr 8, 2022
e6391df
Add pyvista dependency to dockerfile
HansKallekleiv Apr 8, 2022
d089f85
Add crop widget
HansKallekleiv Apr 8, 2022
94ea1f5
Fix max dimensions
HansKallekleiv Apr 9, 2022
0743a2c
Use webviz-vtk, and add roff grid reader
HansKallekleiv Apr 11, 2022
4fbb96f
mistake
HansKallekleiv Apr 11, 2022
c398a51
Install webviz_vtk from temporary git location
HansKallekleiv Apr 12, 2022
754d767
Remove pyvista
HansKallekleiv Apr 20, 2022
99f9383
Use 0-based indexing for ijk. Remove additional pyvista code
HansKallekleiv Apr 21, 2022
e8cd1a5
Testing usage of new VTK geometry data from xtgeo
sigurdp Apr 25, 2022
584f605
provider
HansKallekleiv May 7, 2022
f9232db
provider
HansKallekleiv May 11, 2022
9e7e966
realizations
HansKallekleiv May 11, 2022
a48aa17
CI
HansKallekleiv May 11, 2022
5b02cc5
cleanup
HansKallekleiv May 11, 2022
3706c8f
Set fill value
HansKallekleiv May 11, 2022
7694a7d
Fix crop width
HansKallekleiv May 11, 2022
e2e515b
Add grid name to provider id
HansKallekleiv May 11, 2022
7575410
Merge branch 'grid' of github.com:hanskallekleiv/webviz-subsurface in…
HansKallekleiv May 11, 2022
ae4bd1f
Added logging and fixed IJK filtering
sigurdp May 11, 2022
4bd8339
[deploy test]
HansKallekleiv May 11, 2022
ae43b7e
Python 3.6 fixes
sigurdp May 11, 2022
36f214e
Merge branch 'grid' of https://github.com/HansKallekleiv/webviz-subsu…
sigurdp May 11, 2022
65db81f
Implemented GridVizService.ray_pick()
sigurdp May 23, 2022
cafe42b
Compose correct relative path for grid properties
HansKallekleiv May 23, 2022
39e7266
Allow only initial or dynamic properties
HansKallekleiv May 23, 2022
cc6f380
Only reset camera on realization/scale change
HansKallekleiv May 24, 2022
baec9f8
Use RMS style interactions
HansKallekleiv May 24, 2022
95b6471
Experimental impl of cut_along_polyline()
sigurdp May 29, 2022
4b51b14
Added wells
HansKallekleiv May 31, 2022
5a4825c
Add separate view for intersection
HansKallekleiv May 31, 2022
740aa83
Merge branch 'master' of github.com:equinor/webviz-subsurface into grid
HansKallekleiv May 31, 2022
8004838
new grid viewer
HansKallekleiv Jun 1, 2022
59ba281
New plugin using WLF
HansKallekleiv Jun 2, 2022
b7b5e17
Added line plot to compare trajectories
HansKallekleiv Jun 3, 2022
36d6f70
Sync with WLF. Add reset camera
HansKallekleiv Aug 15, 2022
3240a27
Merge remote-tracking branch 'origin/grid' into grid
HansKallekleiv Aug 15, 2022
4347741
Use working webviz-config
HansKallekleiv Aug 15, 2022
b517b2d
Set initial well
HansKallekleiv Aug 16, 2022
5a3f27f
Extract and map property scalars in GridVizService.cut_along_polyline()
sigurdp Aug 19, 2022
e58c33b
Hack to make intersect view appear "flat" and position camera in cent…
sigurdp Aug 22, 2022
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
253 changes: 126 additions & 127 deletions .github/workflows/subsurface.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,142 +10,141 @@ on:
- published
schedule:
# Run CI daily and check that tests are working with latest dependencies
- cron: '0 0 * * *'
- cron: "0 0 * * *"

jobs:
webviz-subsurface:
# Run on all events defined above, except pushes which are neither to master nor with a substring [deploy test] in commit message
if: github.event_name != 'push' || github.ref == 'refs/heads/master' || contains(github.event.head_commit.message, '[deploy test]')
runs-on: ubuntu-latest
env:
PYTHONWARNINGS: default # We want to see e.g. DeprecationWarnings
PYTHONWARNINGS: default # We want to see e.g. DeprecationWarnings
strategy:
fail-fast: false
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]

steps:

- name: 🧹 Remove unused pre-installed software
run: |
# https://github.com/actions/virtual-environments/issues/751
# https://github.com/actions/virtual-environments/issues/709
sudo apt-get purge p7zip* yarn ruby-full ghc* php7*
sudo apt-get autoremove
sudo apt-get clean
df -h

- name: 📖 Checkout commit locally
uses: actions/checkout@v2

- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: 📦 Install webviz-subsurface with dependencies
run: |
pip install --upgrade pip
if [[ $(pip freeze) ]]; then
pip freeze | grep -vw "pip" | xargs pip uninstall -y
fi
pip install "bleach<5" # https://github.com/equinor/webviz-config/issues/586
pip install "werkzeug<2.1" # ...while waiting for https://github.com/plotly/dash/issues/1992
pip install .

# Testing against our latest release (including pre-releases)
# Temporarily do not use prerelase of wsc due to https://github.com/equinor/webviz-subsurface-components/issues/1007
pip install --pre --upgrade webviz-config webviz-core-components # webviz-subsurface-components

- name: 📦 Install test dependencies
run: |
pip install .[tests]
wget https://chromedriver.storage.googleapis.com/$(wget https://chromedriver.storage.googleapis.com/LATEST_RELEASE -q -O -)/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
export PATH=$PATH:$PWD

- name: 🧾 List all installed packages
run: pip freeze

- name: 🕵️ Check code style & linting
run: |
black --check webviz_subsurface tests setup.py
pylint webviz_subsurface tests setup.py
bandit -r -c ./bandit.yml webviz_subsurface tests setup.py
isort --check-only webviz_subsurface tests setup.py
mypy --package webviz_subsurface

- name: 🤖 Run tests
env:
# If you want the CI to (temporarily) run against your fork of the testdada,
# change the value her from "equinor" to your username.
TESTDATA_REPO_OWNER: equinor
# If you want the CI to (temporarily) run against another branch than master,
# change the value her from "master" to the relevant branch name.
TESTDATA_REPO_BRANCH: master
run: |
git clone --depth 1 --branch $TESTDATA_REPO_BRANCH https://github.com/$TESTDATA_REPO_OWNER/webviz-subsurface-testdata.git
# Copy any clientside script to the test folder before running tests
mkdir ./tests/assets && cp ./webviz_subsurface/_assets/js/* ./tests/assets
pytest ./tests --headless --forked --testdata-folder ./webviz-subsurface-testdata
rm -rf ./tests/assets
webviz docs --portable ./docs_build --skip-open

- name: 🐳 Build Docker example image
if: matrix.python-version != '3.7' # https://github.com/statsmodels/statsmodels/issues/8110
run: |
pip install --pre webviz-config-equinor
export SOURCE_URL_WEBVIZ_SUBSURFACE=https://github.com/$GITHUB_REPOSITORY
export GIT_POINTER_WEBVIZ_SUBSURFACE=$GITHUB_REF
webviz build ./webviz-subsurface-testdata/webviz_examples/webviz-full-demo.yml --portable ./example_subsurface_app --theme equinor
rm -rf ./webviz-subsurface-testdata
pushd example_subsurface_app
docker build -t webviz/example_subsurface_image:equinor-theme .
popd

- name: 🐳 Update Docker Hub example image
if: github.event_name != 'schedule' && github.ref == 'refs/heads/master' && matrix.python-version == '3.6'
run: |
echo ${{ secrets.dockerhub_webviz_token }} | docker login --username webviz --password-stdin
docker push webviz/example_subsurface_image:equinor-theme

- name: 🐳 Update review/test Docker example image
if: github.ref != 'refs/heads/master' && contains(github.event.head_commit.message, '[deploy test]') && matrix.python-version == '3.6'
run: |
docker tag webviz/example_subsurface_image:equinor-theme ${{ secrets.review_docker_registry_url }}/${{ secrets.review_container_name }}

echo ${{ secrets.review_docker_registry_token }} | docker login ${{ secrets.review_docker_registry_url }} --username ${{ secrets.review_docker_registry_username }} --password-stdin
docker push ${{ secrets.review_docker_registry_url }}/${{ secrets.review_container_name }}

- name: 🚢 Build and deploy Python package
if: github.event_name == 'release' && matrix.python-version == '3.6'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_webviz_token }}
run: |
python -m pip install --upgrade setuptools wheel twine
python setup.py sdist bdist_wheel
twine upload dist/*

- name: 📚 Update GitHub pages
if: github.event_name == 'release' && matrix.python-version == '3.6'
run: |
cp -R ./docs_build ../docs_build

git config --local user.email "webviz-github-action"
git config --local user.name "webviz-github-action"
git fetch origin gh-pages
git checkout --track origin/gh-pages
git clean -f -f -d -x
git rm -r *

cp -R ../docs_build/* .

git add .

if git diff-index --quiet HEAD; then
echo "No changes in documentation. Skip documentation deploy."
else
git commit -m "Update Github Pages"
git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages
fi
- name: 🧹 Remove unused pre-installed software
run: |
# https://github.com/actions/virtual-environments/issues/751
# https://github.com/actions/virtual-environments/issues/709
sudo apt-get purge p7zip* yarn ruby-full ghc* php7*
sudo apt-get autoremove
sudo apt-get clean
df -h

- name: 📖 Checkout commit locally
uses: actions/checkout@v2

- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: 📦 Install webviz-subsurface with dependencies
run: |
pip install --upgrade pip
if [[ $(pip freeze) ]]; then
pip freeze | grep -vw "pip" | xargs pip uninstall -y
fi
pip install "bleach<5" # https://github.com/equinor/webviz-config/issues/586
pip install "werkzeug<2.1" # ...while waiting for https://github.com/plotly/dash/issues/1992
pip install .

# Testing against our latest release (including pre-releases)
# Temporarily do not use prerelase of wsc due to https://github.com/equinor/webviz-subsurface-components/issues/1007
pip install --pre --upgrade webviz-config webviz-core-components # webviz-subsurface-components

- name: 📦 Install test dependencies
run: |
pip install .[tests]
wget https://chromedriver.storage.googleapis.com/$(wget https://chromedriver.storage.googleapis.com/LATEST_RELEASE -q -O -)/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
export PATH=$PATH:$PWD

- name: 🧾 List all installed packages
run: pip freeze

- name: 🕵️ Check code style & linting
run: |
black --check webviz_subsurface tests setup.py
pylint webviz_subsurface tests setup.py
bandit -r -c ./bandit.yml webviz_subsurface tests setup.py
isort --check-only webviz_subsurface tests setup.py
mypy --package webviz_subsurface

- name: 🤖 Run tests
env:
# If you want the CI to (temporarily) run against your fork of the testdada,
# change the value her from "equinor" to your username.
TESTDATA_REPO_OWNER: hanskallekleiv
# If you want the CI to (temporarily) run against another branch than master,
# change the value her from "master" to the relevant branch name.
TESTDATA_REPO_BRANCH: more-grid
run: |
git clone --depth 1 --branch $TESTDATA_REPO_BRANCH https://github.com/$TESTDATA_REPO_OWNER/webviz-subsurface-testdata.git
# Copy any clientside script to the test folder before running tests
mkdir ./tests/assets && cp ./webviz_subsurface/_assets/js/* ./tests/assets
pytest ./tests --headless --forked --testdata-folder ./webviz-subsurface-testdata
rm -rf ./tests/assets
webviz docs --portable ./docs_build --skip-open

- name: 🐳 Build Docker example image
if: matrix.python-version != '3.7' # https://github.com/statsmodels/statsmodels/issues/8110
run: |
pip install --pre webviz-config-equinor
export SOURCE_URL_WEBVIZ_SUBSURFACE=https://github.com/$GITHUB_REPOSITORY
export GIT_POINTER_WEBVIZ_SUBSURFACE=$GITHUB_REF
webviz build ./webviz-subsurface-testdata/webviz_examples/webviz-full-demo.yml --portable ./example_subsurface_app --theme equinor
rm -rf ./webviz-subsurface-testdata
pushd example_subsurface_app
docker build -t webviz/example_subsurface_image:equinor-theme .
popd

- name: 🐳 Update Docker Hub example image
if: github.event_name != 'schedule' && github.ref == 'refs/heads/master' && matrix.python-version == '3.6'
run: |
echo ${{ secrets.dockerhub_webviz_token }} | docker login --username webviz --password-stdin
docker push webviz/example_subsurface_image:equinor-theme

- name: 🐳 Update review/test Docker example image
if: github.ref != 'refs/heads/master' && contains(github.event.head_commit.message, '[deploy test]') && matrix.python-version == '3.6'
run: |
docker tag webviz/example_subsurface_image:equinor-theme ${{ secrets.review_docker_registry_url }}/${{ secrets.review_container_name }}

echo ${{ secrets.review_docker_registry_token }} | docker login ${{ secrets.review_docker_registry_url }} --username ${{ secrets.review_docker_registry_username }} --password-stdin
docker push ${{ secrets.review_docker_registry_url }}/${{ secrets.review_container_name }}

- name: 🚢 Build and deploy Python package
if: github.event_name == 'release' && matrix.python-version == '3.6'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_webviz_token }}
run: |
python -m pip install --upgrade setuptools wheel twine
python setup.py sdist bdist_wheel
twine upload dist/*

- name: 📚 Update GitHub pages
if: github.event_name == 'release' && matrix.python-version == '3.6'
run: |
cp -R ./docs_build ../docs_build

git config --local user.email "webviz-github-action"
git config --local user.name "webviz-github-action"
git fetch origin gh-pages
git checkout --track origin/gh-pages
git clean -f -f -d -x
git rm -r *

cp -R ../docs_build/* .

git add .

if git diff-index --quiet HEAD; then
echo "No changes in documentation. Skip documentation deploy."
else
git commit -m "Update Github Pages"
git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages
fi
13 changes: 10 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"webviz_config_plugins": [
"BhpQc = webviz_subsurface.plugins:BhpQc",
"DiskUsage = webviz_subsurface.plugins:DiskUsage",
"EclipseGridViewer = webviz_subsurface.plugins:EclipseGridViewer",
"GridViewer = webviz_subsurface.plugins:GridViewer",
"GroupTree = webviz_subsurface.plugins:GroupTree",
"HistoryMatch = webviz_subsurface.plugins:HistoryMatch",
"HorizonUncertaintyViewer = webviz_subsurface.plugins:HorizonUncertaintyViewer",
Expand Down Expand Up @@ -87,6 +89,7 @@
"dash>=2.0.0",
"dash_bootstrap_components>=0.10.3",
"dash-daq>=0.5.0",
# "dash-vtk>=0.0.9",
"dataclasses>=0.8; python_version<'3.7'",
"defusedxml>=0.6.0",
"ecl2df>=0.15.0; sys_platform=='linux'",
Expand All @@ -99,12 +102,16 @@
"pillow>=6.1",
"pyarrow>=5.0.0",
"pyscal>=0.7.5",
"pyvista>=0.33.3",
"scipy>=1.2",
"statsmodels>=0.12.1", # indirect dependency through https://plotly.com/python/linear-fits/
"webviz-config>=0.3.8",
"webviz-core-components>=0.5.6",
"vtk>=9.2.0rc2",
"webviz_config@git+https://github.com/equinor/webviz-config@50f0d20f5b6fd6c2d7ee98b17e229e625776ff82",
"webviz-core-components",
"webviz-subsurface-components>=0.4.12",
"xtgeo>=2.14",
"webviz_vtk@git+https://github.com/equinor/webviz-vtk",
"xtgeo@git+https://github.com/sigurdp/xtgeo/@sigurdp/vtk-esg",
# "xtgeo>=2.18.0a1",
],
extras_require={"tests": TESTS_REQUIRE},
setup_requires=["setuptools_scm~=3.2"],
Expand Down
Empty file.
36 changes: 36 additions & 0 deletions tests/unit_tests/plugin_tests/test_eclipse_grid_viewer/_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# pylint: skip-file
# type: ignore
import numpy as np
import pyvista as pv


def create_explicit_structured_grid(
ni: int, nj: int, nk: int, si: float, sj: float, sk: float
) -> pv.ExplicitStructuredGrid:

si = float(si)
sj = float(sj)
sk = float(sk)

# create raw coordinate grid
grid_ijk = np.mgrid[
: (ni + 1) * si : si, : (nj + 1) * sj : sj, : (nk + 1) * sk : sk
]

# repeat array along each Cartesian axis for connectivity
for axis in range(1, 4):
grid_ijk = grid_ijk.repeat(2, axis=axis)

# slice off unnecessarily doubled edge coordinates
grid_ijk = grid_ijk[:, 1:-1, 1:-1, 1:-1]

# reorder and reshape to VTK order
corners = grid_ijk.transpose().reshape(-1, 3)

dims = np.array([ni, nj, nk]) + 1

grid = pv.ExplicitStructuredGrid(dims, corners)
grid = grid.compute_connectivity()
grid.ComputeFacesConnectivityFlagsArray()

return grid
Loading