Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Data Flow
Data Loading
Wellbore DDMS Data Loader
Commits
9b2568de
Commit
9b2568de
authored
Oct 25, 2021
by
Gregory Harris
Browse files
Refactor LASCLI
parent
f721ddb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lascli.py
View file @
9b2568de
...
...
@@ -70,88 +70,51 @@ class LasCommandLoader(CLICommandsLoader):
# 'fileload'
with
ArgumentsContext
(
self
,
'fileload'
)
as
arg_context
:
arg_context
.
argument
(
'input_path'
,
type
=
str
,
options_list
=
(
'-p'
,
'--path'
),
help
=
'Path to a file or folder containing LAS file(s) to upload.'
)
self
.
_register_input_path_argument
(
arg_context
)
with
ArgumentsContext
(
self
,
'fileload convert'
)
as
arg_context
:
arg_context
.
argument
(
'wellbore_id'
,
type
=
str
,
options_list
=
(
'--wellbore_id'
),
help
=
'The wellbore id to use when printing to file.'
)
self
.
_register_wellbore_id_flag
(
arg_context
)
# 'ingest'
with
ArgumentsContext
(
self
,
'ingest'
)
as
arg_context
:
arg_context
.
argument
(
'input_path'
,
type
=
str
,
options_list
=
(
'-p'
,
'--path'
),
help
=
'Path to a file or folder containing LAS file(s) to upload.'
)
with
ArgumentsContext
(
self
,
'ingest'
)
as
arg_context
:
arg_context
.
argument
(
'url'
,
type
=
str
,
options_list
=
(
'-u'
,
'--url'
),
help
=
'The base url of the OSDU instance.'
)
with
ArgumentsContext
(
self
,
'ingest'
)
as
arg_context
:
arg_context
.
argument
(
'token'
,
type
=
str
,
options_list
=
(
'-t'
,
'--token'
),
help
=
'A valid bearer token used to authenticate with the OSDU instance.'
)
self
.
_register_input_path_argument
(
arg_context
)
self
.
_register_url_and_token_arguments
(
arg_context
)
with
ArgumentsContext
(
self
,
'ingest wellbore'
)
as
arg_context
:
arg_context
.
argument
(
'no_recognize'
,
options_list
=
(
'--norecognize'
),
action
=
'store_true'
,
help
=
'If specified LASCLI won
\'
t attempt to recognize the curve families.'
)
with
ArgumentsContext
(
self
,
'ingest data'
)
as
arg_context
:
arg_context
.
argument
(
'welllog_id'
,
options_list
=
(
'--welllog_id'
),
help
=
'The welllog id of the record into which to write the data.'
)
self
.
_register_welllog_id_argument
(
arg_context
)
# 'list'
with
ArgumentsContext
(
self
,
'list'
)
as
arg_context
:
arg_context
.
argument
(
'url'
,
type
=
str
,
options_list
=
(
'-u'
,
'--url'
),
help
=
'Url for the OSDU instance.'
)
with
ArgumentsContext
(
self
,
'list'
)
as
arg_context
:
arg_context
.
argument
(
'token'
,
type
=
str
,
options_list
=
(
'-t'
,
'--token'
),
help
=
'A valid bearer token used to authenticate with the OSDU instance.'
)
self
.
_register_url_and_token_arguments
(
arg_context
)
with
ArgumentsContext
(
self
,
'list wellbore'
)
as
arg_context
:
arg_context
.
argument
(
'wellbore_id'
,
type
=
str
,
options_list
=
(
'--wellbore_id'
),
help
=
'The wellbore id of the record to retrieve.'
)
with
ArgumentsContext
(
self
,
'list welllog'
)
as
arg_context
:
arg_context
.
argument
(
'welllog_id'
,
type
=
str
,
options_list
=
(
'--welllog_id'
),
help
=
'The welllog id of the record to retrieve.'
)
self
.
_register_wellbore_id_flag
(
arg_context
)
with
ArgumentsContext
(
self
,
'list welllog'
)
as
arg_context
:
self
.
_register_welllog_id_argument
(
arg_context
)
arg_context
.
argument
(
'curves'
,
options_list
=
(
'--curveids'
),
action
=
'store_true'
,
help
=
'Show only the curve ids.'
)
with
ArgumentsContext
(
self
,
'list curves'
)
as
arg_context
:
arg_context
.
argument
(
'welllog_id'
,
type
=
str
,
options_list
=
(
'--welllog_id'
),
help
=
'The welllog id of the record to retrieve.'
)
with
ArgumentsContext
(
self
,
'list curves'
)
as
arg_context
:
arg_context
.
argument
(
'curves'
,
type
=
str
,
options_list
=
(
'--curves'
),
nargs
=
'*'
,
help
=
'The list of curves to retrieve (space separated list), returns all curves if not specified.'
)
self
.
_register_welllog_id_argument
(
arg_context
)
self
.
_register_curves_argument
(
arg_context
)
# 'update'
with
ArgumentsContext
(
self
,
'update'
)
as
arg_context
:
arg_context
.
argument
(
'url'
,
type
=
str
,
options_list
=
(
'-u'
,
'--url'
),
help
=
'Url for the OSDU instance.'
)
with
ArgumentsContext
(
self
,
'update'
)
as
arg_context
:
arg_context
.
argument
(
'token'
,
type
=
str
,
options_list
=
(
'-t'
,
'--token'
),
help
=
'A valid bearer token used to authenticate with the OSDU instance.'
)
with
ArgumentsContext
(
self
,
'update welllog'
)
as
arg_context
:
arg_context
.
argument
(
'welllog_id'
,
type
=
str
,
options_list
=
(
'--welllog_id'
),
help
=
'The welllog ID of the record to updated.'
)
self
.
_register_url_and_token_arguments
(
arg_context
)
with
ArgumentsContext
(
self
,
'update welllog'
)
as
arg_context
:
self
.
_register_welllog_id_argument
(
arg_context
)
arg_context
.
argument
(
'recognize'
,
options_list
=
(
'--recognize'
),
action
=
'store_true'
,
help
=
'If specified or set to True LASCLI will attempt to recognize and update the curve families.'
)
# 'Search'
with
ArgumentsContext
(
self
,
'search'
)
as
arg_context
:
arg_context
.
argument
(
'url'
,
type
=
str
,
options_list
=
(
'-u'
,
'--url'
),
help
=
'The base url of the OSDU instance.'
)
with
ArgumentsContext
(
self
,
'search'
)
as
arg_context
:
arg_context
.
argument
(
'token'
,
type
=
str
,
options_list
=
(
'-t'
,
'--token'
),
help
=
'A valid bearer token used to authenticate with the OSDU instance.'
)
self
.
_register_url_and_token_arguments
(
arg_context
)
with
ArgumentsContext
(
self
,
'search wellbore'
)
as
arg_context
:
arg_context
.
argument
(
'wellbore_name'
,
type
=
str
,
options_list
=
(
'--name'
),
...
...
@@ -159,26 +122,35 @@ class LasCommandLoader(CLICommandsLoader):
# 'download'
with
ArgumentsContext
(
self
,
'download'
)
as
arg_context
:
arg_context
.
argument
(
'url'
,
type
=
str
,
options_list
=
(
'-u'
,
'--url'
),
help
=
'Url for the OSDU instance.'
)
self
.
_register_url_and_token_arguments
(
arg_context
)
self
.
_register_welllog_id_argument
(
arg_context
)
self
.
_register_curves_argument
(
arg_context
)
arg_context
.
argument
(
'outfile'
,
type
=
str
,
options_list
=
(
'--out'
),
help
=
'The output file path'
)
with
ArgumentsContext
(
self
,
'download'
)
as
arg_context
:
arg_context
.
argument
(
'token'
,
type
=
str
,
options_list
=
(
'-t'
,
'--token'
),
help
=
'A valid bearer token used to authenticate with the OSDU instance.'
)
super
(
LasCommandLoader
,
self
).
load_arguments
(
command
)
with
ArgumentsContext
(
self
,
'download'
)
as
arg_context
:
arg_context
.
argument
(
'
welllog_id
'
,
type
=
str
,
options_list
=
(
'-
-welllog_id
'
),
help
=
'
The welllog id of the record to retrieve
.'
)
def
_register_input_path_argument
(
self
,
arg_context
)
:
arg_context
.
argument
(
'
input_path
'
,
type
=
str
,
options_list
=
(
'-
p'
,
'--path
'
),
help
=
'
Path to a file or folder containing one or more LAS file(s)
.'
)
with
ArgumentsContext
(
self
,
'download'
)
as
arg_context
:
arg_context
.
argument
(
'curves'
,
type
=
str
,
options_list
=
(
'--curves'
),
nargs
=
'*'
,
def
_register_curves_argument
(
self
,
arg_context
)
:
arg_context
.
argument
(
'curves'
,
type
=
str
,
options_list
=
(
'--curves'
),
nargs
=
'*'
,
help
=
'The list of curves to retrieve (space separated list), returns all curves if not specified.'
)
with
ArgumentsContext
(
self
,
'download'
)
as
arg_context
:
arg_context
.
argument
(
'
outfile
'
,
type
=
str
,
options_list
=
(
'--
out
'
),
help
=
'The
output file path
'
)
def
_register_wellbore_id_flag
(
self
,
arg_context
)
:
arg_context
.
argument
(
'
wellbore_id
'
,
type
=
str
,
options_list
=
(
'--
wellbore_id
'
),
help
=
'The
wellbore id of the record.
'
)
super
(
LasCommandLoader
,
self
).
load_arguments
(
command
)
def
_register_welllog_id_argument
(
self
,
arg_context
):
arg_context
.
argument
(
'welllog_id'
,
type
=
str
,
options_list
=
(
'--welllog_id'
),
help
=
'The welllog id of the record.'
)
def
_register_url_and_token_arguments
(
self
,
arg_context
):
arg_context
.
argument
(
'url'
,
type
=
str
,
options_list
=
(
'-u'
,
'--url'
),
help
=
'The base url of the OSDU instance.'
)
arg_context
.
argument
(
'token'
,
type
=
str
,
options_list
=
(
'-t'
,
'--token'
),
help
=
'A valid bearer token used to authenticate with the OSDU instance.'
)
def
main
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment