Skip to content

Commit 4f5679c

Browse files
authored
Merge pull request #10431 from gem/apply_unc
Added command `oq info apply_uncertainty`
2 parents 86559ab + f5f85aa commit 4f5679c

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

debian/changelog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[Michele Simionato]
2+
* Added command `oq info apply_uncertainty`
23
* Added an extractor `losses_by_site`
34
* Improved `oq info sources` and `oq show relevant_sources:<IMT>`
45
* Internal: accepted `source_model_file` in place of

openquake/commands/info.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from openquake.baselib import config, hdf5
3434
from openquake.baselib.general import groupby, gen_subclasses, humansize
3535
from openquake.baselib.performance import Monitor
36-
from openquake.hazardlib import nrml, imt, logictree, site, geo
36+
from openquake.hazardlib import nrml, imt, logictree, site, geo, lt
3737
from openquake.hazardlib.geo.packager import fiona
3838
from openquake.hazardlib.gsim.base import registry
3939
from openquake.hazardlib.mfd.base import BaseMFD
@@ -286,10 +286,14 @@ def main(what, report=False):
286286
print(param)
287287
print(docs[param])
288288
elif what == 'loss_types':
289-
ltypes = [lt for lt in scientific.LOSSTYPE
290-
if '+' not in lt and '_ins' not in lt]
291-
for lt in sorted(ltypes):
292-
print(lt)
289+
ltypes = [ltype for ltype in scientific.LOSSTYPE
290+
if '+' not in ltype and '_ins' not in ltype]
291+
for ltype in sorted(ltypes):
292+
print(ltype)
293+
elif what == 'apply_uncertainty':
294+
uncs = [unc for unc in lt.apply_uncertainty if unc != 'dummy']
295+
for i, unc in enumerate(sorted(uncs), 1):
296+
print('%02d' % i, unc)
293297
elif what.startswith('mfd'):
294298
print_subclass(what, BaseMFD)
295299
elif what.startswith('msr'):
@@ -374,12 +378,12 @@ def main(what, report=False):
374378
print('Generated', reportwriter.build_report(what))
375379
else:
376380
oq = readinput.get_oqparam(what)
377-
lt = readinput.get_logic_tree(oq)
381+
ltree = readinput.get_logic_tree(oq)
378382
size = humansize(oq.get_input_size())
379383
print('calculation_mode: %s' % oq.calculation_mode)
380384
print('description: %s' % oq.description)
381385
print('input size: %s' % size)
382-
for bset in lt.branchsets:
386+
for bset in ltree.branchsets:
383387
pprint(bset.to_list())
384388
if mon.duration > 1:
385389
print(mon)

0 commit comments

Comments
 (0)