Skip to content

Commit

Permalink
Update after review of field_statistics.py
Browse files Browse the repository at this point in the history
  • Loading branch information
oddvarlia committed Oct 29, 2024
1 parent ff6d2f3 commit f665a52
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions src/subscript/field_statistics/field_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,9 @@ def field_stat(args):
result_path = ens_path / relative_result_path
if not result_path.exists():
# Create the directory
logger.info(
"Create directory for results for field parameter statistics: "
f"{result_path}"
logger.warning(
f"Result directory: {result_path} does not exist. "
"Create directory for results for field parameter statistics."
)
result_path.mkdir()

Expand Down Expand Up @@ -1010,13 +1010,13 @@ def get_specifications(input_dict, ertbox_size, ert_config_path):

if not ertbox_size:
# ertbox size does not exist, read it from this scripts config file instead
print("ERTBOX size is not defined, need to get it from the config file")
logger.info("ERTBOX size is not defined, need to get it from the config file.")
key = "ertbox_size"
if key in input_dict["geogrid_fields"]:
ertbox_size = input_dict["geogrid_fields"][key]
else:
raise KeyError(
"Missing keyword 'ertbox_size'."
f"Missing keyword '{key}'."
"Is required if the ERTBOX.EGRID is not found in the "
"configuration directory of the FMU project under: "
f" {ert_config_path / Path('../../rms/output/aps/ERTBOX.EGRID')}"
Expand All @@ -1034,10 +1034,9 @@ def get_specifications(input_dict, ertbox_size, ert_config_path):
zone_code_names = None
param_name_dict = None
disc_param_name_dict = None
key = "geogrid_fields"
if key in input_dict:
if "geogrid_fields" in input_dict:
use_geogrid_fields = True
geogrid_fields_dict = input_dict[key]
geogrid_fields_dict = input_dict["geogrid_fields"]

key = "zone_code_names"
if key in geogrid_fields_dict:
Expand Down Expand Up @@ -1078,10 +1077,9 @@ def get_specifications(input_dict, ertbox_size, ert_config_path):
temporary_ertbox_field = None
init_path = None
param_list = None
key = "temporary_ertbox_fields"
if key in input_dict:
if "temporary_ertbox_fields" in input_dict:
use_temporary_fields = True
temporary_ertbox_field = input_dict[key]
temporary_ertbox_field = input_dict["temporary_ertbox_fields"]

key = "initial_relative_path"
if key in temporary_ertbox_field:
Expand Down Expand Up @@ -1409,22 +1407,17 @@ def calc_stats(
sum_total_active = np.ma.sum(sum_active) / nreal
sum_total_code = np.ma.sum(number_of_cells) / nreal
fraction = sum_total_code / sum_total_active
txt1 = (
logger.info(
f" Average number of active cells: {sum_total_active}"
)
logger.info(txt1)

txt2 = (
logger.info(
f" Average number of cells with facies "
f"{facies_name} is {sum_total_code}"
)
logger.info(txt2)

txt3 = (
logger.info(
" Average estimated facies probability for facies "
f"{facies_name}: {fraction}"
)
logger.info(txt3)

sum_fraction += fraction

Expand Down

0 comments on commit f665a52

Please sign in to comment.