Skip to content

Commit

Permalink
Fix bug that when spacing in ECL keyword name
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrivenaes committed Jan 26, 2023
1 parent 2e43638 commit d4bd430
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 2 deletions.
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
numpy<1.24
pyyaml
xtgeo
xtgeo>=2.20.7
fmu-dataio>=1.3.0
xtgeoviz
2 changes: 1 addition & 1 deletion src/xtgeoapp_grd3dmaps/avghc/_compute_avg.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _avg_filesettings(config, zname, pname, mode="root"):
if prefix == "all" and config["output"]["prefix"]:
prefix = config["output"]["prefix"]

xfil = prefix + delim + tag + "average" + "_" + pname
xfil = (prefix + delim + tag + "average" + "_" + pname).replace(" ", "")

if mode == "root":
return xfil
Expand Down
Binary file added tests/data/reek/REEK_LETTERS_W_SPACE.UNRST
Binary file not shown.
37 changes: 37 additions & 0 deletions tests/test_scripts/test_grid3d_average_map4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""Testing suite avg4."""
import pytest
import xtgeo

import xtgeoapp_grd3dmaps.avghc.grid3d_average_map as grid3d_average_map

# =============================================================================
# Do tests
# =============================================================================


def test_average_map4a(datatree):
"""Test AVG with YAML config example 4a ECL w keywords with spaces; based on 2a."""
result = datatree / "map4a_folder"
result.mkdir(parents=True)
dump = result / "avg4a.yml"
grid3d_average_map.main(
[
"--config",
"tests/yaml/avg4a.yml",
"--dump",
str(dump),
"--mapfolder",
str(result),
"--plotfolder",
str(result),
]
)
mymap1 = xtgeo.surface_from_file(
result / "zone2+3--avg4a_average_pressure--19991201.gri"
)
assert mymap1.values.mean() == pytest.approx(336.5236, abs=0.01)

mymap2 = xtgeo.surface_from_file(
result / "zone2+3--avg4a_average_w8f--19991201.gri"
)
assert mymap2.values.mean() == pytest.approx(0.837027, abs=0.01)
60 changes: 60 additions & 0 deletions tests/yaml/avg4a.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
title: Reek
# Allow Eclipse keywords with spaces (e.g. traces i e100, like "W8 F")

input:
eclroot: tests/data/reek/REEK
grid: $eclroot.EGRID

# alternative approach to read a variables and dates:
properties:
- name: PORO
source: $eclroot.INIT
- name: PRESSURE
source: tests/data/reek/REEK_LETTERS_W_SPACE.UNRST
dates: ["19991201"]
- name: "W8 F"
source: tests/data/reek/REEK_LETTERS_W_SPACE.UNRST
dates: ["19991201"]

# For filters, there are properties defined at the same grid layout as
# the grid read in input
#
# If several filters, they will be cumulative.
#
# In this case a ZONE filter is used instead of an explicit "zonation" setting; need
# in most cases to be combined with "prefix" setting under "output"

filters:
- name: PORO
source: $eclroot.INIT
intvrange: [0.0, 1.0] # Filter for a continuous will be an interval
- name: FACIES
discrete: Yes
source: tests/data/reek/reek_sim_facies2.roff
discrange: [2] # Filter for a discrete will be spesic number sequence
- name: Zone
discrete: Yes
source: tests/data/reek/reek_sim_zone.roff
discrange: [2, 3] # Filter for a discrete will be spesic number sequence

computesettings:
zone: No
all: Yes
mask_zeros: Yes # means that ouput maps will be set to undef where zero

# map definition (unrotated maps only, for rotated maps use a maptemplate...)
mapsettings:
xori: 457000
xinc: 50
yori: 5927000
yinc: 50
ncol: 200
nrow: 250

output:
tag: avg4a # the tag will added to file name as extra info, e.g. as
# z1--avg1a_average_poro.gri

prefix: zone2+3 # replace the default 'all' prefix
mapfolder: /tmp
plotfolder: /tmp

0 comments on commit d4bd430

Please sign in to comment.