Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
IPSL
LMD
InTro
RoutingPP
Commits
27ba90a2
Commit
27ba90a2
authored
Jul 06, 2020
by
POLCHER Jan
🚴🏾
Browse files
Make the access to the run.def a little nicer and more general.
parent
2908da3a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
21 additions
and
24 deletions
+21
-24
HydroGrid.py
HydroGrid.py
+2
-3
Interface.py
Interface.py
+2
-3
ModelGrid.py
ModelGrid.py
+1
-4
Projections.py
Projections.py
+2
-4
RPPtools.py
RPPtools.py
+1
-1
RoutingPreProc.py
RoutingPreProc.py
+2
-4
WeightsOnly.py
WeightsOnly.py
+2
-3
getargs.py
getargs.py
+9
-2
No files found.
HydroGrid.py
View file @
27ba90a2
...
...
@@ -9,9 +9,8 @@ import RPPtools as RPP
import
os
import
sys
#
import
configparser
config
=
configparser
.
ConfigParser
()
config
.
read
(
"run.def"
)
import
getargs
config
=
getargs
.
SetupConfig
()
EarthRadius
=
config
.
getfloat
(
"OverAll"
,
"EarthRadius"
,
fallback
=
6370000.0
)
#
import
getargs
...
...
Interface.py
View file @
27ba90a2
...
...
@@ -25,9 +25,8 @@ MPI.COMM_WORLD.Barrier()
#
import
routing_interface
#
import
configparser
config
=
configparser
.
ConfigParser
()
config
.
read
(
"run.def"
)
import
getargs
config
=
getargs
.
SetupConfig
()
gendoc
=
config
.
get
(
"OverAll"
,
"Documentation"
,
fallback
=
'false'
)
nbxmax
=
config
.
getint
(
"OverAll"
,
"nbxmax"
,
fallback
=
63
)
largest_pos
=
config
.
getint
(
"OverAll"
,
"ROUTING_RIVERS"
,
fallback
=
200
)
...
...
ModelGrid.py
View file @
27ba90a2
...
...
@@ -9,11 +9,8 @@ from spherical_geometry import polygon
import
RPPtools
as
RPP
import
sys
#
import
configparser
config
=
configparser
.
ConfigParser
()
config
.
read
(
"run.def"
)
#
import
getargs
config
=
getargs
.
SetupConfig
()
log_master
,
log_world
=
getargs
.
getLogger
(
__name__
)
INFO
,
DEBUG
,
ERROR
=
log_master
.
info
,
log_master
.
debug
,
log_world
.
error
INFO_ALL
,
DEBUG_ALL
=
log_world
.
info
,
log_world
.
debug
...
...
Projections.py
View file @
27ba90a2
import
numpy
as
np
from
numba
import
jit
#
import
__main__
import
configparser
config
=
configparser
.
ConfigParser
()
config
.
read
(
__main__
.
ConfigFile
)
import
getargs
config
=
getargs
.
SetupConfig
()
#
EarthRadius
=
config
.
getfloat
(
"OverAll"
,
"EarthRadius"
,
fallback
=
6370000.0
)
rad_per_deg
=
np
.
pi
/
180.
...
...
RPPtools.py
View file @
27ba90a2
...
...
@@ -17,7 +17,7 @@ import time
#
import
configparser
config
=
configparser
.
ConfigParser
()
config
.
read
(
"run.def"
)
#
saveweights
=
config
.
get
(
"OverAll"
,
"WeightFile"
,
fallback
=
None
)
EarthRadius
=
config
.
getfloat
(
"OverAll"
,
"EarthRadius"
,
fallback
=
6370000.0
)
#
...
...
RoutingPreProc.py
View file @
27ba90a2
...
...
@@ -15,9 +15,8 @@ import time
# Gert the information from the configuration file.
#
ConfigFile
=
"run.def"
import
configparser
config
=
configparser
.
ConfigParser
()
config
.
read
(
ConfigFile
)
import
getargs
config
=
getargs
.
SetupConfig
()
nbasmax
=
config
.
getint
(
"OverAll"
,
"nbasmax"
)
numop
=
config
.
getint
(
"OverAll"
,
"numop"
,
fallback
=
100
)
OutGraphFile
=
config
.
get
(
"OverAll"
,
"GraphFile"
)
...
...
@@ -33,7 +32,6 @@ from Truncate import trunc as TR
#
# Logging in MPI : https://groups.google.com/forum/#!topic/mpi4py/SaNzc8bdj6U
#
import
getargs
log_master
,
log_world
=
getargs
.
getLogger
()
INFO
,
DEBUG
,
ERROR
=
log_master
.
info
,
log_master
.
debug
,
log_world
.
error
INFO_ALL
,
DEBUG_ALL
=
log_world
.
info
,
log_world
.
debug
...
...
WeightsOnly.py
View file @
27ba90a2
...
...
@@ -15,9 +15,8 @@ import time
# Get the information from the configuration file.
#
ConfigFile
=
"run.def"
import
configparser
config
=
configparser
.
ConfigParser
()
config
.
read
(
ConfigFile
)
import
getargs
config
=
getargs
.
SetupConfig
()
nbasmax
=
config
.
getint
(
"OverAll"
,
"nbasmax"
)
numop
=
config
.
getint
(
"OverAll"
,
"numop"
,
fallback
=
100
)
OutGraphFile
=
config
.
get
(
"OverAll"
,
"GraphFile"
)
...
...
getargs.py
View file @
27ba90a2
...
...
@@ -10,7 +10,15 @@ parse = parser.parse_args
add
(
"--dt"
,
type
=
float
,
help
=
'Time step in seconds'
)
add
(
"--debug"
,
default
=
[],
type
=
lambda
str
:
str
.
split
(
','
),
help
=
'Comma-separated list of modules that will display debug information'
)
def
SetupConfig
()
:
from
__main__
import
ConfigFile
import
configparser
config
=
configparser
.
ConfigParser
()
config
.
read
(
ConfigFile
)
return
config
def
noop
(
*
args
,
**
kwargs
):
pass
def
ignore_first
(
fun
):
...
...
@@ -25,7 +33,6 @@ def getLogger(modulename='main'):
arglist
=
parser
.
parse_args
()
debug
=
False
print
(
modulename
)
## if modulename in ['RoutingPreProc.%s'%name for name in arglist.debug] : debug=True
if
modulename
in
arglist
.
debug
:
debug
=
True
if
'all'
in
arglist
.
debug
:
debug
=
True
if
debug
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment