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
e35226da
Commit
e35226da
authored
2 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Add the option to label a list of nodes
parent
c45cd728
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
Overlap/plot_components.py
+22
-11
22 additions, 11 deletions
Overlap/plot_components.py
with
22 additions
and
11 deletions
Overlap/plot_components.py
+
22
−
11
View file @
e35226da
...
@@ -35,9 +35,11 @@ def is_node_type(G, n, label):
...
@@ -35,9 +35,11 @@ def is_node_type(G, n, label):
return
True
return
True
elif
label
==
"
important
"
:
elif
label
==
"
important
"
:
return
G
.
in_degree
[
n
]
==
0
or
G
.
out_degree
[
n
]
==
0
or
G
.
degree
[
n
]
>=
3
return
G
.
in_degree
[
n
]
==
0
or
G
.
out_degree
[
n
]
==
0
or
G
.
degree
[
n
]
>=
3
elif
isinstance
(
label
,
int
)
:
elif
label
[
0
]
==
"
date
"
:
return
report_graph
.
node_to_date_eddy
(
n
,
G
.
graph
[
"
e_overestim
"
],
return
report_graph
.
node_to_date_eddy
(
n
,
G
.
graph
[
"
e_overestim
"
],
only_date
=
True
)
==
label
only_date
=
True
)
==
label
[
1
]
elif
label
[
0
]
==
"
node
"
:
return
n
in
label
[
1
]
def
plot_nbunch
(
G
,
nbunch
,
color
=
'
#1f78b4
'
,
label
=
None
,
ax
=
None
):
def
plot_nbunch
(
G
,
nbunch
,
color
=
'
#1f78b4
'
,
label
=
None
,
ax
=
None
):
if
ax
is
None
:
ax
=
plt
.
gca
()
if
ax
is
None
:
ax
=
plt
.
gca
()
...
@@ -104,9 +106,13 @@ if __name__ == "__main__":
...
@@ -104,9 +106,13 @@ if __name__ == "__main__":
parser
.
add_argument
(
"
edgelist
"
,
help
=
"
path to input CSV file
"
)
parser
.
add_argument
(
"
edgelist
"
,
help
=
"
path to input CSV file
"
)
parser
.
add_argument
(
"
shpc_dir
"
,
help
=
"
directory containing SHPC, with
"
parser
.
add_argument
(
"
shpc_dir
"
,
help
=
"
directory containing SHPC, with
"
"
visible eddies at all dates
"
)
"
visible eddies at all dates
"
)
parser
.
add_argument
(
"
-l
"
,
"
--label
"
,
group
=
parser
.
add_mutually_exclusive_group
()
help
=
'"
root
"
,
"
leaf
"
,
"
split
"
,
"
merge
"
,
"
all
"
,
'
group
.
add_argument
(
"
-l
"
,
"
--label_type
"
,
'"
important
"
or integer for date index
'
)
choices
=
[
"
root
"
,
"
leaf
"
,
"
split
"
,
"
merge
"
,
"
all
"
,
"
important
"
])
group
.
add_argument
(
"
--label_date
"
,
type
=
int
,
metavar
=
"
DATE_INDEX
"
)
group
.
add_argument
(
"
--label_node
"
,
metavar
=
'
NODE
'
,
type
=
int
,
nargs
=
"
+
"
)
parser
.
add_argument
(
"
-s
"
,
"
--save
"
,
metavar
=
"
format
"
,
parser
.
add_argument
(
"
-s
"
,
"
--save
"
,
metavar
=
"
format
"
,
help
=
"
Save file to specified format
"
)
help
=
"
Save file to specified format
"
)
parser
.
add_argument
(
"
-t
"
,
"
--time
"
,
action
=
"
store_true
"
,
parser
.
add_argument
(
"
-t
"
,
"
--time
"
,
action
=
"
store_true
"
,
...
@@ -119,9 +125,14 @@ if __name__ == "__main__":
...
@@ -119,9 +125,14 @@ if __name__ == "__main__":
metavar
=
(
"
lllon
"
,
"
lllat
"
,
"
urlon
"
,
"
urlat
"
))
metavar
=
(
"
lllon
"
,
"
lllat
"
,
"
urlon
"
,
"
urlat
"
))
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
if
args
.
label
not
in
{
None
,
"
root
"
,
"
leaf
"
,
"
split
"
,
"
merge
"
,
"
all
"
,
if
args
.
label_type
:
"
important
"
}:
label
=
args
.
label_type
args
.
label
=
int
(
args
.
label
)
elif
args
.
label_date
:
label
=
(
"
date
"
,
args
.
label_date
)
elif
args
.
label_node
:
label
=
(
"
node
"
,
args
.
label_node
)
else
:
label
=
None
plt
.
figure
()
plt
.
figure
()
...
@@ -153,7 +164,7 @@ if __name__ == "__main__":
...
@@ -153,7 +164,7 @@ if __name__ == "__main__":
dest_crs
=
ccrs
.
PlateCarree
((
args
.
window
[
0
]
+
args
.
window
[
2
])
/
2
)
dest_crs
=
ccrs
.
PlateCarree
((
args
.
window
[
0
]
+
args
.
window
[
2
])
/
2
)
ax
=
plt
.
axes
(
projection
=
dest_crs
)
ax
=
plt
.
axes
(
projection
=
dest_crs
)
plot_all_components
(
G
,
args
.
label
)
plot_all_components
(
G
,
label
)
elif
args
.
node
is
not
None
:
elif
args
.
node
is
not
None
:
if
args
.
time
:
if
args
.
time
:
print
(
"
Reading edge list in current directory...
"
)
print
(
"
Reading edge list in current directory...
"
)
...
@@ -176,7 +187,7 @@ if __name__ == "__main__":
...
@@ -176,7 +187,7 @@ if __name__ == "__main__":
dest_crs
=
ccrs
.
PlateCarree
(
G
.
nodes
[
args
.
node
][
"
coordinates
"
][
0
])
dest_crs
=
ccrs
.
PlateCarree
(
G
.
nodes
[
args
.
node
][
"
coordinates
"
][
0
])
ax
=
plt
.
axes
(
projection
=
dest_crs
)
ax
=
plt
.
axes
(
projection
=
dest_crs
)
plot_nbunch
(
G
,
G
.
nodes
[
args
.
node
][
"
component
"
],
label
=
args
.
label
)
plot_nbunch
(
G
,
G
.
nodes
[
args
.
node
][
"
component
"
],
label
=
label
)
else
:
else
:
if
args
.
time
:
if
args
.
time
:
print
(
"
Reading edge lists in current directory...
"
)
print
(
"
Reading edge lists in current directory...
"
)
...
@@ -198,7 +209,7 @@ if __name__ == "__main__":
...
@@ -198,7 +209,7 @@ if __name__ == "__main__":
print
(
"
Plotting...
"
)
print
(
"
Plotting...
"
)
ax
=
plt
.
axes
(
projection
=
ccrs
.
PlateCarree
())
ax
=
plt
.
axes
(
projection
=
ccrs
.
PlateCarree
())
plot_all_components
(
G
,
args
.
label
)
plot_all_components
(
G
,
label
)
ax
.
coastlines
()
ax
.
coastlines
()
ax
.
gridlines
(
draw_labels
=
True
)
ax
.
gridlines
(
draw_labels
=
True
)
...
...
This diff is collapsed.
Click to expand it.
GUEZ Lionel
@guez
mentioned in commit
a794a866
·
2 years ago
mentioned in commit
a794a866
mentioned in commit a794a8666654f8a8fa92a6575213b5f43833e498
Toggle commit list
GUEZ Lionel
@guez
mentioned in commit
2aef3e7a
·
1 year ago
mentioned in commit
2aef3e7a
mentioned in commit 2aef3e7a6867e42417ff4cf00c4c8176b18a5d5f
Toggle commit list
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