Commit 27ba90a2 authored by POLCHER Jan's avatar POLCHER Jan 🚴🏾
Browse files

Make the access to the run.def a little nicer and more general.

parent 2908da3a
......@@ -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
......
......@@ -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)
......
......@@ -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
......
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.
......
......@@ -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)
#
......
......@@ -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
......
......@@ -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")
......
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment