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
Admin message
Gitlab has been updated. More info
here
.
Show more breadcrumbs
IPSL
LMD
DPAO
Detection eddies
Commits
9165f777
Commit
9165f777
authored
2 years ago
by
Lionel GUEZ
Browse files
Options
Downloads
Patches
Plain Diff
Use argparse
Preparing to introduce an option.
parent
e74ae8d9
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
-5
5 additions, 5 deletions
cost_function.py
with
5 additions
and
5 deletions
cost_function.py
+
5
−
5
View file @
9165f777
...
@@ -27,8 +27,8 @@ import datetime
...
@@ -27,8 +27,8 @@ import datetime
from
numpy
import
loadtxt
from
numpy
import
loadtxt
import
report_graph
import
report_graph
import
util_eddies
import
util_eddies
import
sys
import
bisect
import
bisect
import
argparse
def
calculate_radii_rossby
(
start
,
end
,
inc
,
segment
,
e_overestim
,
handlers
,
def
calculate_radii_rossby
(
start
,
end
,
inc
,
segment
,
e_overestim
,
handlers
,
array_d_init
):
array_d_init
):
...
@@ -76,9 +76,9 @@ def get_SHPC(array_d_ini, date_index):
...
@@ -76,9 +76,9 @@ def get_SHPC(array_d_ini, date_index):
t0
=
time
.
perf_counter
()
t0
=
time
.
perf_counter
()
timings
=
open
(
"
timings.txt
"
,
"
w
"
)
timings
=
open
(
"
timings.txt
"
,
"
w
"
)
parser
=
argparse
.
ArgumentParser
()
if
len
(
sys
.
argv
)
==
1
:
parser
.
add_argument
(
"
SHPC_dir
"
,
nargs
=
'
+
'
)
sys
.
exit
(
"
Required arguments: SHPC-directory [SHPC-directory] ...
"
)
args
=
parser
.
parse_args
(
)
# Grab e_overestim:
# Grab e_overestim:
with
open
(
"
node_id_param.json
"
)
as
f
:
node_id_param
=
json
.
load
(
f
)
with
open
(
"
node_id_param.json
"
)
as
f
:
node_id_param
=
json
.
load
(
f
)
...
@@ -125,7 +125,7 @@ g.ep['cost_function'] = g.new_ep('float')
...
@@ -125,7 +125,7 @@ g.ep['cost_function'] = g.new_ep('float')
# Set up the list of SHPC:
# Set up the list of SHPC:
handlers
=
[
util_eddies
.
open_shpc
(
shpc_dir
)
for
shpc_dir
in
sys
.
argv
[
1
:]
]
handlers
=
[
util_eddies
.
open_shpc
(
shpc_dir
)
for
shpc_dir
in
args
.
SHPC_dir
]
array_d_init
=
[
handler
[
"
d_init
"
]
for
handler
in
handlers
]
array_d_init
=
[
handler
[
"
d_init
"
]
for
handler
in
handlers
]
# (create the list once and for all)
# (create the list once and for all)
...
...
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