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
31344268
Commit
31344268
authored
2 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Do not read twice the position of extrema
parent
84fa690c
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
+5
-20
5 additions, 20 deletions
cost_function.py
with
5 additions
and
20 deletions
cost_function.py
+
5
−
20
View file @
31344268
...
...
@@ -148,26 +148,6 @@ for n in g.vertices():
segment
=
g
.
vp
.
inst_eddies
[
n
]
len_seg
=
len
(
segment
)
# Calculate the date index, the eddy index and the SHPC index of
# the first instantaneous eddy in the segment, then grab the
# position of the extremum and store it in a vertex property:
date_index
,
eddy_index
=
report_graph
.
node_to_date_eddy
(
segment
[
0
],
e_overestim
)
i_SHPC
=
get_SHPC
(
array_d_init
,
date_index
)
ishape
=
util_eddies
.
comp_ishape
(
handlers
[
i_SHPC
],
date_index
,
eddy_index
)
g
.
vp
.
pos_first
[
n
]
=
handlers
[
i_SHPC
][
"
readers
"
][
"
extremum
"
]
\
.
shape
(
ishape
).
points
[
0
]
# [in degrees]
# Same for last instantaneous eddy in the segment:
date_index
,
eddy_index
=
report_graph
.
node_to_date_eddy
(
segment
[
-
1
],
e_overestim
)
i_SHPC
=
get_SHPC
(
array_d_init
,
date_index
)
ishape
=
util_eddies
.
comp_ishape
(
handlers
[
i_SHPC
],
date_index
,
eddy_index
)
g
.
vp
.
pos_last
[
n
]
=
handlers
[
i_SHPC
][
"
readers
"
][
"
extremum
"
]
\
.
shape
(
ishape
).
points
[
0
]
# [in degrees]
if
len_seg
>
n_days_avg
:
# The segment is longer than the number of days over which
# to average
...
...
@@ -177,12 +157,14 @@ for n in g.vertices():
array_d_init
,
handlers
)
g
.
vp
.
first_av_rad
[
n
],
g
.
vp
.
first_av_ros
[
n
]
\
=
calculate_radii_rossby
(
properties
)
g
.
vp
.
pos_first
[
n
]
=
properties
[
0
][
"
pos
"
]
# in degrees
# Last 7 days calculation:
properties
=
node_to_prop
(
segment
[
-
n_days_avg
:],
e_overestim
,
array_d_init
,
handlers
)
g
.
vp
.
last_av_rad
[
n
],
g
.
vp
.
last_av_ros
[
n
]
\
=
calculate_radii_rossby
(
properties
)
g
.
vp
.
pos_last
[
n
]
=
properties
[
-
1
][
"
pos
"
]
# in degrees
else
:
# The number of eddies in a segment is lower than the number
# of days over which to average. The values will be the same
...
...
@@ -199,6 +181,9 @@ for n in g.vertices():
g
.
vp
.
first_av_rad
[
n
]
=
avg_rad
g
.
vp
.
last_av_rad
[
n
]
=
avg_rad
g
.
vp
.
pos_first
[
n
]
=
properties
[
0
][
"
pos
"
]
# in degrees
g
.
vp
.
pos_last
[
n
]
=
properties
[
-
1
][
"
pos
"
]
# in degrees
t1
=
time
.
perf_counter
()
timings
.
write
(
f
"
iterating on vertices:
{
t1
-
t0
:
.
0
f
}
s
\n
"
)
t0
=
t1
...
...
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