-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to generate new petro logs from original logs (#264)
Added test and testdata Add documentation
- Loading branch information
Showing
8 changed files
with
582 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
rms.create_bw_per_facies | ||
============================ | ||
|
||
The RMS python job to generate new blocked wells with petrophysical | ||
values for one facies per blocked well log is used as part of a workflow | ||
to create petrophysical 3D grid realizations conditioned to only one facies. | ||
This is used in FMU workflows where both facies and petrophysical variables | ||
are used as field parameters in assisted history matching (AHM) with ERT. | ||
|
||
Input | ||
|
||
* Grid name | ||
* Existing blocked well set (containing the original blocked well logs) | ||
* List of original petrophysical blocked well log names to be used to generate new logs | ||
* Facies log name | ||
* Python dictionary with code and facies names per code for relevant facies | ||
|
||
Output | ||
|
||
For each of the specified original petrophysical logs, one new log per facies | ||
for the specified facies is made. The values are copies of the original blocked | ||
well logs except that all values belonging to other facies than the one for the | ||
created log is set to undefined. The new logs will have name of | ||
the form "faciesname_petroname". | ||
|
||
Example of use as RMS python job | ||
--------------------------------- | ||
|
||
.. code-block:: python | ||
from fmu.tools.rms import create_bw_per_facies | ||
from fmu.config import utilities as ut | ||
DEBUG_PRINT = False | ||
CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml")["global"] | ||
FACIES_ZONE = CFG["FACIES_ZONE"] | ||
GRID_NAMES = { | ||
"Valysar": "Geogrid_Valysar", | ||
"Therys": "Geogrid_Therys", | ||
"Volon": "Geogrid_Volon", | ||
} | ||
# Blocked well set | ||
BW_NAME = "BW" | ||
# Original logs to make copy of per facies | ||
ORIGINAL_BW_LOG_NAMES = ["PHIT", "KLOGH"] | ||
# Facies log in original blocked well set | ||
FACIES_LOG_NAME = "Facies" | ||
def main(project): | ||
for zone_name, facies_code_names_for_zone in FACIES_ZONE.items(): | ||
# For each of the single zone grids, calculate updated BW set | ||
create_bw_per_facies( | ||
project, | ||
GRID_NAMES[zone_name], | ||
BW_NAME, | ||
ORIGINAL_BW_LOG_NAMES, | ||
FACIES_LOG_NAME, | ||
FACIES_ZONE[zone_name], | ||
debug_print=DEBUG_PRINT) | ||
if __name__ == "__main__": | ||
main(project) | ||
The example above will create the following new blocked well logs for | ||
each well based on the original logs "PHIT" and "KLOGH": | ||
|
||
* Floodplain_PHIT | ||
* Floodplain_KLOGH | ||
* Channel_PHIT | ||
* Channel_KLOGH | ||
* Crevasse_PHIT | ||
* Crevasse_KLOGH | ||
* Coal_PHIT | ||
* Coal_KLOGH | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import copy | ||
from typing import Dict, List | ||
|
||
import numpy as np | ||
import xtgeo | ||
|
||
|
||
def create_bw_per_facies( | ||
project, | ||
grid_name: str, | ||
bw_name: str, | ||
original_petro_log_names: List[str], | ||
facies_log_name: str, | ||
facies_code_names: Dict[int, str], | ||
debug_print: bool = False, | ||
) -> None: | ||
"""Function to be imported and applied in a RMS python job | ||
to create new petrophysical logs from original logs, | ||
but with one log per facies. | ||
All grid blocks for the blocked wells not belonging to the facies | ||
is set to undefined. | ||
Purpose: | ||
Create the blocked well logs to be used to condition | ||
petrophysical realizations where all grid cells are | ||
assumed to belong to only one facies. This script will | ||
not modify any of the original logs, only create new logs where only | ||
petrophysical log values for one facies is selected | ||
and all other are set ot undefined. | ||
Input: | ||
grid model name, | ||
blocked well set name, | ||
list of original log names to use, | ||
facies log name, | ||
facies code with facies name dictionary | ||
Output: | ||
One new petro log per facies per petro variables in the | ||
input list of original log names. The output will be saved in | ||
the given blocked well set specified in the input. | ||
""" | ||
|
||
original_log_names = copy.copy(original_petro_log_names) | ||
original_log_names.append(facies_log_name) | ||
bw = xtgeo.blockedwells_from_roxar( | ||
project, grid_name, bw_name, lognames=original_log_names | ||
) | ||
print(" ") | ||
print(f"Update blocked well set {bw_name} for grid model {grid_name}:") | ||
|
||
for well in bw.wells: | ||
if debug_print: | ||
print(f"Wellname: {well.name}") | ||
|
||
# Update the new logs by only keeping petro variables | ||
# belonging to the current facies | ||
df = well.get_dataframe() | ||
new_log_names = [] | ||
for facies_code, fname in facies_code_names.items(): | ||
filtered_rows = df[facies_log_name] != int(facies_code) | ||
for petro_name in original_petro_log_names: | ||
if petro_name in well.lognames: | ||
new_log_name = fname + "_" + petro_name | ||
well.create_log(new_log_name) | ||
|
||
df[new_log_name] = df[petro_name] | ||
df[new_log_name][filtered_rows] = np.nan | ||
if debug_print: | ||
print(f" Create new log: {new_log_name}") | ||
new_log_names.append(new_log_name) | ||
|
||
well.set_dataframe(df) | ||
if debug_print: | ||
print(f"Well: {well.name}") | ||
print(f"All logs: {well.lognames_all}") | ||
print("Dataframe for facies log and new logs:") | ||
df_updated = well.get_dataframe() | ||
selected_log_names = [] | ||
selected_log_names.append(facies_log_name) | ||
selected_log_names.extend(new_log_names) | ||
print(f"{df_updated[selected_log_names]}") | ||
|
||
print(f"Create new logs for well {well.name}") | ||
if debug_print: | ||
print("-" * 100) | ||
|
||
well.to_roxar( | ||
project, | ||
grid_name, | ||
bw_name, | ||
well.name, | ||
lognames=new_log_names, | ||
update_option="overwrite", | ||
) | ||
|
||
print("New logs: ") | ||
for name in new_log_names: | ||
print(f" {name}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
1.0 | ||
Unknown | ||
Wtest_0 None None 100.0 | ||
13 | ||
I_INDEX CONT linear | ||
J_INDEX CONT linear | ||
K_INDEX CONT linear | ||
ZONELOG DISC 1 Zone1 2 Zone2 3 Zone3 | ||
PORO CONT linear | ||
PERM CONT linear | ||
FACIES DISC 0 F1 1 F2 2 F3 | ||
F1_PORO CONT linear | ||
F1_PERM CONT linear | ||
F2_PORO CONT linear | ||
F2_PERM CONT linear | ||
F3_PORO CONT linear | ||
F3_PERM CONT linear | ||
125.0000 125.0000 1002.5000 0.0000 0.0000 0.0000 1 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
125.0000 125.0000 1007.5000 0.0000 0.0000 1.0000 1 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
125.0000 125.0000 1012.5000 0.0000 0.0000 2.0000 1 0.1184 37.4939 1 -999.0000 -999.0000 0.1184 37.4939 -999.0000 -999.0000 | ||
125.0000 125.0000 1017.5000 0.0000 0.0000 3.0000 1 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
125.0000 125.0000 1022.5000 0.0000 0.0000 4.0000 1 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
125.0000 125.0000 1027.5000 0.0000 0.0000 5.0000 1 0.1816 162.5061 1 -999.0000 -999.0000 0.1816 162.5061 -999.0000 -999.0000 | ||
125.0000 125.0000 1032.5000 0.0000 0.0000 6.0000 1 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
125.0000 125.0000 1037.5000 0.0000 0.0000 7.0000 2 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
125.0000 125.0000 1042.5000 0.0000 0.0000 8.0000 2 0.1816 162.5061 1 -999.0000 -999.0000 0.1816 162.5061 -999.0000 -999.0000 | ||
125.0000 125.0000 1047.5000 0.0000 0.0000 9.0000 2 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
125.0000 125.0000 1052.5000 0.0000 0.0000 10.0000 2 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
125.0000 125.0000 1057.5000 0.0000 0.0000 11.0000 2 0.1184 37.4939 1 -999.0000 -999.0000 0.1184 37.4939 -999.0000 -999.0000 | ||
125.0000 125.0000 1062.5000 0.0000 0.0000 12.0000 2 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
125.0000 125.0000 1067.5000 0.0000 0.0000 13.0000 3 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
125.0000 125.0000 1072.5000 0.0000 0.0000 14.0000 3 0.1184 37.4939 1 -999.0000 -999.0000 0.1184 37.4939 -999.0000 -999.0000 | ||
125.0000 125.0000 1077.5000 0.0000 0.0000 15.0000 3 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
125.0000 125.0000 1082.5000 0.0000 0.0000 16.0000 3 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
125.0000 125.0000 1087.5000 0.0000 0.0000 17.0000 3 0.1816 162.5061 1 -999.0000 -999.0000 0.1816 162.5061 -999.0000 -999.0000 | ||
125.0000 125.0000 1092.5000 0.0000 0.0000 18.0000 3 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
125.0000 125.0000 1097.5000 0.0000 0.0000 19.0000 3 0.1125 25.6914 2 -999.0000 -999.0000 -999.0000 -999.0000 0.1125 25.6914 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
1.0 | ||
Unknown | ||
Wtest_1 None None 100.0 | ||
13 | ||
I_INDEX CONT linear | ||
J_INDEX CONT linear | ||
K_INDEX CONT linear | ||
ZONELOG DISC 1 Zone1 2 Zone2 3 Zone3 | ||
PORO CONT linear | ||
PERM CONT linear | ||
FACIES DISC 0 F1 1 F2 2 F3 | ||
F1_PORO CONT linear | ||
F1_PERM CONT linear | ||
F2_PORO CONT linear | ||
F2_PERM CONT linear | ||
F3_PORO CONT linear | ||
F3_PERM CONT linear | ||
875.0000 875.0000 1002.5000 3.0000 3.0000 0.0000 1 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
875.0000 875.0000 1007.5000 3.0000 3.0000 1.0000 1 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
875.0000 875.0000 1012.5000 3.0000 3.0000 2.0000 1 0.1184 37.4939 1 -999.0000 -999.0000 0.1184 37.4939 -999.0000 -999.0000 | ||
875.0000 875.0000 1017.5000 3.0000 3.0000 3.0000 1 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
875.0000 875.0000 1022.5000 3.0000 3.0000 4.0000 1 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
875.0000 875.0000 1027.5000 3.0000 3.0000 5.0000 1 0.1816 162.5061 1 -999.0000 -999.0000 0.1816 162.5061 -999.0000 -999.0000 | ||
875.0000 875.0000 1032.5000 3.0000 3.0000 6.0000 1 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
875.0000 875.0000 1037.5000 3.0000 3.0000 7.0000 2 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
875.0000 875.0000 1042.5000 3.0000 3.0000 8.0000 2 0.1816 162.5061 1 -999.0000 -999.0000 0.1816 162.5061 -999.0000 -999.0000 | ||
875.0000 875.0000 1047.5000 3.0000 3.0000 9.0000 2 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
875.0000 875.0000 1052.5000 3.0000 3.0000 10.0000 2 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
875.0000 875.0000 1057.5000 3.0000 3.0000 11.0000 2 0.1184 37.4939 1 -999.0000 -999.0000 0.1184 37.4939 -999.0000 -999.0000 | ||
875.0000 875.0000 1062.5000 3.0000 3.0000 12.0000 2 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
875.0000 875.0000 1067.5000 3.0000 3.0000 13.0000 3 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
875.0000 875.0000 1072.5000 3.0000 3.0000 14.0000 3 0.1184 37.4939 1 -999.0000 -999.0000 0.1184 37.4939 -999.0000 -999.0000 | ||
875.0000 875.0000 1077.5000 3.0000 3.0000 15.0000 3 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
875.0000 875.0000 1082.5000 3.0000 3.0000 16.0000 3 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
875.0000 875.0000 1087.5000 3.0000 3.0000 17.0000 3 0.1816 162.5061 1 -999.0000 -999.0000 0.1816 162.5061 -999.0000 -999.0000 | ||
875.0000 875.0000 1092.5000 3.0000 3.0000 18.0000 3 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
875.0000 875.0000 1097.5000 3.0000 3.0000 19.0000 3 0.1125 25.6914 2 -999.0000 -999.0000 -999.0000 -999.0000 0.1125 25.6914 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
1.0 | ||
Unknown | ||
Wtest_2 None None 100.0 | ||
13 | ||
I_INDEX CONT linear | ||
J_INDEX CONT linear | ||
K_INDEX CONT linear | ||
ZONELOG DISC 1 Zone1 2 Zone2 3 Zone3 | ||
PORO CONT linear | ||
PERM CONT linear | ||
FACIES DISC 0 F1 1 F2 2 F3 | ||
F1_PORO CONT linear | ||
F1_PERM CONT linear | ||
F2_PORO CONT linear | ||
F2_PERM CONT linear | ||
F3_PORO CONT linear | ||
F3_PERM CONT linear | ||
1625.0000 1625.0000 1002.5000 6.0000 6.0000 0.0000 1 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1007.5000 6.0000 6.0000 1.0000 1 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1012.5000 6.0000 6.0000 2.0000 1 0.1184 37.4939 1 -999.0000 -999.0000 0.1184 37.4939 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1017.5000 6.0000 6.0000 3.0000 1 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1022.5000 6.0000 6.0000 4.0000 1 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1027.5000 6.0000 6.0000 5.0000 1 0.1816 162.5061 1 -999.0000 -999.0000 0.1816 162.5061 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1032.5000 6.0000 6.0000 6.0000 1 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1037.5000 6.0000 6.0000 7.0000 2 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1042.5000 6.0000 6.0000 8.0000 2 0.1816 162.5061 1 -999.0000 -999.0000 0.1816 162.5061 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1047.5000 6.0000 6.0000 9.0000 2 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1052.5000 6.0000 6.0000 10.0000 2 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1057.5000 6.0000 6.0000 11.0000 2 0.1184 37.4939 1 -999.0000 -999.0000 0.1184 37.4939 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1062.5000 6.0000 6.0000 12.0000 2 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1067.5000 6.0000 6.0000 13.0000 3 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1072.5000 6.0000 6.0000 14.0000 3 0.1184 37.4939 1 -999.0000 -999.0000 0.1184 37.4939 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1077.5000 6.0000 6.0000 15.0000 3 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1082.5000 6.0000 6.0000 16.0000 3 0.1816 162.5061 0 0.1816 162.5061 -999.0000 -999.0000 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1087.5000 6.0000 6.0000 17.0000 3 0.1816 162.5061 1 -999.0000 -999.0000 0.1816 162.5061 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1092.5000 6.0000 6.0000 18.0000 3 0.1184 37.4939 0 0.1184 37.4939 -999.0000 -999.0000 -999.0000 -999.0000 | ||
1625.0000 1625.0000 1097.5000 6.0000 6.0000 19.0000 3 0.1125 25.6914 2 -999.0000 -999.0000 -999.0000 -999.0000 0.1125 25.6914 |
Oops, something went wrong.