Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions openquake/calculators/event_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,10 @@ def get_allargs(oq, sitecol, assetcol, sec_perils, dstore):
grp = dstore.parent['oqparam']
if isinstance(grp, h5py.Group):
oq_by = {}
for model in grp:
for name in grp:
model = name[-3:] # i.e. AfricaNAF -> NAF
oq_by[model] = oq.from_parent(
dstore.parent[f'oqparam/{model}'], new=True)
dstore.parent[f'oqparam/{name}'], new=True)
oq_by[model].mags_by_trt = AccumDict(accum=set())
else:
oq_by = {'???': oq}
Expand Down
3 changes: 2 additions & 1 deletion openquake/calculators/event_based_risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,8 @@ def execute(self):
oq.gsim == '[FromFile]'):
raise InvalidFile('%s: missing gsim or gsim_logic_tree_file'
% oq.inputs['job_ini'])
elif not hasattr(oq, 'maximum_distance'):
elif oq.hazard_calculation_id is None and not hasattr(
oq, 'maximum_distance'):
raise InvalidFile('Missing maximum_distance in %s'
% oq.inputs['job_ini'])
rup0 = self.datastore['ruptures'][0]
Expand Down
4 changes: 3 additions & 1 deletion openquake/engine/postjobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ def build_ses(dstore, calcs, out_file):
generated by each job.
"""
with performance.Monitor(measuremem=True, h5=dstore) as mon:
names = dstore.read_df('workflow', 'calc_id').name
df = dstore.read_df('workflow', 'calc_id')
names = list(df.loc[calcs].name)
logging.info(f'Importing {" ".join(names)}')
dstores = [datastore.read(calc) for calc in calcs]
fnames = [ds.filename for ds in dstores]
logging.warning(f'Saving {out_file}')
Expand Down