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
9f31076f
Commit
9f31076f
authored
4 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Make the function `date_index` more meaningful
parent
0999134b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Convert_Matlab/overlap_v6.py
+6
-7
6 additions, 7 deletions
Convert_Matlab/overlap_v6.py
with
6 additions
and
7 deletions
Convert_Matlab/overlap_v6.py
+
6
−
7
View file @
9f31076f
...
@@ -10,13 +10,12 @@ import datetime
...
@@ -10,13 +10,12 @@ import datetime
import
csv
import
csv
import
sys
import
sys
def
date_index
(
k
):
def
date_index
(
date_num
):
"""
Co
mpute the number of days since Jan 1st 1950, given the subscrip
t
"""
Co
nvert Matlab serial date number to number of days since Jan 1s
t
index in date_num
.
1950
.
"""
"""
date
=
datetime
.
date
.
fromordinal
(
date_num
[
k
]
-
366
)
-
datetime
.
date
(
1950
,
date
=
datetime
.
date
.
fromordinal
(
date_num
-
366
)
-
datetime
.
date
(
1950
,
1
,
1
)
1
,
1
)
return
date
.
days
return
date
.
days
def
convert_id
(
node_index
):
def
convert_id
(
node_index
):
...
@@ -26,7 +25,7 @@ def convert_id(node_index):
...
@@ -26,7 +25,7 @@ def convert_id(node_index):
"""
"""
k
=
(
node_index
-
1
)
//
n_max
k
=
(
node_index
-
1
)
//
n_max
eddy_index
=
node_index
-
k
*
n_max
eddy_index
=
node_index
-
k
*
n_max
return
date_index
(
k
),
eddy_index
return
date_index
(
date_num
[
k
]
),
eddy_index
orientation
=
sys
.
argv
[
1
]
# "cyclo" or "anti"
orientation
=
sys
.
argv
[
1
]
# "cyclo" or "anti"
id_child
=
sio
.
loadmat
(
f
"
id_child_
{
orientation
}
.mat
"
,
squeeze_me
=
True
)
\
id_child
=
sio
.
loadmat
(
f
"
id_child_
{
orientation
}
.mat
"
,
squeeze_me
=
True
)
\
...
@@ -46,7 +45,7 @@ with open(f"edgelist_{orientation}.csv", "w", newline = '') as edgelist:
...
@@ -46,7 +45,7 @@ with open(f"edgelist_{orientation}.csv", "w", newline = '') as edgelist:
writer
.
writerow
([
"
k1
"
,
"
i1
"
,
"
k2
"
,
"
i2
"
])
writer
.
writerow
([
"
k1
"
,
"
i1
"
,
"
k2
"
,
"
i2
"
])
for
k1
in
range
(
n_dates
):
for
k1
in
range
(
n_dates
):
d1
=
date_index
(
k1
)
d1
=
date_index
(
date_num
[
k1
]
)
for
i1
,
id_child_1
in
enumerate
(
id_child
[:
n_eddies
[
k1
],
k1
]):
for
i1
,
id_child_1
in
enumerate
(
id_child
[:
n_eddies
[
k1
],
k1
]):
e1
=
i1
+
1
e1
=
i1
+
1
...
...
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