@@ -228,7 +228,7 @@ CatalogPtr HypoDD::relocateCatalog()
228
228
}
229
229
230
230
// Find Neighbouring Events in the catalog
231
- list<NeighboursPtr> neighbourCats = selectNeighbouringEventsCatalog (
231
+ deque< list<NeighboursPtr> > clusters = selectNeighbouringEventsCatalog (
232
232
catToReloc, _cfg.ddObservations2 .minWeight ,
233
233
_cfg.ddObservations2 .minESdist , _cfg.ddObservations2 .maxESdist ,
234
234
_cfg.ddObservations2 .minEStoIEratio , _cfg.ddObservations2 .minDTperEvt ,
@@ -237,28 +237,58 @@ CatalogPtr HypoDD::relocateCatalog()
237
237
_cfg.ddObservations2 .maxEllipsoidSize , true
238
238
);
239
239
240
+ SEISCOMP_INFO (" Found %lu event clusters" , clusters.size () );
241
+
240
242
// write catalog for debugging purpose
241
243
if ( ! _workingDirCleanup )
242
244
{
243
245
catToReloc->writeToFile (
244
246
(boost::filesystem::path (catalogWorkingDir)/" starting-event.csv" ).string (),
245
247
(boost::filesystem::path (catalogWorkingDir)/" starting-phase.csv" ).string (),
246
248
(boost::filesystem::path (catalogWorkingDir)/" starting-station.csv" ).string () );
247
- CatalogPtr catToDump ( new Catalog () );
248
- for (const auto & n : neighbourCats)
249
- catToDump->add (n->refEvId , *catToReloc, true );
250
- catToDump->writeToFile (
251
- (boost::filesystem::path (catalogWorkingDir)/" selected-event.csv" ).string (),
252
- (boost::filesystem::path (catalogWorkingDir)/" selected-phase.csv" ).string (),
253
- (boost::filesystem::path (catalogWorkingDir)/" selected-station.csv" ).string () );
254
- }
249
+ }
250
+
251
+ //
252
+ // Relocate one cluster a time
253
+ //
254
+ CatalogPtr relocatedCatalog ( new Catalog () );
255
+
256
+ for (unsigned clusterId = 0 ; clusterId < clusters.size (); clusterId++ )
257
+ {
258
+ const list<NeighboursPtr>& neighCluster = clusters[clusterId];
259
+
260
+ SEISCOMP_INFO (" Relocating cluster %u (%lu events)" , clusterId+1 , neighCluster.size () );
261
+
262
+ if ( ! _workingDirCleanup )
263
+ {
264
+ CatalogPtr catToDump ( new Catalog () );
265
+ for (const NeighboursPtr& n : neighCluster )
266
+ catToDump->add (n->refEvId , *catToReloc, true );
267
+ string prefix = " cluster-" + to_string (clusterId + 1 );
268
+ catToDump->writeToFile (
269
+ (boost::filesystem::path (catalogWorkingDir)/(prefix+" -event.csv" )).string (),
270
+ (boost::filesystem::path (catalogWorkingDir)/(prefix+" -phase.csv" )).string (),
271
+ (boost::filesystem::path (catalogWorkingDir)/(prefix+" -station.csv" )).string () );
272
+ }
255
273
256
- // Perform cross correlation, which also detects picks around theoretical
257
- // arrival times. The catalog will be updated with those theoretical phases
258
- const XCorrCache xcorr = buildXCorrCache (catToReloc, neighbourCats , _useArtificialPhases);
274
+ // Perform cross correlation, which also detects picks around theoretical
275
+ // arrival times. The catalog will be updated with those theoretical phases
276
+ const XCorrCache xcorr = buildXCorrCache (catToReloc, neighCluster , _useArtificialPhases);
259
277
260
- // The actual relocation
261
- CatalogPtr relocatedCatalog = relocate (catToReloc, neighbourCats, false , xcorr);
278
+ // The actual relocation
279
+ CatalogPtr relocatedCluster = relocate (catToReloc, neighCluster, false , xcorr);
280
+
281
+ relocatedCatalog->add (*relocatedCluster, true );
282
+
283
+ if ( ! _workingDirCleanup )
284
+ {
285
+ string prefix = " relocated-cluster-" + to_string (clusterId + 1 );
286
+ relocatedCluster->writeToFile (
287
+ (boost::filesystem::path (catalogWorkingDir)/(prefix+" -event.csv" )).string (),
288
+ (boost::filesystem::path (catalogWorkingDir)/(prefix+" -phase.csv" )).string (),
289
+ (boost::filesystem::path (catalogWorkingDir)/(prefix+" -station.csv" )).string () );
290
+ }
291
+ }
262
292
263
293
// write catalog for debugging purpose
264
294
if ( ! _workingDirCleanup )
@@ -448,12 +478,10 @@ HypoDD::relocateEventSingleStep(const CatalogCPtr& evToRelocateCat,
448
478
449
479
CatalogPtr
450
480
HypoDD::relocate (CatalogPtr& catalog,
451
- const std::list<NeighboursPtr>& neighbourCats ,
481
+ const std::list<NeighboursPtr>& neighCluster ,
452
482
bool keepNeighboursFixed,
453
483
const XCorrCache& xcorr) const
454
484
{
455
- // Create a solver and then add observations
456
- Solver solver (_cfg.solver .type );
457
485
ObservationParams obsparams;
458
486
459
487
for ( unsigned iteration=0 ; iteration < _cfg.solver .algoIterations ; iteration++ )
@@ -485,18 +513,18 @@ HypoDD::relocate(CatalogPtr& catalog,
485
513
SEISCOMP_INFO (" Solving iteration %u num events %lu (observ. weight TTdiff %.2f xcorr %.2f "
486
514
" dampingFactor %.2f downWeightingByResidual %.2f "
487
515
" meanShiftConstrainWeight %.2f,%.2f,%.2f,%.2f)" ,
488
- iteration, neighbourCats .size (), absTTDiffObsWeight, xcorrObsWeight,
516
+ iteration, neighCluster .size (), absTTDiffObsWeight, xcorrObsWeight,
489
517
dampingFactor, downWeightingByResidual,
490
518
meanLonShiftConstraint, meanLatShiftConstraint,
491
519
meanDepthShiftConstraint, meanTTShiftConstraint);
492
520
493
-
494
- solver. reset ( );
521
+ // Create a solver and then add observations
522
+ Solver solver (_cfg. solver . type );
495
523
496
524
//
497
525
// Add absolute travel time/xcorr differences to the solver (the observations)
498
526
//
499
- for (const NeighboursPtr& neighbours : neighbourCats )
527
+ for (const NeighboursPtr& neighbours : neighCluster )
500
528
{
501
529
addObservations (solver, absTTDiffObsWeight, xcorrObsWeight, catalog,
502
530
neighbours, keepNeighboursFixed, xcorr, obsparams);
@@ -521,12 +549,12 @@ HypoDD::relocate(CatalogPtr& catalog,
521
549
obsparams = ObservationParams ();
522
550
523
551
// update event parameters
524
- catalog = updateRelocatedEvents (solver, catalog, neighbourCats , obsparams);
552
+ catalog = updateRelocatedEvents (solver, catalog, neighCluster , obsparams);
525
553
}
526
554
527
555
// build the relocated catalog from the results of relocations
528
556
CatalogPtr relocatedCatalog ( new Catalog () );
529
- for (const NeighboursPtr& neighbours : neighbourCats )
557
+ for (const NeighboursPtr& neighbours : neighCluster )
530
558
{
531
559
const Event& event = catalog->getEvents ().at (neighbours->refEvId );
532
560
if ( event.relocInfo .isRelocated )
@@ -695,15 +723,15 @@ HypoDD::ObservationParams::addToSolver(Solver& solver) const
695
723
CatalogPtr
696
724
HypoDD::updateRelocatedEvents (const Solver& solver,
697
725
const CatalogCPtr& catalog,
698
- const std::list<NeighboursPtr>& neighbourCats ,
726
+ const std::list<NeighboursPtr>& neighCluster ,
699
727
ObservationParams& obsparams ) const
700
728
{
701
729
unordered_map<string,Station> stations = catalog->getStations ();
702
730
map<unsigned ,Event> events = catalog->getEvents ();
703
731
unordered_multimap<unsigned ,Phase> phases = catalog->getPhases ();
704
732
unsigned relocatedEvs = 0 ;
705
733
706
- for (const NeighboursPtr& neighbours : neighbourCats )
734
+ for (const NeighboursPtr& neighbours : neighCluster )
707
735
{
708
736
Event& event = events.at (neighbours->refEvId );
709
737
event.relocInfo .isRelocated = false ;
@@ -1014,14 +1042,14 @@ HypoDD::createThoreticalPhase(const Station& station,
1014
1042
1015
1043
XCorrCache
1016
1044
HypoDD::buildXCorrCache (CatalogPtr& catalog,
1017
- const std::list<NeighboursPtr>& neighbourCats ,
1045
+ const std::list<NeighboursPtr>& neighCluster ,
1018
1046
bool computeTheoreticalPhases)
1019
1047
{
1020
1048
XCorrCache xcorr;
1021
1049
_counters = {0 };
1022
1050
_wf->resetCounters ();
1023
1051
1024
- for (const NeighboursPtr& neighbours : neighbourCats )
1052
+ for (const NeighboursPtr& neighbours : neighCluster )
1025
1053
{
1026
1054
const Event& refEv = catalog->getEvents ().at (neighbours->refEvId );
1027
1055
0 commit comments