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
050a48f5
Commit
050a48f5
authored
9 months ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Define functions `search_beg` and `search_end`
Preparing for generalization of these functions.
parent
201c7522
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
Trajectories/cost_function.py
+7
-2
7 additions, 2 deletions
Trajectories/cost_function.py
with
7 additions
and
2 deletions
Trajectories/cost_function.py
+
7
−
2
View file @
050a48f5
...
...
@@ -102,6 +102,11 @@ def node_to_prop(node_list, e_overestim, SHPC, orientation):
return
properties
def
search_beg
(
inst_eddies
,
max_delta
):
return
min
(
max_delta
+
1
,
len
(
inst_eddies
))
def
search_end
(
inst_eddies
,
max_delta
):
return
max
(
len
(
inst_eddies
)
-
max_delta
-
1
,
0
)
t0
=
time
.
perf_counter
()
timings
=
open
(
"
timings_cost.txt
"
,
"
w
"
)
...
...
@@ -174,7 +179,7 @@ print("Iterating on vertices...")
for
n
in
g
.
vertices
():
if
n
.
in_degree
()
!=
0
:
# Define properties for beginning of the segment:
ip_beg
=
min
(
n_days_avg
,
len
(
g
.
vp
.
inst_eddies
[
n
]
)
)
ip_beg
=
search_beg
(
g
.
vp
.
inst_eddies
[
n
]
,
n_days_avg
-
1
)
properties
=
node_to_prop
(
g
.
vp
.
inst_eddies
[
n
][:
ip_beg
],
g
.
gp
.
e_overestim
,
...
...
@@ -194,7 +199,7 @@ for n in g.vertices():
if
ip_beg
<
len_seg
:
# We have to read more from the shapefiles and redefine
# properties.
ip_end
=
max
(
len_seg
-
n_days_avg
,
0
)
ip_end
=
search_end
(
g
.
vp
.
inst_eddies
[
n
],
n_days_avg
-
1
)
if
ip_beg
<=
ip_end
:
# We cannot use part of properties from the beginning
...
...
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