36. MAGRES, calculate average magnitude residuals

The program MAGRES is used to calcualte average magnitude residuals for each station and component in a given data set. Currently the program only work with Nordic2 format, which has the magnitude residual in the S-file after it has been updated. So if data is in Nordic format, transfer to Nordic2 with NOR2NOR2, relocate the events and run the program. The progrsam is intended to check a data set for stations with a magnitude bias. In addition, if magnitudes are available on all 3 components, the average difference in magnitude between vertical and horizontal components, are calculated. This can be used to find if there is a bias using vertical compoent instead of horizontal component. This is mostly usweful for Ml.

The program has several options for making the comparison for a subset of data. This will come out in a separate file.

Below is an example:

magres
 Magnitude type: L, C, b, B, s, S or W
b
 Other selection criteria for 2. output: y/n=enter
y
 Average absolute residual range, enter for all
0.0 0.3
 Minimum number of residuals for average, enter for all
3
 Component to use, Z, N or E, if blank use all

 Accept blank component (y=enter/n)
y
 Only list first entry from a station(y/n=enter)

  Event data input - select one:

     SEISAN default data base or                     :Enter
     Alternative data base, give 1-5 letter code or  :
     Local index file, name must start with index or :
     Local data base, write ,, or                    :
     Filename for one file, min. 6 chars or with a . :

test.inp


 2016 0101 0200 40.5 RQ-50.622 139.549 15.3FFISC836 3.5 6.2sBER 6.1SBER 6.0bISC
 2016 0103 2305 18.9 RQ 24.831  93.605 31.0FFISC999 2.5 6.7LBER 6.2sBER 6.6bISC
 2016 0111 1638 08.0 R   3.802 126.840 22.0FFISC999 9.0 6.5sBER 6.9SBER 6.1bISC
 2016 0114 0325 27.6 R -19.711 -63.317 582.FFISC951 2.9 6.1LBER 6.0bBER 6.0bISC
 2016 0114 0325 31.4 RQ 42.044 142.697 31.0FFISC999 3.6 6.4sBER 6.6SBER 6.5bISC
 ..
 ..

 Residuals for magnitude type b

 STAT COM      N        AV      SD
 CASY BHZ      4      0.12    0.12
 FORT BHZ      3      0.17    0.29
 RPZ  HHZ      3      0.17    0.08
 THZ  HHZ      3      0.01    0.17
 ASAR          6     -0.61    0.23
 MORW BHZ      5      0.10    0.09
 VNDA          4     -0.65    0.54
 RK1H          2     -0.66    0.24
 SBA  S Z      2      0.23    0.31
 SBA  BHZ      1      0.03    0.00
 URZ           3     -0.32    0.26

 Average horizontal mag res minus mag res on Z for station MNK    -0.74

 Number of events in input file or data base          11
 Number of channels with mag        1905
 Number of stations with mag        1589
 Number of stations with magnitudes on Z,N and E           1
 Output file name is magres_all.out for all stations
 Output file name is magres_selected.out for selected stations
 Output of histogram, all residuals, is magres_histogram.out
 Output of residuals vs distance, all data is magres_distance.out

The output on the screen and file magres.out lists all residuals while the selected ones are in file magres_selected.out. An example of magres_selected.oput:

Residuals for magnitude type b

 STAT COM      N        AV      SD     LAT     LON   ELEVA
 CASY BHZ      4      0.12    0.12 -66.279 110.536 154.000
 FORT BHZ      3      0.17    0.29 -30.779 128.059 165.000
 RPZ  HHZ      3      0.17    0.08 -43.715 171.054 453.000
 THZ  HHZ      3      0.01    0.17 -41.763 172.905 747.000
 MORW BHZ      5      0.10    0.09 -29.068 116.040 296.000
 WR0  BHZ      4      0.08    0.21 -19.960 134.540 353.000
 WRA           7     -0.23    0.23 -19.943 134.339 419.000
 WRAB S Z      7     -0.05    0.12 -19.933 134.350 366.000
 CTAO S Z      6     -0.11    0.38 -20.088 146.254 357.000
 PSA00BHZ      6      0.09    0.14 -21.573 119.846 244.000
 OUENCBHZ      3      0.16    0.05 -22.418 166.842 115.000
 DZM          12     -0.05    0.34 -22.071 166.444 905.000
 MTN  BHZ      3      0.18    0.17 -12.844 131.133 137.000
 QSPA BHZ      3      0.02    0.20 -89.928 145.0002657.000
 BATI          8     -0.12    0.16 -10.207 123.663 356.000
 MSVF S Z      4     -0.05    0.15 -17.733 178.050 783.000
 JAGI BHZ      5     -0.00    0.28  -8.470 114.152 171.000

The file also has the location of the stations so it can be used for making a map with the residuals.

The magres_distance.out lists the distance in km vs the residual. All data is used. Example:

   2390.00000      0.230000004
   2400.00000      0.319999993
   2487.00000       9.00000036E-02
   2728.00000       5.99999987E-02
   3029.00000     -0.920000017
   3097.00000      0.100000001
   3142.00000     -0.660000026
   3165.00000     -0.829999983
   3238.00000       9.99999978E-03