1
1
#!/usr/bin/env python
2
- """
3
- casegen_upcars is script to create conceptual model
2
+ import argparse
3
+ import shutil
4
+
5
+ from jinja2 import DebugUndefined , Environment , FileSystemLoader , meta
6
+ from yaml import Loader , load
7
+
8
+ from subscript import getLogger
9
+ from subscript .casegen_upcars .model import Model
10
+ from subscript .casegen_upcars .udf import TERMINALCOLORS , conversion , flatten , listify
11
+ from subscript .casegen_upcars .udf_arg_parser import fill_parser
12
+
13
+ DESCRIPTION = """casegen_upcars is script to create conceptual model
4
14
based on sugar-cube representation of fracture.
5
15
6
16
It has capability to:
10
20
- multple throws (vertical shifting in any part of the model)
11
21
- vugs distribution: random, near fracture and near streak
12
22
- etc. Check wiki for more details:
13
- https://wiki.equinor.com/wiki/index.php/UpCaRs_Upscaling_casegen
14
- """
15
- import argparse
16
- import shutil
23
+ https://wiki.equinor.com/wiki/index.php/UpCaRs_Upscaling_casegen"""
17
24
18
- from jinja2 import DebugUndefined , Environment , FileSystemLoader , meta
19
- from yaml import Loader , load
25
+ CATEGORY = "modelling.reservoir"
20
26
21
- from subscript .casegen_upcars .model import Model
22
- from subscript .casegen_upcars .udf import TERMINALCOLORS , conversion , flatten , listify
23
- from subscript .casegen_upcars .udf_arg_parser import fill_parser
27
+ EXAMPLES = """
28
+ .. code-block:: console
29
+
30
+ DEFINE <CASEGEN_CONFIG_FILE> <RUNPATH>/model.yaml
31
+ DEFINE <CASEGEN_ECLIPSE_TEMPLATE> <CONFIG_PATH>/../input/config/eclipse.tmpl
32
+ FORWARD_MODEL CASEGEN_UPCARS(<CONFIG>=<CASEGEN_CONFIG_FILE>, <ECLTMP>=<CASEGEN_ECLIPSE_TEMPLATE>, <ECL>=<ECLIPSE_NAME>-<IENS>)
33
+
34
+ """ # noqa
35
+
36
+ logger = getLogger (__name__ )
24
37
25
38
26
39
def mask_token (stream_buffer , unique_token = "#|{}^" , unmask = False ):
@@ -397,7 +410,7 @@ def main():
397
410
for var in parser .variables :
398
411
dictionary [var [0 ]] = var [1 ]
399
412
400
- print ("Creating model" )
413
+ logger . info ("Creating model" )
401
414
grid = Model (
402
415
cell_matrix_x ,
403
416
cell_matrix_y ,
@@ -438,7 +451,7 @@ def main():
438
451
grid .set_throws (throws )
439
452
440
453
if vug1_fraction_max + vug2_fraction_max + vug3_fraction_max > 0 :
441
- print ("Set vugs" )
454
+ logger . info ("Set vugs" )
442
455
grid .set_vug (
443
456
[vug1_fraction_min , vug1_fraction_max ],
444
457
[vug1_perm_min , vug1_perm_max ],
@@ -464,7 +477,7 @@ def main():
464
477
vug3_spread ,
465
478
)
466
479
467
- print ("Set property" )
480
+ logger . info ("Set property" )
468
481
grid .set_fracture_anisotropy_property ("PERM" , fracture_perm_x , fracture_perm_y )
469
482
grid .set_layers_property ("PERM" , matrix_perm , streak_perm )
470
483
for keyword , var_matrix , var_layer , var_fracture in zip (
@@ -491,7 +504,7 @@ def main():
491
504
492
505
dictionary ["GRDECL_file" ] = f"gridinc_{ base_name } .GRDECL"
493
506
494
- print ("Exporting GRDECL file" )
507
+ logger . info ("Exporting GRDECL file" )
495
508
grid .export_grdecl (dictionary ["GRDECL_file" ])
496
509
497
510
for keyword , var_matrix , var_layer , var_fracture , var_vug in zip (
@@ -505,7 +518,7 @@ def main():
505
518
[vug1_swatinit , vug2_swatinit , vug3_swatinit ],
506
519
],
507
520
):
508
- print ("Exporting " + keyword + " include file" )
521
+ logger . info ("Exporting " + keyword + " include file" )
509
522
include_file = f"{ keyword .lower ()} _file"
510
523
dictionary [include_file ] = f"{ keyword .lower ()} _{ base_name } .INC"
511
524
grid .export_props (
@@ -541,9 +554,9 @@ def main():
541
554
undefined_var .append (var )
542
555
543
556
if undefined_var :
544
- print (
545
- f"\033 [91mWarning: Found { len (undefined_var )} undefined variables."
546
- f"Please verify your output files.\033 [0m \ n{ undefined_var } "
557
+ logger . warning (
558
+ f"Found { len (undefined_var )} undefined variables."
559
+ f"Please verify your output files.\n { undefined_var } "
547
560
)
548
561
549
562
with open (base_name + ".DATA" , "w" , encoding = "utf8" ) as file_handle :
0 commit comments