The MAG program calculates simple magnitude relations. The program has three functions: (1) Calculate parameters for a magnitude scale (Ml or Mc), (2) Calculate relation between two different magnitudes and/or spectral parameters and (3) Calculate a new magnitude as a function of an existing magnitude, a natural step following function (2). All three functions can be done at the same time. Function (3) can also be used for moving a particular magnitude type and/or agency to the first magnitude position in line 1 to be plotted with EPIMAP.

ALL HEADER LINES ARE SEARCHED FOR MAGNITUDE INFORMATION

Input: The data input is a CAT-file like one made with SELECT or COLLECT or it can be a compact file if only magnitude comparison is made. Optionally there can be a parameter file, which MUST be, called mag.par and MUST reside in the working directory. An example of the parameter file is found in DAT and also shown below. The parameter file is not needed for all operations, see details below.

1: Magnitude scales

Coda magnitude Mc: The coda magnitude scale used is

where Mc is the coda magnitude, coda is the coda length in secs, dist is the hypocentral distance in km (calculated from epicentral distance and depth in CAT file) and A, B and C are constants to be determined. This is done in two ways

3d regression

2d regression

with B = A * dist_coff where dist_coff is given in the parameter file and m is the reference magnitude. SO B AND dist_coff ARE DIFFERENT. The CAT-file must contain coda readings, epicentral distances and a magnitude in the header line. A linear regression is then made between the known magnitude from a given agency and the observed coda lengths following the relations above. The user has the option to choose the type of magnitude to use in the regression. Usually Ml or Mb are used. All station-event combinations are used to determine simultaneously the 3 constants A, B and C. Since the data often is too bad to determine all 3 parameters at the same time, the program will also calculate just A and C using a fixed user supplied value for the distance correction to the coda. The constant dist_coff is given in the mag.par file as the second parameter under MAG_TYP_COF (see below). IN ORDER FOR THE CODA SCALE OPTION TO WORK, THE DISTANCE COEFFICIENT MUST BE DIFFERENT FROM ZERO.

Output: On the screen the constants will be printed out and a file mag_coda.out will contain pairs of values m and (log(coda) + dist_coff*dist), which can be used to plot the distance corrected coda relation. If results from the 3D is to be plotted, dist_coff must be calculated as dist_coff=B/A, put into mag.par and mag run again. On the other hand, if a best dist_cof has been found, B is calculated as B=A*dist_cod

A typical coda magnitude relation is :

[Lee et al., 1972]

Local magnitude Ml:

The local magnitude scale is calculated by determining an amplitude attenuation scale using amplitudes and distances in CAT file. The parameters in the Ml magnitude scale are computed for every event individually, parameters are determined as averages of all events.

For each event (only type L and R are used) a,b,c are calculated if at least 3 stations are available using least squares regression as follows:

The relation above can be derived from the standard geometrical spreading and attenuation relations:

where is the frequency, is the velocity and . The relation can be rewritten

Since often is close to , the relation can be simplified to the frequency independent relation:

If body wave spreading is assumed , and , the relation is

which is comparable to the relation shown below for California.

Similarly to the coda relation, a 2D relation is also calculated

where is fixed to the value given in the mag.par file (same parameter as used for coda). This gives a more stable solution, however b = dist_coff must be determined by trial and error or fixed using known values from e.g. q-studies.

The amplitudes are assumed to be ground displacements (in SEISAN they are ground displacements highpass filtered at 1.25 Hz to resemble Wood Anderson seismograms, see MULPLT). The distance ratio between stations with the maximum distance and minimum distance must be more than 3 for the event to be selected for analysis. It is assumed that a and b will be the same for all events, while c is different (magnitude dependent). At the end, the average constants a and b are calculated of all values a and b which are not deviating too much (a must be in the range 0 to -5, hardwired). Distance attenuation coefficients a and b are supposed to be negative since amplitude decrease with distance. To get the local magnitude scale

the constant C must be determined by fixing the magnitude at some reference distance like the original Wood Anderson definition with at and (assuming gain of the Wood Anderson seismograph to be 2080, [Hutton and Boore, 1987]. The determination of a and b does not work well unless the observations are very good. The relation for California is [Hutton and Boore, 1987]

Output: On the screen the constants will be printed out and a file mag_amp.out will contain the values of a, b and c.

2: Magnitude relations and/or spectral parameter relations

Linear regression (maximum likelihood) can be made between any two magnitudes and/or spectral parameters on any of the header lines of an event in a CAT-file or a compact file. The user is interactively prompted for the magnitude type and/or spectral parameters and agencies to compare. If none is given, no magnitude comparison will be made. If several magnitudes/spectral parameters fit the requirement, the last one is used. If e.g. the first header line has a BER Ml and the last header line also has a BER Ml, the last one will be used. Maximum likelihood linear fitting is used. It is assumed that both variables have normal and correlated errors. See subroutine maxlik.for in LIB for more info.

The following parameter can be selected:

Any magnitude and agency

Seismic moment(log)

Stress drop (log)

Corner frequency (log)

Source radius(log)

Spectral decay

Omega zero level (log)

If any of the spectral parameters are selected, or moment magnitude is without agency, there will be an additional question about which station and component. A blank return means the average will be used. With these parameter selections, it is possible to compare spectral parameters from any two channels, compare the average spectral parameter with the parameter from one channel etc.

Output: A plot will be shown on the screen with the observations and the least squares fit and the values are also printed out on the screen. It is now possibel to click on any symbol to get up the correponding date and time. This facility can be used to find bad magnitides. A file mag_mag.out contains the pairs of magnitudes used.

If a relation between two magnitude scales is known, e.g. by using option 2 above, an output file can be made with the converted magnitudes. The relation to use is specified in the mag.par file. Several different input magnitude types and agencies can be used and the relation-agency used is given in a priority list in the mag.par file, see example below. It is here shown that if a BER Mc is available, this will be the first choice. If no BER Mc then BER Mb will be the next choice etc. The new magnitude will have type X and agency NEW. Output: The output file is mag_new.out and has the same format as the input file. On the header line, the old magnitudes are removed and in the first magnitude position will be the converted magnitude (NEW) while in the second magnitude position, the magnitude selected for conversion will be given. The third magnitude position is blanked out. The conversion option can also be used to move magnitudes around by using a 1 to 1 relation as shown in mag.par example.

Summary of output files:

mag_amp.out : |
Details each event for amplitude regression. |

mag_coda.out : |
Magnitude vs coda, see text. |

mag_mag.out : |
Pairs of magnitudes used for regression. |

mag_new.out : |
Events with converted magnitudes only. |

mag_newa.out : |
All events, both converted and non converted (due to no correct input magnitude available). |

mag_spec.out : |
Summary of normal header line, all associated magnitudes and spectral parameters. |

mag_ml_inv.out : |
From Ml inversion |

In DAT there is an example `mag.par` file.

An example of the `mag.par` parameter file:

This file is for parameters for MAG and called MAG.PAR. The name must be in lower case on Sun. The following shows the parameters which can be set. The file can contain any lines in any order, only the lines with recognized keywords and a non blank field under Par 1 will be read. The comments have no importance. The text fields are left justified, the real numbers can be anywhere within the 10 columns of the parameter. MAGAGA is the magnitude type and agency to use for the converted magnitude. MAGREL gives the magnitude and agency to use for conversion e.g. LBER and the parameters 2 and 3 gives the relationship: magnitude out = magnitude in * par2 + par3 The magnitude conversion uses one of the MAGREL relationships, where the priority is in the same order as found in the list. SCREENOUT can be (Y)ES or (N)O, indicates if a line is printed on the screen for each event. When doing a magnitude regression on coda or amplitude, BAD STATION indicates stations not to be used. MAG_TYP_COF is the magnitude type and agency to correlate coda readings with and the second parameter is the distance correction term used when calculating a coda magnitude relation with a fixed distance term. The same parameter is also used for amplitude regression. The input file can be either Nordic or compact Nordic, however if coda or amplitudes are to be used, it must be NORDIC. KEYWORD........Comments...........................Par.1.....Par.2.....Par.3..... BAD STATION Station not used for mag relation BER BAD STATION Station not used for mag relation XXX BAD STATION Station not used for mag relation BER MAGAGA Magnitude type and agency, new mag XNEW MAGREL Mag type, agency, a,b for new mag CBER 1.0 2.0 MAGREL Mag type, agency, a,b for new mag BBER 1.0 2.0 MAGREL Mag type, agency, a,b for new mag SBER 1.0 2.0 MAGREL Mag type, agency, a,b for new mag WBER 1.0 2.0 SCREENOUT Header line printed each event N MAG_TYP_COF Mag. type for corr., dist coff. LNAO 0.002