Data Input
Each event structure has 5 members related to inputting data:
- evid - numerical ID of event. If database in use then set in read_instruction and used to select data. Otherwise input with other data in read_isf_event.
- prime - hypid of prime hypocentre for this event in the database. Only used if database being used.
- isc_hypid - hypid of the ISC hypocentre for this event in the database. Only used if database being used.
- numhyps - number of hypocentres in this event. Set in either get_event or read_isf_event.
- numphas - number of phases associated with hypocentres in this event. Set in either get_event or read_isf_event.
The iscloc program is designed to input data in one of two ways, either from an ORACLE database with the same schema as used at the ISC or form text files with events in ISF bulletin format. The mode of input depends on the instruction line:
- If the instruction line contains an evid that can be used to select an event from the database then function get_data is used. A connection is made to the database the first time such an instruction is read and not broken until the program ends.
- If the instruction line contains the name of a file containing ISF data then function read_isf_event is used. The first time that a particular ISF file is requested it is opened in main and left open in case subsequent instruction lines request the same file. That way the events in the file are read in order, rather than going back to the first one every time.
Because a new instruction line is read in for each event it is possible to mix database and file input as well as to read from more than one file.
The data input functions are responsible for dynamically allocating memory for the arrays of hypocentre and phase structures that they insert data into.