@@ -310,7 +310,13 @@ def get_csm(oq, full_lt, dstore=None):
310
310
fillvalue = None )
311
311
312
312
# must be called *after* _fix_dupl_ids
313
- fix_geometry_sections (smdict , csm , dstore )
313
+ if oq .sites and len (oq .sites ) == 1 and oq .use_rates :
314
+ lon , lat , _dep = oq .sites [0 ]
315
+ site1 = site .SiteCollection .from_points ([lon ], [lat ])
316
+ else :
317
+ site1 = None
318
+ hdf5path = dstore .tempname if dstore else ''
319
+ fix_geometry_sections (smdict , csm .src_groups , hdf5path , site1 )
314
320
return csm
315
321
316
322
@@ -377,7 +383,7 @@ def replace(lst, splitdic, key):
377
383
lst [:] = new
378
384
379
385
380
- def fix_geometry_sections (smdict , csm , dstore ):
386
+ def fix_geometry_sections (smdict , src_groups , hdf5path = '' , site1 = None ):
381
387
"""
382
388
If there are MultiFaultSources, fix the sections according to the
383
389
GeometryModels (if any).
@@ -399,22 +405,20 @@ def fix_geometry_sections(smdict, csm, dstore):
399
405
400
406
if sections :
401
407
# save in the temporary file
402
- assert dstore , ('You forgot to pass the dstore to '
408
+ assert hdf5path , ('You forgot to pass the dstore to '
403
409
'get_composite_source_model' )
404
- oq = dstore [ 'oqparam' ]
410
+
405
411
mfsources = []
406
- for sg in csm . src_groups :
412
+ for sg in src_groups :
407
413
for src in sg :
408
414
if src .code == b'F' :
409
415
mfsources .append (src )
410
- if oq .sites and len (oq .sites ) == 1 and oq .use_rates :
411
- lon , lat , _dep = oq .sites [0 ]
412
- site1 = site .SiteCollection .from_points ([lon ], [lat ])
413
- else :
414
- site1 = None
415
- split_dic = save_and_split (mfsources , sections , dstore .tempname , site1 )
416
- for sg in csm .src_groups :
416
+ split_dic = save_and_split (mfsources , sections , hdf5path , site1 )
417
+ for sg in src_groups :
417
418
replace (sg .sources , split_dic , 'source_id' )
419
+ with hdf5 .File (hdf5path , 'r' ) as h5 :
420
+ return h5 ['secparams' ][:]
421
+ return ()
418
422
419
423
420
424
def _groups_ids (smlt_dir , smdict , fnames ):
0 commit comments