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
bc3e52c0
Commit
bc3e52c0
authored
4 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Polish
parent
b2ee6af5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Analysis/report_graph.py
+6
-3
6 additions, 3 deletions
Analysis/report_graph.py
with
6 additions
and
3 deletions
Analysis/report_graph.py
+
6
−
3
View file @
bc3e52c0
...
...
@@ -11,6 +11,8 @@ from networkx import nx_agraph
import
os
def
read_eddy_graph
(
edgelist
,
shp_tr_dir
=
None
,
read_interp
=
True
):
"""
shp_tr_dir is for visible eddies.
"""
G
=
nx
.
DiGraph
()
if
os
.
access
(
edgelist
,
os
.
R_OK
):
...
...
@@ -37,8 +39,8 @@ def read_eddy_graph(edgelist, shp_tr_dir = None, read_interp = True):
# Assuming that the directory containing the interpolated
# eddies is in the same location as edgelist:
extr_file
=
path
.
join
(
path
.
dirname
(
edgelist
)
,
"
SHP_triplet
"
,
"
extremum.shp
"
)
dir_edgelist
=
path
.
dirname
(
edgelist
)
extr_file
=
path
.
join
(
dir_edgelist
,
"
SHP_triplet
"
,
"
extremum.shp
"
)
if
os
.
access
(
extr_file
,
os
.
R_OK
):
set_attribute
(
G
,
extr_file
)
...
...
@@ -59,6 +61,7 @@ def set_attribute(G, extr_file):
with
shapefile
.
Reader
(
extr_file
)
as
s_read
:
for
shape_rec
in
s_read
:
n
=
(
shape_rec
.
record
.
days_1950
,
shape_rec
.
record
.
eddy_index
)
if
(
shape_rec
.
record
.
valid
==
1
or
shape_rec
.
record
.
interpolat
==
1
)
and
n
in
G
:
G
.
add_node
(
n
,
...
...
@@ -76,7 +79,7 @@ def to_eddy_agraph(G):
A
=
nx_agraph
.
to_agraph
(
G
)
for
k
,
s
in
my_subgraphs
.
items
():
for
d
,
s
in
my_subgraphs
.
items
():
A
.
add_subgraph
(
s
,
rank
=
"
same
"
)
for
n
in
G
:
...
...
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