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
294e1e59
Commit
294e1e59
authored
2 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Remove intermediary variable segment
parent
5f643d03
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
cost_function.py
+7
-8
7 additions, 8 deletions
cost_function.py
with
7 additions
and
8 deletions
cost_function.py
+
7
−
8
View file @
294e1e59
...
@@ -145,23 +145,22 @@ print("Iterating on vertices...")
...
@@ -145,23 +145,22 @@ print("Iterating on vertices...")
for
n
in
g
.
vertices
():
for
n
in
g
.
vertices
():
if
n
.
in_degree
()
!=
0
or
n
.
out_degree
()
!=
0
:
if
n
.
in_degree
()
!=
0
or
n
.
out_degree
()
!=
0
:
segment
=
g
.
vp
.
inst_eddies
[
n
]
len_seg
=
len
(
g
.
vp
.
inst_eddies
[
n
])
len_seg
=
len
(
segment
)
if
len_seg
>
n_days_avg
:
if
len_seg
>
n_days_avg
:
# The segment is longer than the number of days over which
# The segment is longer than the number of days over which
# to average
# to average
# First 7 days calculation
# First 7 days calculation
properties
=
node_to_prop
(
segment
[:
n_days_avg
],
e_overestim
,
properties
=
node_to_prop
(
g
.
vp
.
inst_eddies
[
n
]
[:
n_days_avg
],
array_d_init
,
handlers
)
e_overestim
,
array_d_init
,
handlers
)
g
.
vp
.
first_av_rad
[
n
],
g
.
vp
.
first_av_ros
[
n
]
\
g
.
vp
.
first_av_rad
[
n
],
g
.
vp
.
first_av_ros
[
n
]
\
=
calculate_radii_rossby
(
properties
)
=
calculate_radii_rossby
(
properties
)
g
.
vp
.
pos_first
[
n
]
=
properties
[
0
][
"
pos
"
]
# in degrees
g
.
vp
.
pos_first
[
n
]
=
properties
[
0
][
"
pos
"
]
# in degrees
# Last 7 days calculation:
# Last 7 days calculation:
properties
=
node_to_prop
(
segment
[
-
n_days_avg
:],
e_overestim
,
properties
=
node_to_prop
(
g
.
vp
.
inst_eddies
[
n
]
[
-
n_days_avg
:],
array_d_init
,
handlers
)
e_overestim
,
array_d_init
,
handlers
)
g
.
vp
.
last_av_rad
[
n
],
g
.
vp
.
last_av_ros
[
n
]
\
g
.
vp
.
last_av_rad
[
n
],
g
.
vp
.
last_av_ros
[
n
]
\
=
calculate_radii_rossby
(
properties
)
=
calculate_radii_rossby
(
properties
)
g
.
vp
.
pos_last
[
n
]
=
properties
[
-
1
][
"
pos
"
]
# in degrees
g
.
vp
.
pos_last
[
n
]
=
properties
[
-
1
][
"
pos
"
]
# in degrees
...
@@ -170,8 +169,8 @@ for n in g.vertices():
...
@@ -170,8 +169,8 @@ for n in g.vertices():
# equal to the number of days over which to average. The
# equal to the number of days over which to average. The
# values for the end of the segment will be the same as
# values for the end of the segment will be the same as
# for the begining, except for the position.
# for the begining, except for the position.
properties
=
node_to_prop
(
segment
,
e_overestim
,
array_d_init
,
properties
=
node_to_prop
(
g
.
vp
.
inst_eddies
[
n
],
e_overestim
,
handlers
)
array_d_init
,
handlers
)
g
.
vp
.
first_av_rad
[
n
],
g
.
vp
.
first_av_ros
[
n
]
\
g
.
vp
.
first_av_rad
[
n
],
g
.
vp
.
first_av_ros
[
n
]
\
=
calculate_radii_rossby
(
properties
)
=
calculate_radii_rossby
(
properties
)
g
.
vp
.
last_av_rad
[
n
]
=
g
.
vp
.
first_av_rad
[
n
]
g
.
vp
.
last_av_rad
[
n
]
=
g
.
vp
.
first_av_rad
[
n
]
...
...
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