aboutsummaryrefslogtreecommitdiff
path: root/run.py
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2024-04-15 17:33:01 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2024-04-15 17:33:01 +0200
commit50a5fc958b1705580610ce0b3f50dc3e6156fbc0 (patch)
tree20605c06b91eba9563f7302171f816b62c867d95 /run.py
parentdf996bda501bb4cdac95ec6cb3443b772e24a0c9 (diff)
downloadmeteo_toolbox-50a5fc958b1705580610ce0b3f50dc3e6156fbc0.tar.gz
add modifier
Diffstat (limited to 'run.py')
-rwxr-xr-xrun.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/run.py b/run.py
index f239f45..28362d9 100755
--- a/run.py
+++ b/run.py
@@ -22,6 +22,30 @@ def create_aggregators(cfg):
return ret
+def create_modifiers(aggregators, cfg):
+ # naming is scuffed
+ ret = {}
+ for modifier in cfg:
+ mod = cfg[modifier]
+ modname = mod['module']
+ del mod['module']
+
+ if 'aggregator' in mod:
+ if type(mod['aggregator']) == list:
+ mod['data'] = []
+ for ag in mod['aggregator']:
+ mod['data'].append(aggregators[ag])
+
+ del mod['aggregator']
+ else:
+ mod['data'] = aggregators[mod['aggregator']]
+ del mod['aggregator']
+
+ pymod = __import__(modname, fromlist=[None])
+ ret[modifier] = pymod.run(**mod)
+
+ return ret
+
mpl.use('agg')
# Define custom gpm and gpdm units. The default gpm in metpy is aliased to meter.
@@ -60,6 +84,9 @@ with open(FILE, 'r') as f:
aggregators = create_aggregators(conf['aggregator'])
+if 'modifier' in conf:
+ aggregators.update(create_modifiers(aggregators, conf['modifier']))
+
index = []
for plotter in conf['plotter']: