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
f3c35de3
Commit
f3c35de3
authored
8 months ago
by
GUEZ Lionel
Browse files
Options
Downloads
Patches
Plain Diff
Blacken
parent
6d1af436
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/stat_SHPC.py
+26
-16
26 additions, 16 deletions
Inst_eddies/Analysis/stat_SHPC.py
with
26 additions
and
16 deletions
Inst_eddies/Analysis/stat_SHPC.py
+
26
−
16
View file @
f3c35de3
...
@@ -7,37 +7,43 @@ from os import path
...
@@ -7,37 +7,43 @@ from os import path
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"
SHPC
"
)
parser
.
add_argument
(
"
SHPC
"
)
parser
.
add_argument
(
"
orientation
"
,
choices
=
[
"
Anticyclones
"
,
"
Cyclones
"
])
parser
.
add_argument
(
"
orientation
"
,
choices
=
[
"
Anticyclones
"
,
"
Cyclones
"
])
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
n_points
=
0
n_points
=
0
n_valid_speed
=
0
n_valid_speed
=
0
with
shapefile
.
Reader
(
path
.
join
(
args
.
SHPC
,
"
Slice_0
"
,
args
.
orientation
,
with
shapefile
.
Reader
(
"
extremum
"
))
as
extremum
,
\
path
.
join
(
args
.
SHPC
,
"
Slice_0
"
,
args
.
orientation
,
"
extremum
"
)
shapefile
.
Reader
(
path
.
join
(
args
.
SHPC
,
"
Slice_0
"
,
args
.
orientation
,
)
as
extremum
,
shapefile
.
Reader
(
"
outermost_contour
"
))
as
outermost_contour
:
path
.
join
(
args
.
SHPC
,
"
Slice_0
"
,
args
.
orientation
,
"
outermost_contour
"
)
)
as
outermost_contour
:
n_extr
=
len
(
extremum
)
n_extr
=
len
(
extremum
)
print
(
"
number of extrema of SSH:
"
,
n_extr
,
"
\n
"
)
print
(
"
number of extrema of SSH:
"
,
n_extr
,
"
\n
"
)
field_names_outer
=
[
f
[
0
]
for
f
in
outermost_contour
.
fields
[
1
:]]
field_names_outer
=
[
f
[
0
]
for
f
in
outermost_contour
.
fields
[
1
:]]
for
rec_extr
,
shape_rec_outer
in
zip
(
extremum
.
iterRecords
(),
for
rec_extr
,
shape_rec_outer
in
zip
(
outermost_contour
):
extremum
.
iterRecords
(),
outermost_contour
):
l
=
len
(
shape_rec_outer
.
shape
.
points
)
l
=
len
(
shape_rec_outer
.
shape
.
points
)
n_points
+=
l
n_points
+=
l
if
rec_extr
.
speed
!=
1e4
:
if
rec_extr
.
speed
!=
1e4
:
n_valid_speed
+=
1
n_valid_speed
+=
1
print
(
"
average number of points of outermost contour per extremum:
"
,
print
(
n_points
/
n_extr
,
"
\n
"
)
"
average number of points of outermost contour per extremum:
"
,
n_points
/
n_extr
,
"
\n
"
,
)
print
(
"
number of valid speed values:
"
,
n_valid_speed
)
print
(
"
number of valid speed values:
"
,
n_valid_speed
)
n_max_speed
=
0
n_max_speed
=
0
n_points
=
0
n_points
=
0
with
shapefile
.
Reader
(
path
.
join
(
args
.
SHPC
,
"
Slice_0
"
,
args
.
orientation
,
with
shapefile
.
Reader
(
"
max_speed_contour
"
))
as
max_speed_contour
:
path
.
join
(
args
.
SHPC
,
"
Slice_0
"
,
args
.
orientation
,
"
max_speed_contour
"
)
)
as
max_speed_contour
:
for
shape_rec
in
max_speed_contour
:
for
shape_rec
in
max_speed_contour
:
l
=
len
(
shape_rec
.
shape
.
points
)
l
=
len
(
shape_rec
.
shape
.
points
)
...
@@ -45,10 +51,14 @@ with shapefile.Reader(path.join(args.SHPC, "Slice_0", args.orientation,
...
@@ -45,10 +51,14 @@ with shapefile.Reader(path.join(args.SHPC, "Slice_0", args.orientation,
n_max_speed
+=
1
n_max_speed
+=
1
n_points
+=
l
n_points
+=
l
print
(
"
number of non-null maximum-speed contours (distinct from the
"
print
(
"
outermost contour):
"
,
"
number of non-null maximum-speed contours (distinct from the
"
n_max_speed
)
"
outermost contour):
"
,
n_max_speed
,
)
if
n_max_speed
!=
0
:
if
n_max_speed
!=
0
:
print
(
"
average number of points of non-null maximum-speed contours:
"
,
print
(
n_points
/
n_max_speed
)
"
average number of points of non-null maximum-speed contours:
"
,
n_points
/
n_max_speed
,
)
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