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
034d96fe
Commit
034d96fe
authored
3 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Use function `open_shpc`
parent
fbb09dd4
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/eddy_dump.py
+18
-19
18 additions, 19 deletions
Inst_eddies/Analysis/eddy_dump.py
with
18 additions
and
19 deletions
Inst_eddies/Analysis/eddy_dump.py
+
18
−
19
View file @
034d96fe
...
...
@@ -10,6 +10,8 @@ import shapefile
from
os
import
path
import
pprint
import
sys
sys
.
path
.
append
(
path
.
join
(
sys
.
path
[
0
],
"
../../Common
"
))
import
util_detect_eddies
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"
directory
"
,
help
=
"
containing the three shapefiles
"
)
...
...
@@ -19,27 +21,24 @@ reply = input("days_1950, eddy_index = ? ").split(",")
days_1950
=
int
(
reply
[
0
])
eddy_index
=
int
(
reply
[
1
])
# Find ishape:
filename
=
path
.
join
(
args
.
directory
,
"
extremum
"
)
readers
,
d_init
,
ishape_last
=
util_detect_eddies
.
open_shpc
(
args
.
directory
)
with
shapefile
.
Reader
(
filename
)
as
f
:
for
ishape
,
rec
in
enumerate
(
f
.
iterRecords
()):
if
rec
[
"
days_1950
"
]
==
days_1950
and
rec
[
"
eddy_index
"
]
==
eddy_index
:
break
else
:
sys
.
exit
(
"
Not found
"
)
# Find ishape
:
for
ishape
,
rec
in
enumerate
(
readers
[
"
extremum
"
]
.
iterRecords
()):
if
rec
[
"
days_1950
"
]
==
days_1950
and
rec
[
"
eddy_index
"
]
==
eddy_index
:
break
else
:
sys
.
exit
(
"
Not found
"
)
#--
for
basename
in
[
"
extremum
"
,
"
outermost_contour
"
,
"
max_speed_contour
"
]:
filename
=
path
.
join
(
args
.
directory
,
basename
)
with
shapefile
.
Reader
(
filename
)
as
f
:
shapeRec
=
f
.
shapeRecord
(
ishape
)
print
(
"
\n
"
,
filename
,
"
:
"
)
if
shapeRec
.
shape
.
shapeType
==
shapefile
.
NULL
:
dct
=
shapeRec
.
record
.
as_dict
()
pprint
.
pprint
(
dct
)
print
(
"
null shape
"
)
else
:
pprint
.
pprint
(
shapeRec
.
__geo_interface__
)
shapeRec
=
readers
[
basename
].
shapeRecord
(
ishape
)
print
(
"
\n
"
,
filename
,
"
:
"
)
if
shapeRec
.
shape
.
shapeType
==
shapefile
.
NULL
:
dct
=
shapeRec
.
record
.
as_dict
()
pprint
.
pprint
(
dct
)
print
(
"
null shape
"
)
else
:
pprint
.
pprint
(
shapeRec
.
__geo_interface__
)
This diff is collapsed.
Click to expand it.
GUEZ Lionel
@guez
mentioned in commit
baec7360
·
2 years ago
mentioned in commit
baec7360
mentioned in commit baec7360d4b8d4392823da24ae526c681c398151
Toggle commit list
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