-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
543 additions
and
3 deletions.
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
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,63 @@ | ||
from typing import Optional, Dict | ||
import json | ||
from pathlib import Path | ||
import glob | ||
|
||
import ecl2df | ||
|
||
|
||
def read_zone_layer_mapping( | ||
ensemble_path: str, zone_layer_mapping_file: str | ||
) -> Optional[Dict[int, str]]: | ||
"""Searches for a zone layer mapping file (lyr format) on the scratch disk. \ | ||
If one file is found it is parsed using functionality from the ecl2df \ | ||
library. | ||
""" | ||
for filename in glob.glob(f"{ensemble_path}/{zone_layer_mapping_file}"): | ||
return ecl2df.EclFiles("").get_zonemap(filename=filename) | ||
return None | ||
|
||
|
||
def read_well_attributes( | ||
ensemble_path: str, well_attributes_file: str | ||
) -> Optional[dict]: | ||
"""Searches for a well attributes json file on the scratch disk. \ | ||
if one file is found it is parsed and returned as a dictionary. | ||
The file needs to follow the format below. The categorical attributes \ | ||
are optional. | ||
{ | ||
"version" : "0.1", | ||
"wells" : [ | ||
{ | ||
"alias" : { | ||
"eclipse" : "OP_1" | ||
}, | ||
"attributes" : { | ||
"mlt_singlebranch" : "mlt", | ||
"structure" : "East", | ||
"welltype" : "producer" | ||
}, | ||
"name" : "OP_1" | ||
}, | ||
{ | ||
"alias" : { | ||
"eclipse" : "GI_1" | ||
}, | ||
"attributes" : { | ||
"mlt_singlebranch" : "singlebranch", | ||
"structure" : "West", | ||
"welltype" : "gas injector" | ||
}, | ||
"name" : "GI_1" | ||
}, | ||
] | ||
} | ||
""" | ||
for filename in glob.glob(f"{ensemble_path}/{well_attributes_file}"): | ||
file_content = json.loads(Path(filename).read_text()) | ||
return { | ||
well_data["alias"]["eclipse"]: well_data["attributes"] | ||
for well_data in file_content["wells"] | ||
} | ||
return None |
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
Oops, something went wrong.