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
488473e0
Commit
488473e0
authored
2 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Polish
parent
751be309
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Inst_eddies/Documentation_texfol/Graphiques/SHPC.odg
+0
-0
0 additions, 0 deletions
Inst_eddies/Documentation_texfol/Graphiques/SHPC.odg
Trajectories/cost_function.py
+1
-1
1 addition, 1 deletion
Trajectories/cost_function.py
Trajectories/trajectories.py
+17
-16
17 additions, 16 deletions
Trajectories/trajectories.py
with
18 additions
and
17 deletions
Inst_eddies/Documentation_texfol/Graphiques/SHPC.odg
+
0
−
0
View file @
488473e0
No preview for this file type
This diff is collapsed.
Click to expand it.
Trajectories/cost_function.py
+
1
−
1
View file @
488473e0
...
@@ -10,7 +10,7 @@ Input:
...
@@ -10,7 +10,7 @@ Input:
- the graph of segments without cost functions,
"
segments.gt
"
or
- the graph of segments without cost functions,
"
segments.gt
"
or
"
segments.graphml
"
, expected to be in the current directory
"
segments.graphml
"
, expected to be in the current directory
-
shapefiles, specified as command line arguments
-
the SHPC
Output: the graph of segments with cost functions,
Output: the graph of segments with cost functions,
segments_cost_functions.gt or segments_cost_functions.graphml.
segments_cost_functions.gt or segments_cost_functions.graphml.
...
...
This diff is collapsed.
Click to expand it.
Trajectories/trajectories.py
+
17
−
16
View file @
488473e0
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
identifies trajectories.
identifies trajectories.
Input: the graph of segments produced by Graph-tool (in gt or graphml
Input: the graph of segments produced by Graph-tool (in gt or graphml
format).
Output: trajectories as lists of segments and as lists of
format). Output: trajectories as lists of segments and as lists of
instantaneous eddies, in JSon files.
instantaneous eddies, in JSon files.
"""
"""
...
@@ -15,8 +15,8 @@ import sys
...
@@ -15,8 +15,8 @@ import sys
import
numpy
as
np
import
numpy
as
np
g
=
graph_tool
.
load_graph
(
sys
.
argv
[
1
])
g
=
graph_tool
.
load_graph
(
sys
.
argv
[
1
])
traj_prop
=
g
.
new_v
p
(
'
int
'
,
val
=
-
1
)
traj_prop
=
g
.
new_v
ertex_property
(
'
int
'
,
val
=
-
1
)
all_cost_functions
=
g
.
get_edges
([
g
.
e
p
.
cost_function
])
all_cost_functions
=
g
.
get_edges
([
g
.
e
dge_properties
.
cost_function
])
# Array of indices that sort on cost function:
# Array of indices that sort on cost function:
ind_cf
=
np
.
argsort
(
all_cost_functions
[:,
2
])
ind_cf
=
np
.
argsort
(
all_cost_functions
[:,
2
])
...
@@ -34,10 +34,11 @@ for i in ind_cf:
...
@@ -34,10 +34,11 @@ for i in ind_cf:
ind_traj
+=
1
ind_traj
+=
1
traj_prop
[
source
]
=
ind_traj
traj_prop
[
source
]
=
ind_traj
traj_prop
[
target
]
=
ind_traj
traj_prop
[
target
]
=
ind_traj
segments
=
[
int
(
g
.
vp
.
name
[
source
]),
int
(
g
.
vp
.
name
[
target
])]
segments
=
[
int
(
g
.
vertex_properties
.
name
[
source
]),
int
(
g
.
vertex_properties
.
name
[
target
])]
traj_segm
.
append
(
segments
)
traj_segm
.
append
(
segments
)
inst_eddies
=
list
(
g
.
v
p
.
inst_eddies
[
source
])
\
inst_eddies
=
list
(
g
.
v
ertex_properties
.
inst_eddies
[
source
])
\
+
list
(
g
.
v
p
.
inst_eddies
[
target
])
+
list
(
g
.
v
ertex_properties
.
inst_eddies
[
target
])
expanded_traj
.
append
(
inst_eddies
)
expanded_traj
.
append
(
inst_eddies
)
elif
traj_prop
[
source
]
==
-
1
:
elif
traj_prop
[
source
]
==
-
1
:
# assert traj_prop[target] != - 1
# assert traj_prop[target] != - 1
...
@@ -50,15 +51,15 @@ for i in ind_cf:
...
@@ -50,15 +51,15 @@ for i in ind_cf:
# trajectory so we create a new trajectory for source.
# trajectory so we create a new trajectory for source.
ind_traj
+=
1
ind_traj
+=
1
traj_prop
[
source
]
=
ind_traj
traj_prop
[
source
]
=
ind_traj
segments
=
[
int
(
g
.
v
p
.
name
[
source
])]
segments
=
[
int
(
g
.
v
ertex_properties
.
name
[
source
])]
traj_segm
.
append
(
segments
)
traj_segm
.
append
(
segments
)
inst_eddies
=
list
(
g
.
v
p
.
inst_eddies
[
source
])
inst_eddies
=
list
(
g
.
v
ertex_properties
.
inst_eddies
[
source
])
expanded_traj
.
append
(
inst_eddies
)
expanded_traj
.
append
(
inst_eddies
)
else
:
else
:
traj_prop
[
source
]
=
traj_prop
[
target
]
traj_prop
[
source
]
=
traj_prop
[
target
]
segment
=
int
(
g
.
v
p
.
name
[
source
])
segment
=
int
(
g
.
v
ertex_properties
.
name
[
source
])
traj_segm
[
traj_prop
[
source
]].
append
(
segment
)
traj_segm
[
traj_prop
[
source
]].
append
(
segment
)
inst_eddies
=
list
(
g
.
v
p
.
inst_eddies
[
source
])
inst_eddies
=
list
(
g
.
v
ertex_properties
.
inst_eddies
[
source
])
expanded_traj
[
traj_prop
[
source
]].
extend
(
inst_eddies
)
expanded_traj
[
traj_prop
[
source
]].
extend
(
inst_eddies
)
elif
traj_prop
[
target
]
==
-
1
:
elif
traj_prop
[
target
]
==
-
1
:
# assert traj_prop[source] != - 1
# assert traj_prop[source] != - 1
...
@@ -71,15 +72,15 @@ for i in ind_cf:
...
@@ -71,15 +72,15 @@ for i in ind_cf:
# so we create a new trajectory for target.
# so we create a new trajectory for target.
ind_traj
+=
1
ind_traj
+=
1
traj_prop
[
target
]
=
ind_traj
traj_prop
[
target
]
=
ind_traj
segments
=
[
int
(
g
.
v
p
.
name
[
target
])]
segments
=
[
int
(
g
.
v
ertex_properties
.
name
[
target
])]
traj_segm
.
append
(
segments
)
traj_segm
.
append
(
segments
)
inst_eddies
=
list
(
g
.
v
p
.
inst_eddies
[
target
])
inst_eddies
=
list
(
g
.
v
ertex_properties
.
inst_eddies
[
target
])
expanded_traj
.
append
(
inst_eddies
)
expanded_traj
.
append
(
inst_eddies
)
else
:
else
:
traj_prop
[
target
]
=
traj_prop
[
source
]
traj_prop
[
target
]
=
traj_prop
[
source
]
segment
=
int
(
g
.
v
p
.
name
[
target
])
segment
=
int
(
g
.
v
ertex_properties
.
name
[
target
])
traj_segm
[
traj_prop
[
target
]].
append
(
segment
)
traj_segm
[
traj_prop
[
target
]].
append
(
segment
)
inst_eddies
=
list
(
g
.
v
p
.
inst_eddies
[
target
])
inst_eddies
=
list
(
g
.
v
ertex_properties
.
inst_eddies
[
target
])
expanded_traj
[
traj_prop
[
source
]].
extend
(
inst_eddies
)
expanded_traj
[
traj_prop
[
source
]].
extend
(
inst_eddies
)
# Create trajectories for isolated segments:
# Create trajectories for isolated segments:
...
@@ -87,9 +88,9 @@ for v in g.vertices():
...
@@ -87,9 +88,9 @@ for v in g.vertices():
if
traj_prop
[
v
]
==
-
1
:
if
traj_prop
[
v
]
==
-
1
:
ind_traj
+=
1
ind_traj
+=
1
traj_prop
[
v
]
=
ind_traj
traj_prop
[
v
]
=
ind_traj
segments
=
[
int
(
g
.
v
p
.
name
[
v
])]
segments
=
[
int
(
g
.
v
ertex_properties
.
name
[
v
])]
traj_segm
.
append
(
segments
)
traj_segm
.
append
(
segments
)
inst_eddies
=
list
(
g
.
v
p
.
inst_eddies
[
v
])
inst_eddies
=
list
(
g
.
v
ertex_properties
.
inst_eddies
[
v
])
expanded_traj
.
append
(
inst_eddies
)
expanded_traj
.
append
(
inst_eddies
)
print
(
"
Number of trajectories:
"
,
len
(
traj_segm
))
print
(
"
Number of trajectories:
"
,
len
(
traj_segm
))
...
...
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