36. MAGRES, calculate average magnitude residuals

The program MAGRES is used to calculate different statistics related to magnitudes and magnitude residuals for all currently used magnitudes in SEISAN.

Calculate average station resuduals for all stations and components. A subselection can be made to use only some components. Thre are options to use a range of magntudes and only make an average if a given number of residuals are available. This can be used 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 component instead of horizontal component. It is mostly useful for Ml.

For a single station, the magnitude residual can be calculated as a function of time. This is an usefull option for detectiong gain changes at a station.

For a given magnitude using period, the statistics of periods is calculated for all stations with a period and a residual.

The statistics of the distribution of all residuals are always printed out and also the residuals as a function of distance.

The program only works 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 on the hyp.out file.

The options for making the comparison for a subset of data (line minimum number of data) comes 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

 Minimum number of residuals for average, enter for all

 Component to use, Z, N or E, if blank use all

 Accept blank component (y=enter/n)

 Station to use for residual vs time, if blank do not do
EFI

 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 . :

test1.hyp

 2011 0101 0956 58.7 R -26.851 -63.237 584.FFISC999 3.9 6.7bBER         6.7bISC
 2011 0102 2020 18.2 R -38.391 -73.399 23.0FFISC999 2.0 6.2LBER 7.0sBER 6.5bISC
 2011 0109 1003 43.9 R -19.274 168.379 20.7FFISC999 2.1 6.4sBER 6.3SBER 6.0bISC
 2011 0112 2132 54.9 R  26.967 140.016 524.FFISC999 2.5 6.3bBER         6.2bISC
 2011 0113 1616 42.9 R -20.604 168.585 14.8FFISC999 2.1 7.0sBER 6.9SBER 6.7bISC
 2011 0117 1920 57.9 R  -5.104 102.602 39.1FFISC999 3.5 5.8sBER 5.5SBER 6.1bISC
 2011 0118 2023 25.0 R  28.683  63.995 79.9FFISC999 2.0 8.0LBER 6.7bBER 6.8bISC
 2011 0124 0245 31.0 R  38.402  72.847 102.FFISC999 2.0 7.2LBER 6.0bBER 6.0bISC
End of s-file

Analysis for  1207 channels. It might take some time
ATAH    ATAH    EFI  S ZEFI  S ZEFI     EFI     PTGA    PTGA    ROSC    ROSC    
RCBR    RCBR    HOPE    HOPE    SDV     SDV     PAYG    PAYG    PMSA    PMSA    
BCIP    BCIP    FDF  S ZFDF  S ZFDF     FDF     JTS     JTS     TRIS    TRIS    
SEUS    SEUS    SABA    SABA    ANWB    ANWB    SMRT    SMRT    OBIP    OBIP    
.....
.....


 Number of events in input file or data base           8
 Number of channels with mag        1207
 Number of stations with mag        1009
 Number of stations with magnitudes on Z,N and E           0
 Total number of periods for chosen magnitude        4055
 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 file with histogram data of periods is magres_period.out
 Output of residuals vs time for one station magres_time_EFI.out
 Output of residuals vs distance, all data is magres_distance.out

The file magres_all.out lists all residuals independent of selection critria while the selected ones are in file magres_selected.out. An example of magres_all.out:

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

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. If agency is available, it is also givern. All data is used.

  2235.000     -0.74
  2527.000      0.08       MOS
  2527.000      0.04       GFZ
  2527.000      0.09       NEI
  2710.000      0.07       MOS
  2733.000      0.34       NEI
  2986.000     -0.32
  3017.000      0.52       NEI
  3262.000      0.14       MOS
  3262.000      0.14       NEI
  3369.000      0.24       MOS
  3369.000     -0.10       GFZ

The file magres_histogram.out gives the statistics. Only magnitude residual between -1 and 1 are counted since it is assumed that larger residuals are errros.

  -1.00000000              34
 -0.899999976              83
 -0.800000012              53
 -0.699999988             109
 -0.600000024             113
 -0.500000000             195
 -0.400000006             248
 -0.300000012             288
 -0.200000003             350
 -0.100000001             383
   0.00000000             401
  0.100000001             351
  0.200000003             351
  0.300000012             284
  0.400000006             231
  0.500000000             201
  0.600000024             124
  0.699999988              55
  0.800000012              53
  0.899999976              19
   1.00000000              20

The file station magres_time_EFI.out gives the resuals as a function of time for the selecte station EFI.

   2011.08606     -0.419999987
   2011.08606      0.550000012
   2011.11890      -9.00000036E-02
   2011.11890       5.99999987E-02

The file magres_period.out give the period statistics.

  0.200000003               2
  0.300000012               7
  0.400000006              29
  0.500000000              28
  0.600000024              71
  0.699999988             143
  0.800000012             356
  0.899999976             497
   1.00000000             576
   1.10000002             474
   1.20000005             312
   1.29999995             270
   1.39999998             252
   1.50000000             174
   1.60000002             166
   1.70000005             109
   1.79999995             130
   1.89999998              79
   2.00000000              70
   2.09999990              43
   2.20000005              32
   2.29999995              42
   2.40000010              25
   2.50000000              45
   2.59999990              19
   2.70000005              22
   2.79999995              49
   2.90000010              17
   3.00000000              16

It is seen that most periods are at 1.0 s as expected for mb.