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
c1fb15af
Commit
c1fb15af
authored
4 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Rename `shp_tr_dir` to `shp_coll_dir`
There may be a fourth shapefile for centers of eddies.
parent
a024b7cc
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/plot_eddy_contours.py
+10
-10
10 additions, 10 deletions
Analysis/plot_eddy_contours.py
with
10 additions
and
10 deletions
Analysis/plot_eddy_contours.py
+
10
−
10
View file @
c1fb15af
...
...
@@ -141,10 +141,10 @@ def snapshot(ax, ishape_list, readers, *, dashed = False, light = False,
if
not
light
:
lines
[
0
].
set_marker
(
"
o
"
)
if
dashed
:
lines
[
0
].
set_linestyle
(
"
dashed
"
)
def
plot_grid_bb
(
shp_
tr
_dir
,
ax
):
def
plot_grid_bb
(
shp_
coll
_dir
,
ax
):
"""
Grid bounding box.
"""
file
=
path
.
join
(
shp_
tr
_dir
,
"
grid_nml.txt
"
)
file
=
path
.
join
(
shp_
coll
_dir
,
"
grid_nml.txt
"
)
grid_nml
=
f90nml
.
read
(
file
)[
"
grid_nml
"
]
rect
=
patches
.
Rectangle
(
grid_nml
[
"
corner_deg
"
],
(
grid_nml
[
"
nlon
"
]
-
1
)
*
0.25
,
...
...
@@ -199,20 +199,20 @@ def make_animation(fig, ax, k1, ishape_last, readers, window, k_min, k_max,
interval
=
500
)
return
ani
def
open_shpt
(
shp_
tr
_dir
):
readers
=
{
"
extr
"
:
shapefile
.
Reader
(
path
.
join
(
shp_
tr
_dir
,
"
extremum
"
)),
def
open_shpt
(
shp_
coll
_dir
):
readers
=
{
"
extr
"
:
shapefile
.
Reader
(
path
.
join
(
shp_
coll
_dir
,
"
extremum
"
)),
"
outer
"
:
shapefile
.
Reader
(
path
.
join
(
shp_
tr
_dir
,
"
outermost_contour
"
))}
shapefile
.
Reader
(
path
.
join
(
shp_
coll
_dir
,
"
outermost_contour
"
))}
try
:
readers
[
"
m_s
"
]
=
shapefile
.
Reader
(
path
.
join
(
shp_
tr
_dir
,
readers
[
"
m_s
"
]
=
shapefile
.
Reader
(
path
.
join
(
shp_
coll
_dir
,
"
max_speed_contour
"
))
except
shapefile
.
ShapefileException
:
print
(
"
Shapefile max_speed_contour not found.
"
"
Max-speed contours will not be plotted.
"
)
k1
=
readers
[
"
extr
"
].
record
(
0
).
date_index
fname
=
path
.
join
(
shp_
tr
_dir
,
"
ishape_last.txt
"
)
fname
=
path
.
join
(
shp_
coll
_dir
,
"
ishape_last.txt
"
)
try
:
ishape_last
=
np
.
loadtxt
(
fname
,
dtype
=
int
,
ndmin
=
1
)
...
...
@@ -248,7 +248,7 @@ if __name__ == "__main__":
help
=
"
dashed linestyle, useful for a second snapshot
"
)
parser
.
add_argument
(
"
-a
"
,
"
--anim
"
,
type
=
int
,
nargs
=
2
,
metavar
=
(
"
k_min
"
,
"
k_max
"
),
help
=
"
make animation
"
)
parser
.
add_argument
(
"
shp_
tr
_dir
"
,
help
=
"
containing the three shapefiles
"
)
parser
.
add_argument
(
"
shp_
coll
_dir
"
,
help
=
"
containing the three shapefiles
"
)
parser
.
add_argument
(
"
--save
"
,
metavar
=
"
format
"
,
help
=
"
Save file to specified format
"
)
args
=
parser
.
parse_args
()
...
...
@@ -275,7 +275,7 @@ if __name__ == "__main__":
lon_mask
=
np
.
ones
(
len
(
longitude
),
dtype
=
bool
)
lat_mask
=
np
.
ones
(
len
(
latitude
),
dtype
=
bool
)
readers
,
k1
,
ishape_last
=
open_shpt
(
args
.
shp_
tr
_dir
)
readers
,
k1
,
ishape_last
=
open_shpt
(
args
.
shp_
coll
_dir
)
fig
=
plt
.
figure
()
src_crs
=
ccrs
.
PlateCarree
()
projection
=
ccrs
.
PlateCarree
()
...
...
@@ -300,7 +300,7 @@ if __name__ == "__main__":
ax
.
plot
(
lon_2d
.
reshape
(
-
1
),
lat_2d
.
reshape
(
-
1
),
transform
=
src_crs
,
marker
=
"
+
"
,
color
=
"
gray
"
,
linestyle
=
"
None
"
)
if
args
.
window
is
None
:
plot_grid_bb
(
args
.
shp_
tr
_dir
,
ax
)
if
args
.
window
is
None
:
plot_grid_bb
(
args
.
shp_
coll
_dir
,
ax
)
ishape_list
=
select_ishapes
(
k
,
k1
,
ishape_last
,
readers
[
"
extr
"
],
args
.
window
)
ax
.
set_title
(
f
"
k =
{
k
}
"
,
y
=
1.05
)
...
...
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