Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scbulgg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lucasca
scbulgg
Commits
3e43f357
Commit
3e43f357
authored
1 year ago
by
lucasca
Browse files
Options
Downloads
Patches
Plain Diff
Added option 'mustInclude'
parent
78fe1606
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/scpickfilter/descriptions/scpickfilter.xml
+6
-0
6 additions, 0 deletions
apps/scpickfilter/descriptions/scpickfilter.xml
apps/scpickfilter/main.cpp
+45
-12
45 additions, 12 deletions
apps/scpickfilter/main.cpp
with
51 additions
and
12 deletions
apps/scpickfilter/descriptions/scpickfilter.xml
+
6
−
0
View file @
3e43f357
...
...
@@ -19,6 +19,12 @@
groupingInterval to declare an active shot
</description>
</parameter>
<parameter
name=
"mustInclude"
type=
"string"
>
<description>
Empty or a station ("net.sta.loc") that must be present in a pick group
to consider a valid active shot
</description>
</parameter>
<parameter
name=
"droppingPeriod"
type=
"double"
unit=
"sec"
>
<description>
For how long to drop picks after an active shot
...
...
This diff is collapsed.
Click to expand it.
apps/scpickfilter/main.cpp
+
45
−
12
View file @
3e43f357
...
...
@@ -236,6 +236,7 @@ private:
Core
::
TimeSpan
_groupingInterval
;
Core
::
TimeSpan
_droppingPeriod
;
unsigned
_minNumPicks
;
std
::
string
_mustInclude
;
std
::
string
_epFile
;
PickBuffer
_buf
;
struct
{
...
...
@@ -275,6 +276,10 @@ protected:
_groupingInterval
=
configGetDouble
(
"groupingInterval"
);
_minNumPicks
=
configGetInt
(
"minNumPicks"
);
_droppingPeriod
=
configGetDouble
(
"droppingPeriod"
);
try
{
_mustInclude
=
configGetString
(
"mustInclude"
);
}
catch
(...)
{
}
if
(
!
_epFile
.
empty
())
setMessagingEnabled
(
false
);
...
...
@@ -344,8 +349,11 @@ protected:
std
::
sort
(
objs
.
begin
(),
objs
.
end
());
auto
acceptedCb
=
[
&
ep
](
PickPtr
pick
)
{
ep
->
add
(
pick
.
get
());
};
auto
droppedCb
=
[
this
](
const
deque
<
PickPtr
>
&
picks
)
{
/* nothing to do */
};
auto
droppedCb
=
[
this
](
const
deque
<
PickPtr
>
&
picks
)
{
SEISCOMP_INFO
(
"Dropped %zu picks: %s ~ %s"
,
picks
.
size
(),
picks
.
front
()
->
time
().
value
().
iso
().
c_str
(),
picks
.
back
()
->
time
().
value
().
iso
().
c_str
());
};
SEISCOMP_INFO
(
"Processing picks"
);
...
...
@@ -355,17 +363,16 @@ protected:
_counter
.
newPicks
++
;
processPicks
(
acceptedCb
,
droppedCb
);
}
while
(
_buf
.
size
()
>
0
)
{
while
(
_buf
.
size
()
>
0
)
{
Core
::
msleep
(
100
);
processPicks
(
acceptedCb
,
droppedCb
);
}
SEISCOMP_INFO
(
"Processed picks %lu"
,
_counter
.
newPicks
);
SEISCOMP_INFO
(
"Accepted picks %lu"
,
_counter
.
acceptedPicks
);
SEISCOMP_INFO
(
"Dropped picks %lu (group picks %lu dropping period picks %lu)"
,
(
_counter
.
droppedGroupPicks
+
_counter
.
droppedPeriodPicks
),
_counter
.
droppedGroupPicks
,
_counter
.
droppedPeriodPicks
);
SEISCOMP_INFO
(
"Dropped picks %lu (group picks %lu after group picks %lu)"
,
(
_counter
.
droppedGroupPicks
+
_counter
.
droppedPeriodPicks
),
_counter
.
droppedGroupPicks
,
_counter
.
droppedPeriodPicks
);
SEISCOMP_INFO
(
"Dropped pick groups %lu"
,
_counter
.
droppedGroups
);
if
(
_buf
.
size
()
!=
0
)
{
SEISCOMP_WARNING
(
"Unprocessed picks (%lu)"
,
_buf
.
size
());
...
...
@@ -483,15 +490,41 @@ private:
oldestPick
->
time
().
value
()
+
_groupingInterval
;
deque
<
PickPtr
>
group
=
_buf
.
getExpiredPicks
(
notAfter
);
if
(
group
.
size
()
>=
_minNumPicks
-
1
)
{
// group detected
bool
groupDetected
=
false
;
if
(
group
.
size
()
>=
_minNumPicks
-
1
)
{
// possble group detected
if
(
_mustInclude
.
empty
())
{
// no net.sta.loc configured
groupDetected
=
true
;
}
else
{
// check if _mustInclude net.sta.loc is present
string
wfid
=
oldestPick
->
waveformID
().
networkCode
()
+
"."
+
oldestPick
->
waveformID
().
stationCode
()
+
"."
+
oldestPick
->
waveformID
().
locationCode
();
if
(
wfid
==
_mustInclude
)
{
groupDetected
=
true
;
}
else
{
for
(
PickPtr
pick
:
group
)
{
wfid
=
pick
->
waveformID
().
networkCode
()
+
"."
+
pick
->
waveformID
().
stationCode
()
+
"."
+
pick
->
waveformID
().
locationCode
();
if
(
wfid
==
_mustInclude
)
{
groupDetected
=
true
;
break
;
}
}
}
}
}
if
(
groupDetected
)
{
// group detected
// drop picks
for
(
PickPtr
pick
:
group
)
{
if
(
!
_buf
.
removePick
(
pick
.
get
()))
{
throw
Core
::
GeneralException
(
"Internal logic error"
);
}
}
group
.
push_front
(
oldestPick
);
droppedCb
(
group
);
group
.
push_front
(
oldestPick
);
// it was handled by popExpiredPick
_counter
.
droppedGroupPicks
+=
group
.
size
();
_counter
.
droppedGroups
++
;
...
...
@@ -507,10 +540,10 @@ private:
if
(
!
_buf
.
removePick
(
oldestPick
.
get
()))
{
throw
Core
::
GeneralException
(
"Internal logic error"
);
}
d
ro
ppedCb
({
oldestPick
}
);
g
ro
up
.
push_back
(
oldestPick
);
_counter
.
droppedPeriodPicks
++
;
}
droppedCb
(
group
);
}
else
{
// accept the oldest pick
acceptedCb
(
oldestPick
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment