init_event
Called by: main once for each event.
Includes: iscloc.h
External:
default_depth
set in read_config
min_phases
set in read_config
Input arguments:
Pointer to event
structure.
Array of hypocentre
structures.
FIelds updated:
Can reset fixed_depth, fixed_lat, fixed_lon, fixed_time, seed_agency
in event
structure.
etype
in event
structure.
Return: 0/1 for success/failure.
This function has two main roles:
First it checks and implements the combination of event
structure members set in read_instruction
and which concern fixing solution parameters. Thus, for example, if
depth_agency
has been set this function sets fixed_depth
to the depth from
the corresponding hypocentre. This can not be done by read_instruction
because the hypocentres have not been read in at that stage. If location_agency
is set and no separate depth fixing instructions have been given then the same hypocentre is used to set fixed_depth. If the location is set explicitly using lat=value and lon=value and no separate depth fixing instructions have been given then the depth is fixed to the value of default_depth
set in read_config. A similar procedure is followed if the time is fixed by agency, if
it is set explicitly then it is an error not to give a location fixing instruction
as there is no default location. Examples of combinations of operator instructions are given in the operator_control
chapter.
Second it sets the event type in the event
structure - a descriptive value not used except when printing or writing to database:
-
etype - a 2 character string indicating whether the event is certainly
or probably a tectonic earthquake, an explosion or a mining related event.
Set in function init_event
based on the reported event types of the hypocentres grouped in an event.
In addition this function checks that there are enough associated phases
to start a solution by comparing the total number of phases against min_phases, an external variable assigned in read_config. There is a test
every iteration in the weighting function to ensure that the number of useful
phases is greater than min_phases, but also testing at this stage saves time and a lot of error messages if there are no associated phases at all.