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
3b799af4
Commit
3b799af4
authored
2 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Return a tuple from `calculate_radii_rossby`
Return a tuple from function `calculate_radii_rossby` instead of a dictionary.
parent
c72f0bad
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cost_function.py
+9
-23
9 additions, 23 deletions
cost_function.py
with
9 additions
and
23 deletions
cost_function.py
+
9
−
23
View file @
3b799af4
...
...
@@ -62,7 +62,7 @@ def calculate_radii_rossby(list_eddies, e_overestim, handlers, array_d_init):
avg_rad
/=
len
(
list_eddies
)
if
n_valid_Rossby
!=
0
:
avg_Rossby
/=
n_valid_Rossby
return
{
"
avg_rad
"
:
avg_rad
,
"
avg_Rossby
"
:
avg_Rossby
}
return
avg_rad
,
avg_Rossby
def
get_SHPC
(
array_d_ini
,
date_index
):
i_SHPC
=
bisect
.
bisect
(
array_d_init
,
date_index
)
-
1
...
...
@@ -159,40 +159,26 @@ for n in g.vertices():
# to average
# First 7 days calculation
first_res
=
calculate_radii_rossby
(
segment
[:
num_of_days_to_avg
],
e_overestim
,
handlers
,
array_d_init
)
# Average and assign the first radii:
g
.
vp
.
first_av_rad
[
n
]
=
first_res
[
'
avg_rad
'
]
# Average and assign the rossbies:
g
.
vp
.
first_av_ros
[
n
]
=
first_res
[
'
avg_Rossby
'
]
g
.
vp
.
first_av_rad
[
n
],
g
.
vp
.
first_av_ros
[
n
]
\
=
calculate_radii_rossby
(
segment
[:
num_of_days_to_avg
],
e_overestim
,
handlers
,
array_d_init
)
# Last 7 days calculation:
last_res
=
calculate_radii_rossby
(
segment
[
-
num_of_days_to_avg
:],
e_overestim
,
handlers
,
array_d_init
)
# Average and assign the last radii
g
.
vp
.
last_av_rad
[
n
]
=
last_res
[
'
avg_rad
'
]
# Average and assign the rossbies:
g
.
vp
.
last_av_ros
[
n
]
=
last_res
[
'
avg_Rossby
'
]
g
.
vp
.
last_av_rad
[
n
],
g
.
vp
.
last_av_ros
[
n
]
\
=
calculate_radii_rossby
(
segment
[
-
num_of_days_to_avg
:],
e_overestim
,
handlers
,
array_d_init
)
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
# except for the positions.
res
=
calculate_radii_rossby
(
segment
,
e_overestim
,
handlers
,
array_d_init
)
avg_rad
,
avg_Rossby
=
calculate_radii_rossby
(
segment
,
e_overestim
,
handlers
,
array_d_init
)
# Average and assign the rossbies:
avg_Rossby
=
res
[
'
avg_Rossby
'
]
g
.
vp
.
first_av_ros
[
n
]
=
avg_Rossby
g
.
vp
.
last_av_ros
[
n
]
=
avg_Rossby
# Average and assign the radii
avg_rad
=
res
[
'
avg_rad
'
]
g
.
vp
.
first_av_rad
[
n
]
=
avg_rad
g
.
vp
.
last_av_rad
[
n
]
=
avg_rad
...
...
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