mark_duplicates
Called by: main each iteration.
Includes: iscloc.h
Input arguments:
Pointer to solution
structure.
Array of
phase
structures.
Calls:
same_sta from this file.
same_pha and same_time from this file called by same_sta.
read_ttime
called by same_time.
print_pha
from utils
if diagnostic is on.
Structure members updated ( in same_pha ) :
weight_factor, pref_rd, duplicate
in phase
structure.
Return: 0/1 for success/failure.
This function stops arrivals being over weighted because they are reported
more than once. There are a number of situations, as described below:
- Phases are reported from the same station with the same arrival time
and the same phase code. In this case one phase has weight_factor
set to
1 and the others have weight_factor
set to 0. In addition the phases with weight_factor=0 have pref_rd
set to the first phase's rdid and duplicate
set to 1. These structure members are only used
after convergence, at the output stage, where exact duplicates are treated
differently to other phases with weight_factor=0.
- Phases are reported from the same station with the same arrival time and different phase codes. In this case read_ttime
is called to find which phase code corresponds to the lowest residual with
respect to the current solution and then all the phases are changed to this
code. Once all the phase codes are the same the duplicates are treated as
above.
- Phases are reported from the same station with different arrival times
and the same phase code. In this case the phases are all down weighted.
e.g. 4 P phases from the same station with 4 different times would each get a weight_factor
of 0.25 (assuming function get_weight_factor
gave them a weight_factor
of 1).
Each phase
structure has 2 fields specifically related to duplicate elimination:
-
pref_rd - preferred reading ID. Set in whatever function is being used for data input, can be reset in function mark_duplicates. Equal to the rdid of either this or another reading.
-
duplicate - 0 or 1. Set in function mark_duplicates. Set to 1 for a phase that is an exact duplicate of another phase.
The value of pref_rd
starts out set to a value input from data (or equal to rdid if such data
is not available). In the ISC database an algorithm is run that recognises
duplicate readings. If such readings exactly duplicate each other then
one is deprecated but otherwise the algorithm chooses which is 'preferred'
using such criteria as the number of phases included in each reading and
whether one reading was reported by the agency responsible for the station.
The rdid of the preferred reading is assigned to the pref_rd
field for every phase of both readings.
mark_duplicates
uses the initial values of pref_rd
to pick which phase to prefer between two or more identical phases but it only assigns pref_rd
to one phase at a time - allowing one reading to include phases with different pref_rds. Because location works entirely with phases, rather than with readings,
this is not important until phases are printed or the phase table of the
database updated, at which time readings are untangled.
Having pref_rd
not equal to rdid does not necessarily mean that a phase is a duplicate
- just that it was part of a duplicate reading when it was input, as explained
above. This is why the duplicate
flag is required, mark_duplicates
sets this flag when it changes the value of pref_rd
for a phase and it signifies that this phase is an exact duplicate of another
phase and that that is why it is not required in the solution (has weight_factor
=0).