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
e62a030f
Commit
e62a030f
authored
2 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Polish
parent
4411c857
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
Convert_Matlab/inst_eddies_v6.py
+15
-1
15 additions, 1 deletion
Convert_Matlab/inst_eddies_v6.py
Convert_Matlab/overlap_v6.py
+5
-6
5 additions, 6 deletions
Convert_Matlab/overlap_v6.py
Trajectories/trajectories.py
+2
-2
2 additions, 2 deletions
Trajectories/trajectories.py
with
22 additions
and
9 deletions
Convert_Matlab/inst_eddies_v6.py
+
15
−
1
View file @
e62a030f
...
...
@@ -6,7 +6,9 @@ SHPC_anti and SHPC_cyclo. The mat files are assumed to be in v7.3
before being read in Python. The data in each input file is the set of
detected instantaneous eddies at a given date. The second, optional,
argument of this script is the final date processed. The Matlab script
inst_eddies.m must be in the current directory at run-time.
inst_eddies.m must be in the current directory at run-time. If the adt
file contains variables `id_anti_cell` and `id_cyclo_cell` then we
also read `node_id_param.json`.
"""
...
...
@@ -154,6 +156,14 @@ matlab_data = sio.loadmat("adt_v6.mat", squeeze_me = True)
filter_ghosts
=
"
id_cyclo_cell
"
in
matlab_data
if
filter_ghosts
:
# We take into account ghost eddies in the Matlab adt file. Some
# eddies are duplicated in global adt files, at the border of the
# longitude domain. We should not use these ghost eddies. So
# R\'emi has added variables `id_anti_cell` and `id_cyclo_cell` in
# adt files. They contain Matlab node indices, n_prime,
# intersparsed with NaN values. We want to check that these node
# indices are correct so we compute our own n_prime from the date
# of the adt file. For this we need d_init and e_overestim.
with
open
(
"
node_id_param.json
"
)
as
f
:
node_id_param
=
json
.
load
(
f
)
n1
=
(
d
-
node_id_param
[
"
d_init
"
])
*
node_id_param
[
"
e_overestim
"
]
+
1
# (same starting node id for both orientations)
...
...
@@ -198,6 +208,10 @@ while True:
for
factory
in
factories
:
if
filter_ghosts
:
id_array
=
ma
.
fix_invalid
(
matlab_data
[
factory
[
"
id
"
]])
# This could be skipped, it is just a verification
# that there is no mistake in the Matlab variable
# factory["id"]:
id_array
=
np
.
rint
(
id_array
).
astype
(
int
)
n_eddies
=
id_array
.
count
()
# excluding ghosts
equal_range
\
...
...
This diff is collapsed.
Click to expand it.
Convert_Matlab/overlap_v6.py
+
5
−
6
View file @
e62a030f
#!/usr/bin/env python3
"""
This script reads the eddy graph from Matlab v6 files
id_child_*.mat and N_eddies.mat, for a given orientation, and
writes
the graph to a new file in edgelist format. It also reads
date_num.mat.
id_child_*.mat and N_eddies.mat, for a given orientation, and
writes
the graph to a new file in edgelist format. It also reads
date_num.mat.
"""
import
scipy.io
as
sio
import
csv
import
sys
import
json
import
datetime
import
numpy
as
np
...
...
@@ -37,8 +36,8 @@ if __name__ == "__main__":
for
i
in
range
(
n_files
):
print
(
f
"
Loading id_child_
{
i
}
.mat...
"
)
part_id_child
\
=
sio
.
loadmat
(
f
"
id_child_
{
i
}
.mat
"
,
squeeze_me
=
True
)
[
"
part_id_child
"
]
part_id_child
=
sio
.
loadmat
(
f
"
id_child_
{
i
}
.mat
"
,
squeeze_me
=
True
)
\
[
"
part_id_child
"
]
# part_id_child is a numpy array with shape (e_overestim, chunk)
# where chunk is lower than or equal to the number of dates in the
# original Matlab files.
...
...
This diff is collapsed.
Click to expand it.
Trajectories/trajectories.py
+
2
−
2
View file @
e62a030f
#!/usr/bin/env python3
"""
This script loads the graph of segments, with cost functions and
"""
This script loads the graph of segments, with cost functions
,
and
identifies trajectories.
Input
s
: the graph of segments produced by Graph-tool (gt or graphml
Input: the graph of segments produced by Graph-tool (
in
gt or graphml
format). Output: trajectories as lists of segments and as lists of
instantaneous eddies, in JSon files.
...
...
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