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
Admin message
Gitlab has been updated. More info
here
and
there
.
Show more breadcrumbs
IPSL
LMD
DPAO
Detection eddies
Commits
ae0afc8e
Commit
ae0afc8e
authored
8 months ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Add argument `arrows`
To function `plot_single_traj`.
parent
da2dd9e2
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
Trajectories/Analysis/plot_traj.py
+43
-9
43 additions, 9 deletions
Trajectories/Analysis/plot_traj.py
with
43 additions
and
9 deletions
Trajectories/Analysis/plot_traj.py
+
43
−
9
View file @
ae0afc8e
...
...
@@ -8,6 +8,7 @@ and markers for the extrema at initial positions.
import
random
import
numpy
as
np
from
matplotlib
import
patches
import
util_eddies
...
...
@@ -42,17 +43,46 @@ def plot_single_traj(
annotate_flag
,
color
,
color_initial
,
arrows
,
):
x
,
y
=
get_extr_coord
(
traj
,
e_overestim
,
SHPC
,
orientation
)
ax
.
plot
(
x
,
y
,
color
,
linewidth
=
0.5
,
transform
=
src_crs
)
ax
.
plot
(
x
[
0
],
y
[
0
],
marker
=
"
s
"
,
markersize
=
2
,
color
=
color_initial
,
transform
=
src_crs
,
)
if
arrows
:
# Markers at eatch point and arrows between points, all in the
# same color
ax
.
plot
(
x
,
y
,
marker
=
"
o
"
,
linestyle
=
""
,
markersize
=
2
,
color
=
color
,
transform
=
src_crs
,
)
# We do not use quiver because it does not work easily with a
# projection and angles="xy", scale_units="xy", scale=1.
for
i
in
range
(
len
(
x
)
-
1
):
# Do not use argument transform of FancyArrowPatch because
# it does not work with ccrs.Geodetic().
posA
=
ax
.
projection
.
transform_point
(
x
[
i
],
y
[
i
],
src_crs
)
posB
=
ax
.
projection
.
transform_point
(
x
[
i
+
1
],
y
[
i
+
1
],
src_crs
)
arrow
=
patches
.
FancyArrowPatch
(
posA
,
posB
,
arrowstyle
=
"
-|>
"
,
color
=
color
,
mutation_scale
=
10
)
ax
.
add_patch
(
arrow
)
else
:
# Marker at the initial point only, with a different color, no arrows
ax
.
plot
(
x
,
y
,
color
,
linewidth
=
0.5
,
transform
=
src_crs
)
ax
.
plot
(
x
[
0
],
y
[
0
],
marker
=
"
s
"
,
markersize
=
2
,
color
=
color_initial
,
transform
=
src_crs
,
)
if
annotate_flag
:
ax
.
annotate
(
...
...
@@ -150,6 +180,7 @@ if __name__ == "__main__":
args
.
annotate
,
color
=
"
red
"
,
color_initial
=
"
green
"
,
arrows
=
False
,
)
break
else
:
...
...
@@ -165,6 +196,7 @@ if __name__ == "__main__":
args
.
annotate
,
color
=
"
red
"
,
color_initial
=
"
green
"
,
arrows
=
False
,
)
else
:
if
args
.
alt
:
...
...
@@ -202,6 +234,7 @@ if __name__ == "__main__":
args
.
annotate
,
color
,
color_initial
,
arrows
=
False
,
)
else
:
# args.min_duration > 1
...
...
@@ -227,6 +260,7 @@ if __name__ == "__main__":
args
.
annotate
,
color
,
color_initial
,
arrows
=
False
,
)
print
(
...
...
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