Skip to content

Commit

Permalink
Merge pull request #10431 from gem/apply_unc
Browse files Browse the repository at this point in the history
Added command `oq info apply_uncertainty`
  • Loading branch information
micheles authored Mar 9, 2025
2 parents 86559ab + f5f85aa commit 4f5679c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[Michele Simionato]
* Added command `oq info apply_uncertainty`
* Added an extractor `losses_by_site`
* Improved `oq info sources` and `oq show relevant_sources:<IMT>`
* Internal: accepted `source_model_file` in place of
Expand Down
18 changes: 11 additions & 7 deletions openquake/commands/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from openquake.baselib import config, hdf5
from openquake.baselib.general import groupby, gen_subclasses, humansize
from openquake.baselib.performance import Monitor
from openquake.hazardlib import nrml, imt, logictree, site, geo
from openquake.hazardlib import nrml, imt, logictree, site, geo, lt
from openquake.hazardlib.geo.packager import fiona
from openquake.hazardlib.gsim.base import registry
from openquake.hazardlib.mfd.base import BaseMFD
Expand Down Expand Up @@ -286,10 +286,14 @@ def main(what, report=False):
print(param)
print(docs[param])
elif what == 'loss_types':
ltypes = [lt for lt in scientific.LOSSTYPE
if '+' not in lt and '_ins' not in lt]
for lt in sorted(ltypes):
print(lt)
ltypes = [ltype for ltype in scientific.LOSSTYPE
if '+' not in ltype and '_ins' not in ltype]
for ltype in sorted(ltypes):
print(ltype)
elif what == 'apply_uncertainty':
uncs = [unc for unc in lt.apply_uncertainty if unc != 'dummy']
for i, unc in enumerate(sorted(uncs), 1):
print('%02d' % i, unc)
elif what.startswith('mfd'):
print_subclass(what, BaseMFD)
elif what.startswith('msr'):
Expand Down Expand Up @@ -374,12 +378,12 @@ def main(what, report=False):
print('Generated', reportwriter.build_report(what))
else:
oq = readinput.get_oqparam(what)
lt = readinput.get_logic_tree(oq)
ltree = readinput.get_logic_tree(oq)
size = humansize(oq.get_input_size())
print('calculation_mode: %s' % oq.calculation_mode)
print('description: %s' % oq.description)
print('input size: %s' % size)
for bset in lt.branchsets:
for bset in ltree.branchsets:
pprint(bset.to_list())
if mon.duration > 1:
print(mon)
Expand Down

0 comments on commit 4f5679c

Please sign in to comment.