Skip to content
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 .github/scripts/pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ tar -czvf everest-tutorials-drogon-well_order.tar.gz ./data/drogon/well_ord
tar -czvf everest-tutorials-drogon-well_rate.tar.gz ./data/drogon/well_rate
tar -czvf everest-tutorials-drogon-well_selection.tar.gz ./data/drogon/well_selection
tar -czvf everest-tutorials-drogon-well_swap.tar.gz ./data/drogon/well_swap
tar -czvf everest-tutorials-drogon-well_trajectory.tar.gz ./data/drogon/well_trajectory
tar -czvf everest-tutorials-drogon-well_trajectory.tar.gz ./data/drogon/well_trajectory
4 changes: 2 additions & 2 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: commit lint

on:
on:
workflow_dispatch:
workflow_call:
push:
Expand All @@ -25,4 +25,4 @@ jobs:
run: npm install @commitlint/{cli,config-conventional}

- name: run commitlint
run: npx commitlint --from=$(git merge-base origin/main HEAD) --to=HEAD
run: npx commitlint --from=$(git merge-base origin/main HEAD) --to=HEAD
16 changes: 8 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
workflow_call:
push:
branches:
branches:
- main

permissions:
Expand All @@ -19,16 +19,16 @@ concurrency:
jobs:
publish:
runs-on: ubuntu-latest

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 0

- name: install uv
uses: astral-sh/setup-uv@v5
Expand All @@ -38,15 +38,15 @@ jobs:

- name: build docs
run: uv run sphinx-build -M html ./docs/source ./docs/build/

- name: setup pages
uses: actions/configure-pages@v5

- name: upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './docs/build/html'

- name: deploy to github pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
if: ${{ steps.release.outputs.release_created }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: .github/scripts/upload.sh ${{ steps.release.outputs.tag_name }}
run: .github/scripts/upload.sh ${{ steps.release.outputs.tag_name }}
41 changes: 41 additions & 0 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Style

on:
push:
branches:
- main
- 'version-**'
pull_request:

jobs:
check-style:
timeout-minutes: 15
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']

steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0

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

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Install with style dependencies
run: |
uv sync --extra style

- name: Run style check
if: ${{ always() }}
run: |
SKIP=no-commit-to-branch uv run pre-commit run --all-files --show-diff-on-failure
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ cython_debug/
# PyPI configuration file
.pypirc

.vscode
.vscode
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
default_install_hook_types: [pre-commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: no-commit-to-branch
- id: check-json
- id: check-yaml
- id: end-of-file-fixer
exclude: ^(docs/|data/)
- id: trailing-whitespace
exclude: ^(docs/|data/)

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.11
hooks:
- id: ruff-check
args: [ --fix ]
- id: ruff-format

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.8.14
hooks:
- id: uv-lock
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ wish to place an anonymous, confidential report we encourage to use the [Equinor
Ethics
helpline](https://secure.ethicspoint.eu/domain/media/en/gui/102166/index.html).

This helpline is hosted by a third party helpline provider.
This helpline is hosted by a third party helpline provider.
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Contributors Guide

Welcome to the **EVEREST™ Tutorials** repository!
We appreciate your interest in contributing to this project.
Welcome to the **EVEREST™ Tutorials** repository!
We appreciate your interest in contributing to this project.

We expect all contributors to adhere to the [Code of Conduct](CODE_OF_CONDUCT.md).
We expect all contributors to adhere to the [Code of Conduct](CODE_OF_CONDUCT.md).
Be respectful and inclusive in all interactions.

Below are the guidelines to help you contribute effectively.
Expand All @@ -21,8 +21,8 @@ Below are the guidelines to help you contribute effectively.

## Introduction

The EVEREST Tutorials repository is focused on providing reproducible tutorials for EVEREST.
This is a documentation-based repository with examples and configuration files that focus on practical usage.
The EVEREST Tutorials repository is focused on providing reproducible tutorials for EVEREST.
This is a documentation-based repository with examples and configuration files that focus on practical usage.
Contributors are welcome to improve the tutorials, fix bugs, and suggest enhancements to the documentation.


Expand Down Expand Up @@ -68,7 +68,7 @@ We enforce this linting all commit and pull request messages using the [commitli

#### Commit Message Format

Each commit message consists of a `header`, a `body` and a `footer`.
Each commit message consists of a `header`, a `body` and a `footer`.
The header has a special format that includes a `type`, a `scope` and a `subject`:

```
Expand All @@ -83,7 +83,7 @@ The `header` and the `subject` are mandatory and the rest are optional.
If there is a `body` you need to add a blank line between the header and the body.
If there is `footer` you need to add a blank line between the body and the footer.

The footer can contain a `close` or `fixes` keyword to link to the issue and close it when the pull request is merged.
The footer can contain a `close` or `fixes` keyword to link to the issue and close it when the pull request is merged.
This behavior is described in [Linking a pull request to an issue using a keyword](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword).

The accepted types follow the [Angular convention](https://github.com/conventional-changelog/commitlint/tree/master/@commitlint/config-conventional#type-enum) and can be:
Expand Down Expand Up @@ -119,7 +119,7 @@ chore(main): release 0.4.1

### Pull Request Guidelines

The format of the pull request message is the same as the commit message.
The format of the pull request message is the same as the commit message.
Ensure your pull request is based on the latest main branch.
Follow the repository's commit message format.
Provide a clear description of the changes in the pull request.
Expand Down
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
# everest-tutorials
EVEREST Tutorials
[![Code Style](https://github.com/equinor/everest-tutorials/actions/workflows/style.yml/badge.svg)](https://github.com/equinor/everest-tutorials/actions/workflows/style.yml)

Everest tutorials



### Style requirements

There are a set of style requirements, which are gathered in the `pre-commit`
configuration, to have it automatically run on each commit do:

```sh
pip install pre-commit
pre-commit install
```

or before each commit do:

```sh
pre-commit run --all-files
```


There is also a pre-push hook configured in `pre-commit` to run a collection of
relatively fast tests, to install this hook:

```sh
pre-commit install --hook-type pre-push
```
2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};
};
3 changes: 1 addition & 2 deletions data/scripts/plot_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@


RESULTS_FILE = (
"optimization_output/ensembles/batch_{batch}/"
"optimizer/realization_controls.parquet"
"optimization_output/ensembles/batch_{batch}/optimizer/realization_controls.parquet"
)
PATH_PLOTS = "docs/source/well_order/images/optimization"
FONTSIZE = 15
Expand Down
36 changes: 3 additions & 33 deletions data/scripts/plot_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def read_summaries(
all_dates_sets = []

for batch_number in batch_numbers:

smspec_files = find_smspec_files(simulation_folder, batch_number)

filtered_files = [
Expand All @@ -68,7 +67,6 @@ def read_summaries(
]

for file_path in filtered_files:

# Load data including production rates and dates
values_npv = summary.df(
ResdataFiles(file_path),
Expand Down Expand Up @@ -116,35 +114,25 @@ def plot_summaries(
percentile = 0.1

color_start = 0.5 # Start from 30% into the colormap to avoid very light colors
color_end = 1.0 # End at the darkest color

batch_colors = [plt.cm.Blues(color_start), "red"]
batch_colors = ["#00B7EB", "#FFFF00"]
batch_colors = ["#58508d", "#ffa600"]

for keyword in keywords_to_be_plotted:

print(f"Plotting: {keyword}")

fig, ax = plt.subplots(figsize=(16, 9))
_, ax = plt.subplots(figsize=(16, 9))
max_means = []

for batch_index, batch in enumerate(batch_numbers):

if data_accumulator[batch][keyword]:
# Concatenate and filter the data
combined_data = pd.concat(
data_accumulator[batch][keyword], ignore_index=True
)
combined_data = combined_data[combined_data["DATE"].isin(common_dates)]

# Group and calculate min/max
min_max_grouped = (
combined_data.groupby("DATE")[keyword]
.agg(["min", "max"])
.reset_index()
)

if not combined_data.empty:
combined_data.set_index("DATE", inplace=True)
combined_data.sort_index(inplace=True)
Expand All @@ -156,8 +144,6 @@ def plot_summaries(
mean_10_curve = combined_data.groupby(level=0)[keyword].quantile(
percentile
)
max_mean_10_curve = max(mean_10_curve)
max_mean_90_curve = max(mean_90_curve)
max_mean_curve = max(mean_curve)
max_means.append((batch_index, max_mean_curve))
if keyword.startswith(("FWIT", "WWIR")):
Expand Down Expand Up @@ -215,30 +201,16 @@ def plot_summaries(
label=label,
)

if len(batch_numbers) == 1:

a = 1
else:
if len(batch_numbers) != 1:
## if error, most prob. eclipse keyword or date not present in eclipse output
try:
if max_means[0][1] == 0:
continue
else:
percentage_change = abs(max_means[1][1] - max_means[0][1])
if max_means[1][1] < max_means[0][1]:
pre_sign = "+"
else:
pre_sign = ""
# print("percentage_change", percentage_change)
except IndexError:
print(
"Plot will remain blank. Most probably, KEYWORD or DATE not present"
)

max_means_str = ", ".join(
f"Batch {idx}: {mean:,.1f}" for idx, mean in max_means
)

ax.set_title(f"{keyword}", fontsize=24, fontweight="bold")
ax.set_xlabel("Date", fontsize=26, fontweight="bold")
ax.set_ylabel(
Expand Down Expand Up @@ -286,9 +258,7 @@ def plot_summaries(

casename = "wo"
simulation_folder = (
"../optimization/drogon/well_order/everest/output/"
"WELLORDER_EXP"
"/simulation_output/"
"../optimization/drogon/well_order/everest/output/WELLORDER_EXP/simulation_output/"
)
plots_folder = "docs/source/well_order/images/production/"

Expand Down
Loading