contents

calc_sta_ms

Called by:  calc_netmag

Includes:   iscloc.h

External:
surf_mag_min_dist, surf_mag_max_dist, surf_mag_min_per, surf_mag_max_per set in read_config.

Input arguments:
Array of phase structures.
Array of indexes of the phase structure array making up one reading.
Number of entries in the reading array.

Structure members updated:  surfmag in the phases that contributed to it.

Return:  MS for the reading or 0 if there is none.

Note:  ISF bulletin format does not include component information so MS can not be calculated for data read in from ISF file.

This function goes through the phases of one reading and looks for amplitudes recorded at a suitable distance and with suitable periods for surface wave magnitude calculation.  If a vertical amplitude is given then MSZ is calculated and if amplitudes on both horizontal components are given at a similar period to each other then MSH is calculated.  MS for the reading is set to either MSZ or MSH or the average of the two if both are available.

Any phase with phase ="" is considered, as surface wave codes do not get mapped in id_pha .  Multiple amplitudes for one reading can either be on separate phases or attached to one phase as rows in the amplitude array a.  In either case the surfmag written to the phase structure needs to be that calculated using amplitude(s) from that phase.  Therefore if there are 3 orthogonal amplitudes for a reading then either two phases with horizontal amplitudes could have surfmag=MSH and a phase with a vertical amplitude have surfmag=MSZ or a single phase with 3 amplitudes could have surfmag=MS.  Because some phases in the reading may not have a surfmag while others do and because the MS for the reading may not be stored with any of the phases the value of MS is returned back to the calling function so that it can be used in network magnitude calculation.