270
270
EXAMPLES = """Add a file named e.g. ``ert/bin/workflows/wf_field_statistics`` with the contents::
271
271
272
272
DEFINE <FIELD_STAT_CONFIG_FILE> ../input/config/field_param_stat.yml
273
- DEFINE <RELATIVE_RESULT_PATH> share/grid_statistics
274
273
DEFINE <ENSEMBLE_PATH> <SCRATCH>/<USER>/<CASE_DIR>
275
- DEFINE <LOAD_RESULT_SCRIPT> <SCRATCH>/<USER>/<CASE_DIR>/<RELATIVE_RESULT_PATH>/tmp_import_field_stat.py
276
- FIELD_STATISTICS -c <FIELD_STAT_CONFIG_FILE>
277
- -e <ENSEMBLE_PATH>
278
- -p <CONFIG_PATH>
279
- -r <RELATIVE_RESULT_PATH>
280
- -z <LOAD_RESULT_SCRIPT>
274
+ DEFINE <RESULT_FIELD_STAT_PATH> <ENSEMBLE_PATH>/share/grid_statistics
275
+ DEFINE <LOAD_TO_RMS_SCRIPT> <RESULT_FIELD_STAT_PATH>/tmp_import_field_stat_into_rms.py
276
+ MAKE_DIRECTORY <RESULT_FIELD_STAT_PATH>
277
+ FIELD_STATISTICS -c <FIELD_STAT_CONFIG_FILE>
278
+ -p <CONFIG_PATH>
279
+ -e <ENSEMBLE_PATH>
280
+ -z <LOAD_TO_RMS_SCRIPT>
281
281
-g
282
282
283
283
where the config file for FIELD_STATISTICS in this example is located under::
@@ -360,12 +360,7 @@ def field_stat(args):
360
360
relative_result_path = Path (args .resultpath )
361
361
result_path = ens_path / relative_result_path
362
362
if not result_path .exists ():
363
- # Create the directory
364
- logger .info (
365
- "Create directory for results for field parameter statistics: "
366
- f"{ result_path } "
367
- )
368
- result_path .mkdir ()
363
+ raise IOError (f"Result directory: { result_path } does not exist." )
369
364
370
365
rms_load_script = None
371
366
if args .generate_rms_load_script :
@@ -1010,13 +1005,13 @@ def get_specifications(input_dict, ertbox_size, ert_config_path):
1010
1005
1011
1006
if not ertbox_size :
1012
1007
# ertbox size does not exist, read it from this scripts config file instead
1013
- print ("ERTBOX size is not defined, need to get it from the config file" )
1008
+ logger . info ("ERTBOX size is not defined, need to get it from the config file. " )
1014
1009
key = "ertbox_size"
1015
1010
if key in input_dict ["geogrid_fields" ]:
1016
1011
ertbox_size = input_dict ["geogrid_fields" ][key ]
1017
1012
else :
1018
1013
raise KeyError (
1019
- "Missing keyword 'ertbox_size '."
1014
+ f "Missing keyword '{ key } '."
1020
1015
"Is required if the ERTBOX.EGRID is not found in the "
1021
1016
"configuration directory of the FMU project under: "
1022
1017
f" { ert_config_path / Path ('../../rms/output/aps/ERTBOX.EGRID' )} "
@@ -1034,10 +1029,9 @@ def get_specifications(input_dict, ertbox_size, ert_config_path):
1034
1029
zone_code_names = None
1035
1030
param_name_dict = None
1036
1031
disc_param_name_dict = None
1037
- key = "geogrid_fields"
1038
- if key in input_dict :
1032
+ if "geogrid_fields" in input_dict :
1039
1033
use_geogrid_fields = True
1040
- geogrid_fields_dict = input_dict [key ]
1034
+ geogrid_fields_dict = input_dict ["geogrid_fields" ]
1041
1035
1042
1036
key = "zone_code_names"
1043
1037
if key in geogrid_fields_dict :
@@ -1078,10 +1072,9 @@ def get_specifications(input_dict, ertbox_size, ert_config_path):
1078
1072
temporary_ertbox_field = None
1079
1073
init_path = None
1080
1074
param_list = None
1081
- key = "temporary_ertbox_fields"
1082
- if key in input_dict :
1075
+ if "temporary_ertbox_fields" in input_dict :
1083
1076
use_temporary_fields = True
1084
- temporary_ertbox_field = input_dict [key ]
1077
+ temporary_ertbox_field = input_dict ["temporary_ertbox_fields" ]
1085
1078
1086
1079
key = "initial_relative_path"
1087
1080
if key in temporary_ertbox_field :
@@ -1409,22 +1402,17 @@ def calc_stats(
1409
1402
sum_total_active = np .ma .sum (sum_active ) / nreal
1410
1403
sum_total_code = np .ma .sum (number_of_cells ) / nreal
1411
1404
fraction = sum_total_code / sum_total_active
1412
- txt1 = (
1405
+ logger . info (
1413
1406
f" Average number of active cells: { sum_total_active } "
1414
1407
)
1415
- logger .info (txt1 )
1416
-
1417
- txt2 = (
1408
+ logger .info (
1418
1409
f" Average number of cells with facies "
1419
1410
f"{ facies_name } is { sum_total_code } "
1420
1411
)
1421
- logger .info (txt2 )
1422
-
1423
- txt3 = (
1412
+ logger .info (
1424
1413
" Average estimated facies probability for facies "
1425
1414
f"{ facies_name } : { fraction } "
1426
1415
)
1427
- logger .info (txt3 )
1428
1416
1429
1417
sum_fraction += fraction
1430
1418
0 commit comments