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
d47e1f03
Commit
d47e1f03
authored
1 year ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Add the possibility of dates in any slice
Previously the script worked only for dates in slice 0.
parent
cbdf0461
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
Inst_eddies/Analysis/anim_eddy_contours.py
+11
-7
11 additions, 7 deletions
Inst_eddies/Analysis/anim_eddy_contours.py
with
11 additions
and
7 deletions
Inst_eddies/Analysis/anim_eddy_contours.py
+
11
−
7
View file @
d47e1f03
...
@@ -25,7 +25,7 @@ def compute_bbox(ishape_list, reader_outer):
...
@@ -25,7 +25,7 @@ def compute_bbox(ishape_list, reader_outer):
return
bbox
return
bbox
def
func
(
d
,
ax
,
ishape_lists_all
,
SHPC
,
bbox
,
light
):
def
func
(
d
,
ax
,
i_slices
,
ishape_lists_all
,
SHPC
,
bbox
,
light
):
"""
To be passed as argument to the animation
"""
To be passed as argument to the animation
function. ishape_lists_all is a dictionary.
function. ishape_lists_all is a dictionary.
...
@@ -37,7 +37,7 @@ def func(d, ax, ishape_lists_all, SHPC, bbox, light):
...
@@ -37,7 +37,7 @@ def func(d, ax, ishape_lists_all, SHPC, bbox, light):
for
orientation
in
[
"
Anticyclones
"
,
"
Cyclones
"
]:
for
orientation
in
[
"
Anticyclones
"
,
"
Cyclones
"
]:
plot_eddy_contours
.
snapshot
(
ax
,
ishape_lists_all
[
orientation
][
d
],
SHPC
,
plot_eddy_contours
.
snapshot
(
ax
,
ishape_lists_all
[
orientation
][
d
],
SHPC
,
0
,
orientation
,
light
=
light
)
i_slices
[
d
]
,
orientation
,
light
=
light
)
ax
.
gridlines
(
draw_labels
=
True
)
ax
.
gridlines
(
draw_labels
=
True
)
ax
.
coastlines
()
ax
.
coastlines
()
...
@@ -47,12 +47,16 @@ def anim_eddies(fig, ax, SHPC, window, d_min, d_max, light):
...
@@ -47,12 +47,16 @@ def anim_eddies(fig, ax, SHPC, window, d_min, d_max, light):
"""
SHPC is an instance of SHPC_class.
"""
"""
SHPC is an instance of SHPC_class.
"""
ishape_lists_all
=
{}
ishape_lists_all
=
{}
i_slices
=
{}
for
d
in
range
(
d_min
,
d_max
+
1
):
i_slices
[
d
]
=
SHPC
.
get_slice
(
d
)
for
orientation
in
[
"
Anticyclones
"
,
"
Cyclones
"
]:
for
orientation
in
[
"
Anticyclones
"
,
"
Cyclones
"
]:
ishape_lists_all
[
orientation
]
=
{}
ishape_lists_all
[
orientation
]
=
{}
for
d
in
range
(
d_min
,
d_max
+
1
):
for
d
in
range
(
d_min
,
d_max
+
1
):
ishape_lists_all
[
orientation
][
d
]
=
plot_eddy_contours
.
select_ishapes
(
d
,
SHPC
,
0
,
orientation
,
ishape_lists_all
[
orientation
][
d
]
=
plot_eddy_contours
.
select_ishapes
(
d
,
SHPC
,
i_slices
[
d
]
,
orientation
,
window
)
window
)
if
window
is
None
:
if
window
is
None
:
...
@@ -61,14 +65,14 @@ def anim_eddies(fig, ax, SHPC, window, d_min, d_max, light):
...
@@ -61,14 +65,14 @@ def anim_eddies(fig, ax, SHPC, window, d_min, d_max, light):
for
orientation
in
[
"
Anticyclones
"
,
"
Cyclones
"
]:
for
orientation
in
[
"
Anticyclones
"
,
"
Cyclones
"
]:
for
d
in
range
(
d_min
,
d_max
+
1
):
for
d
in
range
(
d_min
,
d_max
+
1
):
b2
=
compute_bbox
(
ishape_lists_all
[
orientation
][
d
],
b2
=
compute_bbox
(
ishape_lists_all
[
orientation
][
d
],
SHPC
.
get_reader
(
0
,
orientation
,
SHPC
.
get_reader
(
i_slices
[
d
]
,
orientation
,
"
outermost_contour
"
))
"
outermost_contour
"
))
bbox
=
bbox_union
(
bbox
,
b2
)
bbox
=
bbox_union
(
bbox
,
b2
)
else
:
else
:
bbox
=
window
bbox
=
window
ani
=
animation
.
FuncAnimation
(
fig
,
func
,
range
(
d_min
,
d_max
+
1
),
ani
=
animation
.
FuncAnimation
(
fig
,
func
,
range
(
d_min
,
d_max
+
1
),
fargs
=
(
ax
,
ishape_lists_all
,
SHPC
,
bbox
,
fargs
=
(
ax
,
i_slices
,
ishape_lists_all
,
SHPC
,
bbox
,
light
),
interval
=
500
)
light
),
interval
=
500
)
return
ani
return
ani
...
@@ -104,8 +108,8 @@ if __name__ == "__main__":
...
@@ -104,8 +108,8 @@ if __name__ == "__main__":
d_min
=
args
.
dates
[
0
]
d_min
=
args
.
dates
[
0
]
d_max
=
args
.
dates
[
1
]
d_max
=
args
.
dates
[
1
]
if
not
SHPC
.
d_init
[
0
]
<=
d_min
<
d_max
<=
SHPC
.
d_init
[
0
]
\
if
not
SHPC
.
d_init
[
0
]
<=
d_min
<
d_max
<=
SHPC
.
d_init
[
-
1
]
\
+
SHPC
.
get_n_dates
(
0
)
-
1
:
+
SHPC
.
get_n_dates
(
SHPC
.
n_slices
-
1
)
-
1
:
sys
.
exit
(
"
Bad dates specified
"
)
sys
.
exit
(
"
Bad dates specified
"
)
else
:
else
:
d_min
=
SHPC
.
d_init
[
0
]
d_min
=
SHPC
.
d_init
[
0
]
...
...
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