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
Authenticating with a password
with git over http
works again
. More information
here
.
Show more breadcrumbs
IPSL
LMD
DPAO
Detection eddies
Commits
38374ff0
Commit
38374ff0
authored
2 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Add script `plot_traj.py`
parent
ac30f53a
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
Trajectories/plot_traj.py
+51
-0
51 additions, 0 deletions
Trajectories/plot_traj.py
Trajectories/report_graph.py
+1
-0
1 addition, 0 deletions
Trajectories/report_graph.py
Trajectories/util_eddies.py
+1
-0
1 addition, 0 deletions
Trajectories/util_eddies.py
with
53 additions
and
0 deletions
Trajectories/plot_traj.py
0 → 100755
+
51
−
0
View file @
38374ff0
#!/usr/bin/env python3
import
report_graph
import
util_eddies
import
matplotlib.pyplot
as
plt
import
numpy
as
np
import
json
import
cartopy.crs
as
ccrs
import
random
import
sys
if
len
(
sys
.
argv
)
!=
5
:
sys
.
exit
(
"
Required arguments : expanded-traj-file e-overestim-file
"
"
SHPC-dir
"
"
orientation
"
)
with
open
(
sys
.
argv
[
1
])
as
f
:
trajectories
=
json
.
load
(
f
)
print
(
"
Number of trajectories:
"
,
len
(
trajectories
))
with
open
(
sys
.
argv
[
2
])
as
f
:
e_overestim
=
int
(
f
.
read
())
SHPC
=
util_eddies
.
SHPC_class
(
sys
.
argv
[
3
],
def_orient
=
sys
.
argv
[
4
])
src_crs
=
ccrs
.
PlateCarree
()
projection
=
ccrs
.
PlateCarree
()
fig
,
ax
=
plt
.
subplots
(
subplot_kw
=
{
"
projection
"
:
projection
})
for
traj
in
trajectories
:
xy
=
[]
for
node
in
traj
:
date_index
,
eddy_index
=
report_graph
.
node_to_date_eddy
(
node
,
e_overestim
)
i_slice
=
SHPC
.
get_slice
(
date_index
)
ishape
=
SHPC
.
comp_ishape
(
date_index
,
eddy_index
,
i_slice
)
shape
=
SHPC
.
get_reader
(
i_slice
,
layer
=
"
extremum
"
).
shape
(
ishape
)
xy
.
append
(
shape
.
points
[
0
])
xy
=
np
.
array
(
xy
)
ax
.
plot
(
xy
[:,
0
],
xy
[:,
1
],
color
=
"
red
"
,
transform
=
src_crs
)
ax
.
plot
(
xy
[
0
,
0
],
xy
[
0
,
1
],
marker
=
"
s
"
,
color
=
"
black
"
,
transform
=
src_crs
)
ax
.
annotate
(
str
(
traj
[
0
]),
ax
.
projection
.
transform_point
(
xy
[
0
,
0
],
xy
[
0
,
1
],
src_crs
),
xytext
=
(
3
*
random
.
random
(),
3
*
random
.
random
()),
textcoords
=
"
offset points
"
)
ax
.
coastlines
()
ax
.
gridlines
(
draw_labels
=
True
)
plt
.
show
()
This diff is collapsed.
Click to expand it.
Trajectories/report_graph.py
0 → 120000
+
1
−
0
View file @
38374ff0
..
/
Overlap
/
report_graph
.
py
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Trajectories/util_eddies.py
0 → 120000
+
1
−
0
View file @
38374ff0
..
/
Common
/
util_eddies
.
py
\ No newline at end of file
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