Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
enstools-feature
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christoph.Fischer
enstools-feature
Commits
9e392283
Commit
9e392283
authored
2 years ago
by
Christopher Polster
Browse files
Options
Downloads
Patches
Plain Diff
Work on FeaturePipeline docstrings
parent
632adb68
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
Start with Sphinx-generated Documentation
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/source/_static/w2w.css
+4
-0
4 additions, 0 deletions
docs/source/_static/w2w.css
enstools/feature/pipeline.py
+34
-24
34 additions, 24 deletions
enstools/feature/pipeline.py
with
38 additions
and
24 deletions
docs/source/_static/w2w.css
+
4
−
0
View file @
9e392283
...
...
@@ -27,3 +27,7 @@ a:hover {
max-width
:
700px
;
}
div
.seealso
{
background-color
:
#EEE
;
border-color
:
#CCC
;
}
This diff is collapsed.
Click to expand it.
enstools/feature/pipeline.py
+
34
−
24
View file @
9e392283
...
...
@@ -8,18 +8,18 @@ import xarray as xr
class
FeaturePipeline
:
"""
This class encapsules the feature detection pipeline. The pipeline consists of an identification and a tracking procedure.
Feature detection pipeline (identification and tracking).
Parameters
----------
proto_ref
Protobuf template for the representation of identified features.
processing_mode : {
'
2d
'
,
'
3d
'
}
Specify if identification and tracking is performed on 2D levels or in
3D, per 3D block.
"""
def
__init__
(
self
,
proto_ref
,
processing_mode
=
'
2d
'
):
"""
Specify processing mode 2d or 3d: In 2d, identification and tracking will be performed on 2d levels, in 3d per 3d block.
Parameters
----------
proto_ref
processing_mode
"""
self
.
id_tech
=
None
self
.
tr_tech
=
None
...
...
@@ -38,12 +38,12 @@ class FeaturePipeline:
Parameters
----------
strategy : enstools.feature.identification.IdentificationTechnique
strategy : IdentificationTechnique
The identification strategy to use in the pipeline.
"""
self
.
id_tech
=
strategy
self
.
id_tech
.
pb_reference
=
self
.
pb_reference
self
.
id_tech
.
processing_mode
=
self
.
processing_mode
pass
def
set_tracking_strategy
(
self
,
strategy
:
TrackingTechnique
):
"""
...
...
@@ -51,23 +51,32 @@ class FeaturePipeline:
Parameters
----------
strategy : enstools.feature.tracking.TrackingTechnique
strategy : TrackingTechnique | None
The tracking strategy to use in the pipeline. Set to `None` or
don
'
t invoke this method at all if no tracking should be carried
out.
"""
self
.
tr_tech
=
strategy
if
strategy
is
not
None
:
self
.
tr_tech
.
pb_reference
=
self
.
pb_reference
self
.
tr_tech
.
processing_mode
=
self
.
processing_mode
pass
def
set_data_path
(
self
,
path
):
"""
Set the path to the dataset(s) to process.
This function calls enstools.io.read and therefore can read directories using wildcards.
This function calls :py:func:`enstools.io.read` and therefore can read
directories using wildcards.
Parameters
----------
path : list of str or tuple of str
names of individual files or filename pattern
See Also
--------
:py:meth:`.set_data`
"""
if
path
is
None
:
raise
Exception
(
"
None path provided.
"
)
...
...
@@ -80,7 +89,6 @@ class FeaturePipeline:
def
set_data
(
self
,
dataset
:
xr
.
Dataset
):
"""
Set the dataset to process.
The function set_data_path() can be used instead.
Parameters
----------
...
...
@@ -94,9 +102,7 @@ class FeaturePipeline:
self
.
dataset_path
=
""
def
execute_identification
(
self
):
"""
Execute the identification strategy.
"""
"""
Execute only the identification strategy.
"""
return_obj_desc_id
,
return_ds
=
self
.
id_tech
.
execute
(
self
.
dataset
)
self
.
object_desc
=
return_obj_desc_id
if
return_ds
is
not
None
:
...
...
@@ -106,14 +112,16 @@ class FeaturePipeline:
self
.
object_desc
.
run_time
=
str
(
datetime
.
now
().
isoformat
())
def
execute_tracking
(
self
):
"""
Execute the tracking strategy.
"""
"""
Execute only the tracking strategy.
"""
self
.
tr_tech
.
execute
(
self
.
object_desc
,
self
.
dataset
)
def
execute
(
self
):
"""
Execute the feature detection based on the set data and set techniques.
Execute the entire feature detection pipeline.
See Also
--------
:py:meth:`.execute_identification`, :py:meth:`.execute_tracking`
"""
# TODO need API to check if identification output type fits to tracking input type.
...
...
@@ -129,10 +137,12 @@ class FeaturePipeline:
def
is_data_3d
(
self
):
"""
Checks if provided dataset is spatially 3D (has a vertical dim)
Checks if the provided dataset is spatially 3D (has a vertical dim)
Returns
-------
True if vertical dim in dataset
bool
`True` if vertical dim in dataset else `False`.
"""
if
self
.
dataset
is
None
:
raise
Exception
(
"
None dataset provided.
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment