diff --git a/cmd/fdsn-quake-consumer/assets/sc3ml_0.13__quakeml_1.2.xsl b/cmd/fdsn-quake-consumer/assets/sc3ml_0.13__quakeml_1.2.xsl new file mode 100644 index 00000000..befa4308 --- /dev/null +++ b/cmd/fdsn-quake-consumer/assets/sc3ml_0.13__quakeml_1.2.xsl @@ -0,0 +1,748 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + induced or triggered event + meteorite + other event + other event + other event + other event + other event + other event + other event + other event + other event + other event + other event + other event + other event + other event + other event + other event + other event + other event + other event + other event + other event + other event + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + P waves + body waves + surface waves + mantle waves + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + other + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cmd/fdsn-quake-consumer/etc/2024p344188_0.13.xml b/cmd/fdsn-quake-consumer/etc/2024p344188_0.13.xml new file mode 100644 index 00000000..6a05c50e --- /dev/null +++ b/cmd/fdsn-quake-consumer/etc/2024p344188_0.13.xml @@ -0,0 +1,965 @@ + + + + + + + BW(4,2.5,15) + AIC + P + automatic + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:24:22.474553Z + + + 19.834430014354417 + SNR + + + + + + BW(4,2.5,15) + AIC + P + automatic + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:24:23.980015Z + + + 23.79178689946981 + SNR + + + + + + BW(4,2.5,15) + AIC + P + automatic + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:24:25.987677Z + + + 36.56153409317519 + SNR + + + + + + BW(4,2.5,15) + AIC + P + automatic + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:24:25.485678Z + + + 25.544627602654597 + SNR + + + + + + BW(4,2.5,15) + AIC + P + automatic + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:24:31.508588Z + + + 11.799742907757528 + SNR + + + + + + BW(4,2.5,15) + AIC + P + automatic + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:24:35.020229Z + + + 12.055562115057384 + SNR + + + + + + BW(4,2.5,15) + AIC + P + automatic + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:24:37.52965Z + + + 12.600444520823523 + SNR + + + + + + BW(4,2.5,15) + AIC + P + automatic + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:24:40.039004Z + + + 5.792956408250047 + SNR + + + + + + BW(4,2.5,15) + AIC + P + automatic + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:24:37.028297Z + + + 9.90858313975316 + SNR + + + + + + BW(4,2.5,15) + AIC + P + automatic + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:24:27.99465Z + + + 11.86513007017867 + SNR + + + + + + BW(4,2.5,15) + AIC + P + automatic + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:24:23.477661Z + + + 15.84969658181076 + SNR + + + + ML + + 4.460892001606508 + 0.4963567271016389 + 0.4963567271016398 + + + 2024-05-07T08:24:18.195Z + -11.094999 + 73.545 + + 5.014800999467099 + 20240507.082412.10-AIC-NZ.ARAZ.10.EHZ + + + WEL(GNS_Test) + scamp@eceqp06.geonet.org.nz + 2024-05-07T08:25:34.501716Z + + + + ML + + 0.9008225866586296 + 0.10861849553423208 + 0.10861849553423208 + + + 2024-05-07T08:24:17.09Z + -9.319999 + 74.37 + + 13.275722354675903 + 20240507.082412.77-AIC-NZ.WPRZ.10.EHZ + + + WEL(GNS_Test) + scamp@eceqp06.geonet.org.nz + 2024-05-07T08:25:36.503833Z + + + + ML + + 0.802527864284964 + 0.2751006462949439 + 0.2751006462949439 + + + 2024-05-07T08:24:15.78Z + -7.779999 + 81.3 + + 27.31108078455628 + 20240507.082413.00-AIC-NZ.ALRZ.10.EHZ + + + WEL(GNS_Test) + scamp@eceqp06.geonet.org.nz + 2024-05-07T08:25:41.510864Z + + + + ML + + 0.11274208610024788 + 0.029809022675782837 + 0.029809022675782837 + + + 2024-05-07T08:24:18.115Z + -8.744999 + 80.625 + + 6.173286111832603 + 20240507.082414.37-AIC-NZ.PRRZ.10.EHZ + + + WEL(GNS_Test) + scamp@eceqp06.geonet.org.nz + 2024-05-07T08:25:44.014337Z + + + + ML + + 0.026643368093575554 + 0.0004559793588821762 + 0.0004559793588821762 + + + 2024-05-07T08:24:30.235Z + -13.834999 + 93.025 + + 2.37338895531859 + 20240507.082421.40-AIC-NZ.MTHZ.10.EHZ + + + WEL(GNS_Test) + scamp@eceqp06.geonet.org.nz + 2024-05-07T08:26:08.550515Z + + + + ML + + 0.07779895907869505 + 7.845718970347915e-05 + 7.845718970346527e-05 + + + 2024-05-07T08:25:33.975Z + -76.914999 + 28.385 + + 1.5298644248637525 + 20240507.082422.06-AIC-NZ.BKZ.10.HHZ + + + WEL(GNS_Test) + scamp@eceqp06.geonet.org.nz + 2024-05-07T08:26:10.052733Z + + + + ML + + 0.05808462282633366 + 0.009047279542568433 + 0.00904727954256844 + + + 2024-05-07T08:24:31.475Z + -10.574999 + 103.645 + + 1.8524602853746708 + 20240507.082425.90-AIC-NZ.RAHZ.10.EHZ + + + WEL(GNS_Test) + scamp@eceqp06.geonet.org.nz + 2024-05-07T08:26:21.069449Z + + + + ML + + 0.12319921724262875 + 0.011984695886955873 + 0.011984695886955887 + + + 2024-05-07T08:24:22.56Z + -10.409999 + 36.08 + + 6.777741613878842 + 20240507.082417.15-AIC-NZ.HSRZ.10.EHZ + + + WEL(GNS_Test) + scamp@eceqp06.geonet.org.nz + 2024-05-07T08:26:30.279581Z + + + + MLv + + 3.414161201904214 + + + 2024-05-07T08:24:16.48Z + -9.38 + 95.62 + + 4.4759538678683715 + 20240507.082412.10-AIC-NZ.ARAZ.10.EHZ + + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:25:54.812846Z + + + + MLv + + 0.6619202005084016 + + + 2024-05-07T08:24:17.88Z + -10.11 + 94.89 + + 14.47891598680462 + 20240507.082412.77-AIC-NZ.WPRZ.10.EHZ + + + WEL(GNS_Test) + scamp@eceqp06.geonet.org.nz + 2024-05-07T08:25:54.02895Z + + + + MLv + + 1.121016542289534 + + + 2024-05-07T08:24:15.72Z + -7.72 + 97.28 + + 29.545752023840887 + 20240507.082413.00-AIC-NZ.ALRZ.10.EHZ + + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:25:55.314861Z + + + + MLv + + 0.10334066870150928 + + + 2024-05-07T08:24:18.31Z + -8.94 + 96.06 + + 4.223420621920674 + 20240507.082414.37-AIC-NZ.PRRZ.10.EHZ + + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:25:55.817393Z + + + + MLv + + 0.09175128554263902 + + + 2024-05-07T08:24:22.19Z + -10.04 + 94.96 + + 3.978545859797882 + 20240507.082417.15-AIC-NZ.HSRZ.10.EHZ + + + WEL(GNS_Test) + scautopick@eceqp06.geonet.org.nz + 2024-05-07T08:26:02.338874Z + + + + + + -38.620634773178807 + 20.788432822828636 + + + 176.2128674424493 + 59.63200891163431 + + + 5.1162109375 + 47.90405410369406 + + NonLinLoc + nz3drx + + 11 + 10 + 10 + 0.13178423630674604 + 76.05025526639076 + 103.53540022050215 + - + 1.7691420017250776 + 0.0752301603770797 + 0.42073261208804774 + + + 91.06907028087628 + 29.650226274511756 + 91.06907028087628 + 82.85112176801192 + + 133220.60282790705 + 35769.50157107233 + 56138.84701364717 + 125.81309535077644 + -31.7774263697107 + 80.73330402111526 + + + automatic + + WEL(GNS_Test) + screloc@eceqx06.geonet.org.nz + 2024-05-07T08:24:41.604178Z + + + 20240507.082412.10-AIC-NZ.ARAZ.10.EHZ + P + 0 + 262.8044649665457 + 0.0752301603770797 + -0.014181110475329106 + true + false + false + 1.7548053911487271 + + + 20240507.082412.77-AIC-NZ.WPRZ.10.EHZ + P + 0 + 338.85472023293647 + 0.1057131470766627 + 0.009727905180188401 + true + false + false + 1.6937572656915252 + + + 20240507.082413.00-AIC-NZ.ALRZ.10.EHZ + P + 0 + 61.86039873946805 + 0.11540765454092432 + 0.041491201307508163 + true + false + false + 1.6621946746192726 + + + 20240507.082414.37-AIC-NZ.PRRZ.10.EHZ + P + 0 + 50.21204179848849 + 0.1863896318543343 + -0.15311379632738031 + true + false + false + 1.4272634495915164 + + + 20240507.082417.15-AIC-NZ.HSRZ.10.EHZ + P + 0 + 6.339865187047877 + 0.3086254945142992 + 0.13891251363966006 + true + false + false + 1.1688740230511896 + + + 20240507.082421.40-AIC-NZ.MTHZ.10.EHZ + P + 0 + 116.0325275695501 + 0.5328397296617963 + -0.18937842569139463 + true + false + false + 0.8577324921878121 + + + 20240507.082422.06-AIC-NZ.BKZ.10.HHZ + P + 0 + 160.42515432667005 + 0.5823739904540164 + -0.4820361252763554 + true + false + false + 0.7730429749169101 + + + 20240507.082425.90-AIC-NZ.RAHZ.10.EHZ + P + 0 + 114.1904988866953 + 0.7306600831429819 + 0.5387204436323358 + true + false + false + 0.6622297195804018 + + + 20240507.082416.72-AIC-NZ.MTVZ.10.EHZ + P + 0 + 218.13608832994862 + 0.9758486804009027 + -12.64448390207079 + true + false + false + 5.00940582524839e-05 + + + 20240507.082414.91-AIC-NZ.PREZ.10.EHZ + P + 0 + 245.8684563383727 + 1.7691420017250776 + -26.322016073701647 + true + false + false + 4.991515439388221e-05 + + + 20240507.082412.71-AIC-NZ.THSZ.10.EHZ + P + 220.45381995493617 + 0.09903294586549342 + false + false + false + 0 + + + + 2.1585523011196575 + + ML + Amplitude/20240507082534.501668.37919 + + true + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:25:34.505959Z + + + + + 1.5485088123250257 + + ML + Amplitude/20240507082536.503799.37920 + + true + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:25:36.507701Z + + + + + 1.525279204039785 + + ML + Amplitude/20240507082541.51083.37922 + + true + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:25:41.514825Z + + + + + 0.8702263158318704 + + ML + Amplitude/20240507082544.014298.37923 + + true + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:25:44.01779Z + + + + + 1.4146751805623459 + + MLv + Amplitude/20240507082554.028914.37926 + + true + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:25:54.032321Z + + + + + 2.0424146148066615 + + MLv + 20240507.082412.10-AIC-NZ.ARAZ.10.EHZ.MLv + + true + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:25:54.816803Z + + + + + 1.670431105028863 + + MLv + 20240507.082413.00-AIC-NZ.ALRZ.10.EHZ.MLv + + true + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:25:55.31875Z + + + + + 0.8324115168650491 + + MLv + 20240507.082414.37-AIC-NZ.PRRZ.10.EHZ.MLv + + true + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:25:55.822733Z + + + + + 1.120553069705972 + + MLv + 20240507.082417.15-AIC-NZ.HSRZ.10.EHZ.MLv + + true + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:26:02.34256Z + + + + + 1.2068180304905038 + + ML + Amplitude/20240507082608.550476.37935 + + true + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:26:08.55491Z + + + + + 1.7147593978485318 + + ML + Amplitude/20240507082610.052693.37936 + + true + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:26:10.057299Z + + + + + 1.6702902046223596 + + ML + Amplitude/20240507082621.069399.37938 + + true + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:26:21.073042Z + + + + + 1.2485488602743389 + + ML + Amplitude/20240507082630.279544.37944 + + true + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:26:30.283027Z + + + + + 1.4857007516000909 + 0.21263538166102364 + + ML + trimmed mean(25) + 6 + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:25:34.505966Z + 2024-05-07T08:26:30.283081Z + + + NLL.20240507082440.072929.9683/staMag/ML/NZ.ARAZ + 0.6728515495195666 + 0 + + + NLL.20240507082440.072929.9683/staMag/ML/NZ.WPRZ + 0.06280806072493483 + 1 + + + NLL.20240507082440.072929.9683/staMag/ML/NZ.ALRZ + 0.039578452439694267 + 1 + + + NLL.20240507082440.072929.9683/staMag/ML/NZ.PRRZ + -0.6154744357682205 + 0 + + + NLL.20240507082440.072929.9683/staMag/ML/NZ.MTHZ + -0.278882721109587 + 1 + + + NLL.20240507082440.072929.9683/staMag/ML/NZ.BKZ + 0.22905864624844097 + 1 + + + NLL.20240507082440.072929.9683/staMag/ML/NZ.RAHZ + 0.1845894530222687 + 1 + + + NLL.20240507082440.072929.9683/staMag/ML/NZ.HSRZ + -0.237151891325752 + 1 + + + + + 1.4089917745797527 + 0.393910785524203 + + MLv + trimmed mean(25) + 5 + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:25:54.032328Z + 2024-05-07T08:26:02.342595Z + + + NLL.20240507082440.072929.9683/staMag/MLv/NZ.ARAZ + 0.6334228402269089 + 0.375 + + + NLL.20240507082440.072929.9683/staMag/MLv/NZ.WPRZ + 0.005683405982593204 + 1 + + + NLL.20240507082440.072929.9683/staMag/MLv/NZ.ALRZ + 0.26143933044911027 + 1 + + + NLL.20240507082440.072929.9683/staMag/MLv/NZ.PRRZ + -0.5765802577147036 + 0.375 + + + NLL.20240507082440.072929.9683/staMag/MLv/NZ.HSRZ + -0.28843870487378065 + 1 + + + + + 1.4089917745797527 + + M + weighted average + 5 + + WEL(GNS_Test) + scmag@eceqp06.geonet.org.nz + 2024-05-07T08:25:54.032349Z + 2024-05-07T08:26:02.342622Z + + + + + NLL.20240507082440.072929.9683 + NLL.20240507082440.072929.9683/netMag/M + other + + WEL(GNS_Test) + scevent@eceqp06.geonet.org.nz + 2024-05-07T08:24:40.074348Z + 2024-05-07T22:58:22.37962Z + + + Taupo + region name + + NLL.20240507082440.072929.9683 + + + diff --git a/cmd/fdsn-quake-consumer/sc3ml.go b/cmd/fdsn-quake-consumer/sc3ml.go index 739a54e7..655e84f7 100644 --- a/cmd/fdsn-quake-consumer/sc3ml.go +++ b/cmd/fdsn-quake-consumer/sc3ml.go @@ -19,6 +19,7 @@ var sc3ml08 = []byte(``) var sc3ml10 = []byte(``) var sc3ml11 = []byte(``) +var sc3ml13 = []byte(``) // event is for saving information to the db. // field names must match the column names in fdsn.event and the field names must be exported. @@ -55,34 +56,34 @@ type event struct { toQuakeMLEvent converts seisComPML to a QuakeML event fragment using an XSLT. Supported versions of SC3ML are - * 0.7 - * 0.8 - * 0.9 - * 0.10 - * 0.11 + - 0.7 + - 0.8 + - 0.9 + - 0.10 + - 0.11 + - 0.13 The xslt source is from http://geofon.gfz-potsdam.de/ns/seiscomp3-schema/0.7/sc3ml_0.7__quakeml_1.2.xsl It has been edited to output only an Event fragment without the parent elements and namespaces. e.g., - 129d128 - < xmlns="http://quakeml.org/xmlns/bed/1.2" - 132c131 - < - --- - > - 138c137 - < - --- - > - 145d143 - < - 147d144 - < - 156d152 - < - 158d153 - < - + 129d128 + < xmlns="http://quakeml.org/xmlns/bed/1.2" + 132c131 + < + --- + > + 138c137 + < + --- + > + 145d143 + < + 147d144 + < + 156d152 + < + 158d153 + < */ func toQuakeMLEvent(seisComPML []byte) (string, error) { cmd := exec.Command("/usr/bin/xsltproc") @@ -98,6 +99,8 @@ func toQuakeMLEvent(seisComPML []byte) (string, error) { cmd.Args = append(cmd.Args, "assets/sc3ml_0.10__quakeml_1.2.xsl") case bytes.Contains(seisComPML, sc3ml11): cmd.Args = append(cmd.Args, "assets/sc3ml_0.11__quakeml_1.2.xsl") + case bytes.Contains(seisComPML, sc3ml13): + cmd.Args = append(cmd.Args, "assets/sc3ml_0.13__quakeml_1.2.xsl") default: return "", fmt.Errorf("found no %s", "XSLT") diff --git a/cmd/fdsn-quake-consumer/sc3ml_test.go b/cmd/fdsn-quake-consumer/sc3ml_test.go index d4b6f7d4..cc3647a5 100644 --- a/cmd/fdsn-quake-consumer/sc3ml_test.go +++ b/cmd/fdsn-quake-consumer/sc3ml_test.go @@ -72,6 +72,55 @@ func TestEventUnmarshal(t *testing.T) { } } +func TestEventUnmarshalSC13(t *testing.T) { + for _, input := range []string{"2024p344188_0.13.xml"} { + b, err := os.ReadFile("etc/" + input) + if err != nil { + t.Fatal(err) + } + + var e event + + if err = unmarshal(b, &e); err != nil { + t.Error(err) + } + + c := event{ + PublicID: "2024p344188", + EventType: "other", + Longitude: 176.2128674424493, + Latitude: -38.62063477317881, + Depth: 5.1162109375, + EvaluationMethod: "NonLinLoc", + EarthModel: "nz3drx", + EvaluationMode: "automatic", + EvaluationStatus: "", + UsedPhaseCount: 10, + UsedStationCount: 10, + OriginError: 0.13178423630674604, + AzimuthalGap: 76.05025526639076, + MinimumDistance: 0.0752301603770797, + Magnitude: 1.4089917745797527, + MagnitudeUncertainty: 0, + MagnitudeType: "M", + MagnitudeStationCount: 5, + Deleted: false, + Sc3ml: string(b), + } + + c.ModificationTime, _ = time.Parse(time.RFC3339Nano, "2024-05-07T22:58:22.37962Z") + c.OriginTime, _ = time.Parse(time.RFC3339Nano, "2024-05-07T08:24:09.853066Z") + + if c.Quakeml12Event, err = toQuakeMLEvent(b); err != nil { + t.Error(err) + } + + if !reflect.DeepEqual(e, c) { + t.Errorf("c not equal to e, expected: %+v", e) + } + } +} + // TestEventType tests that the remapping of SC3ML event type to QuakeML is correct. // The bug in the sc3ml_*_quakeml_1.2.xsl conversion (inserting "other" instead of "other event" // has been fixed locally and reported upstream. GMC 12 Sept 2017