Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
Detection eddies
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
IPSL
LMD
DPAO
Detection eddies
Commits
80fce23f
Commit
80fce23f
authored
2 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Polish
parent
c6d6d8af
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cost_function.py
+17
-18
17 additions, 18 deletions
cost_function.py
segments.py
+4
-4
4 additions, 4 deletions
segments.py
with
21 additions
and
22 deletions
cost_function.py
+
17
−
18
View file @
80fce23f
#!/usr/bin/env python3
# A script that takes a segmented graph in the gt format and performs the
# non-local cost function calculation where each edge will have a cost
# function assigned to it.
# Inputs (to be changed within the script):
# node_id_param_file
# gt graph
# shapefiles
# Output: a gt graph with cost functions and an xml graph with cost functions
"""
A script that takes a segmented graph in the gt format and performs
the non-local cost function calculation where each edge will have a
cost function assigned to it.
Input:
-
"
node_id_param.json
"
, expected to be in the current directory
- the graph of segments,
"
segments.gt
"
or
"
segments.graphml
"
, expected
to be in the current directory
- shapefiles, specified as command line arguments
Output: the graph of segments with cost functions,
'
segments_cost_functions.gt
'
"""
import
graph_tool
import
time
...
...
@@ -297,15 +306,5 @@ for edge in g.edges():
g
.
ep
.
nl_cost_function
[
edge
]
=
cf
################################
# Writing to an GT Graph File #
################################
#g.save("segments_cyclo_gl_cf.xml")
#print("Done writing xml.")
print
(
"
Done writing gt.
"
)
#g.save('segmented_cf.gv', fmt = "dot")
#print("Done writing dot file.")
g
.
save
(
'
segments_cost_functions.gt
'
)
print
(
'
All done
'
)
This diff is collapsed.
Click to expand it.
segments.py
+
4
−
4
View file @
80fce23f
#!/usr/bin/env python3
"""
Collapses the input graph into a new graph:
the graph of
segments. A vertex of the new graph is a segment. The new
graph is
output in the binary format of
g
raph-tool. Input file should
be an
edgelist in CSV format. Output file can have suffix
"
.gt
"
or
"""
Collapses the input graph
of instantaneous eddies
into a new graph:
the graph of
segments. A vertex of the new graph is a segment. The new
graph is
output in the binary format of
G
raph-tool. Input file should
be an
edgelist in CSV format. Output file can have suffix
"
.gt
"
or
"
.graphml
"
.
"""
...
...
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