Skip to content

Commit

Permalink
Merge pull request #10250 from gem/cleanup
Browse files Browse the repository at this point in the history
Minor cleanup for HDF5
  • Loading branch information
micheles authored Jan 9, 2025
2 parents 8942feb + c6a3539 commit 9203224
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion openquake/calculators/post_risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def fix_dtypes(dic):
fix_dtype(dic, F32, floatcolumns)


def build_aggcurves(items, builder, num_events, aggregate_loss_curves_types):
def build_aggcurves(items, builder, num_events, aggregate_loss_curves_types, monitor):
"""
:param items: a list of pairs ((agg_id, rlz_id, loss_id), losses)
:param builder: a :class:`LossCurvesMapsBuilder` instance
Expand Down Expand Up @@ -295,6 +295,7 @@ def store_aggcurves(oq, agg_ids, rbe_df, builder, loss_cols,
if len(year):
data['year'] = year[df.event_id.to_numpy()]
items.append([(agg_id, rlz_id, loss_id), data])
dstore.swmr_on()
dic = parallel.Starmap.apply(
build_aggcurves, (items, builder, num_events, aggtypes),
concurrent_tasks=oq.concurrent_tasks,
Expand Down
3 changes: 2 additions & 1 deletion openquake/commonlib/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def new(calc_id, oqparam, datadir=None, mode=None):
a DataStore instance associated to the given calc_id
"""
dstore = _read(calc_id, mode, datadir)
dstore['oqparam'] = oqparam
if 'oqparam' not in dstore:
dstore['oqparam'] = oqparam
if oqparam.hazard_calculation_id:
dstore.ppath = read(calc_id, 'r', datadir).ppath
return dstore
Expand Down

0 comments on commit 9203224

Please sign in to comment.