This repository has been archived by the owner on Jul 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
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
3 changed files
with
76 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,72 @@ | ||
#!/usr/bin/env python | ||
import sys | ||
import argparse | ||
from res.fm.rms import run | ||
|
||
run_path = sys.argv[1] | ||
iens = int(sys.argv[2]) | ||
version = sys.argv[3] | ||
project = sys.argv[4] | ||
export_path = sys.argv[5] | ||
import_path = sys.argv[6] | ||
workflow = sys.argv[7] | ||
|
||
run(iens, | ||
project, | ||
workflow, | ||
run_path, | ||
target_file=None, | ||
import_path=import_path, | ||
export_path=export_path, | ||
version=version, | ||
def _build_argument_parser(): | ||
description = 'Wrapper script to run rms.' | ||
usage = ('The script must be invoked with minimum three positional arguments:\n\n' | ||
' rms iens project workflow \n\n' | ||
'Optional arguments supported: \n' | ||
' target file [-t][--target-file]\n' | ||
' run path [-t][--run-path] default=rms/model\n' | ||
' import path [-i][--import-path] default=./ \n' | ||
' export path [-e][--export-path] default=./ \n' | ||
' version [-v][--version]\n') | ||
parser = argparse.ArgumentParser(description=description, usage=usage) | ||
parser.add_argument( | ||
'iens', | ||
help='Realization number', | ||
) | ||
parser.add_argument( | ||
'project', | ||
help='The RMS project we are running', | ||
) | ||
parser.add_argument( | ||
'workflow', | ||
help='The rms workflow we intend to run', | ||
) | ||
parser.add_argument( | ||
'-r', '--run-path', | ||
default='rms/model', | ||
help='The directory which will be used as cwd when running rms', | ||
) | ||
parser.add_argument( | ||
'-t', '--target-file', | ||
default=None, | ||
help='name of file which should be created/updated by rms', | ||
) | ||
parser.add_argument( | ||
'-i', '--import-path', | ||
default='./', | ||
help='the prefix of all relative paths when rms is importing', | ||
) | ||
parser.add_argument( | ||
'-e', '--export-path', | ||
default='./', | ||
help='the prefix of all relative paths when rms is exporting', | ||
) | ||
parser.add_argument( | ||
'-v', '--version', | ||
default=None, | ||
help='the prefix of all relative paths when rms is exporting', | ||
) | ||
return parser | ||
|
||
|
||
# The first three arguments; iens, project and workflow are positional | ||
# and *must* be supplied. The run_path and target_file arguments are optional. | ||
|
||
if __name__ == '__main__': | ||
arg_parser = _build_argument_parser() | ||
args = arg_parser.parse_args() | ||
|
||
run(args.iens, | ||
args.project, | ||
args.workflow, | ||
run_path=args.run_path, | ||
target_file=args.target_file, | ||
import_path=args.import_path, | ||
export_path=args.export_path, | ||
version=args.version | ||
) |