anss-formats 0.0.3__py3-none-any.whl → 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- anss_formats-0.1.0.dist-info/METADATA +735 -0
- anss_formats-0.1.0.dist-info/RECORD +18 -0
- anssformats/channel.py +4 -40
- anssformats/detection.py +66 -0
- anssformats/formatbasemodel.py +10 -9
- anssformats/geojson.py +41 -0
- anssformats/hypocenter.py +47 -0
- anssformats/machineLearning.py +3 -9
- anssformats/magnitude.py +35 -0
- anssformats/pick.py +0 -5
- anss_formats-0.0.3.dist-info/METADATA +0 -51
- anss_formats-0.0.3.dist-info/RECORD +0 -15
- anssformats/beam.py +0 -34
- {anss_formats-0.0.3.dist-info → anss_formats-0.1.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,735 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: anss-formats
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python implementation of the library used to communicate seismic event detection information between systems
|
|
5
|
+
License: CC0-1.0
|
|
6
|
+
Keywords: anss,earthquakes,formats,detection
|
|
7
|
+
Author: John Patton
|
|
8
|
+
Author-email: jpatton@usgs.gov
|
|
9
|
+
Requires-Python: >3.9.1,<3.12
|
|
10
|
+
Classifier: License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Provides-Extra: pycurl
|
|
15
|
+
Requires-Dist: certifi (>=2024.07.04,<2025.0.0)
|
|
16
|
+
Requires-Dist: cryptography (>=44.0.1,<45.0.0)
|
|
17
|
+
Requires-Dist: docutils (!=0.21.post1)
|
|
18
|
+
Requires-Dist: dparse (>=0.6.2,<0.7.0)
|
|
19
|
+
Requires-Dist: pydantic (>=2.6.0,<3.0.0)
|
|
20
|
+
Requires-Dist: requests (>=2.32.2,<3.0.0)
|
|
21
|
+
Requires-Dist: twine (>=5.1.1,<6.0.0)
|
|
22
|
+
Project-URL: Homepage, https://gitlab.com/anss-netops/anss-data-formats
|
|
23
|
+
Project-URL: Repository, https://gitlab.com/anss-netops/anss-data-formats
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# ANSS Data Formats
|
|
27
|
+
|
|
28
|
+
This is the Python implementation of the library used to generate and parse the
|
|
29
|
+
ANSS Formats.
|
|
30
|
+
|
|
31
|
+
Dependencies
|
|
32
|
+
------
|
|
33
|
+
* ANSS Formats utilizes [JSON](www.json.org) for formatting.
|
|
34
|
+
* ANSS Formats was written in Python 3.6
|
|
35
|
+
* ANSS Formats uses [poetry](https://python-poetry.org/) for
|
|
36
|
+
Package, dependency and environment management.
|
|
37
|
+
|
|
38
|
+
The US Geological Survey (USGS) Advanced National Seismic System (ANSS) defines a number of data exchange formats to communicate seismic event detection information between processing systems. These formats are defined using objects as defined in the [JSON standard](http://www.json.org).
|
|
39
|
+
|
|
40
|
+
The purpose of this project is to:
|
|
41
|
+
|
|
42
|
+
1. Define formats to hold data representing the estimates of various types of
|
|
43
|
+
seismic event detections.
|
|
44
|
+
2. Store the format definitions in a source controlled manner.
|
|
45
|
+
3. Host libraries used to generate, parse, and validate the formats
|
|
46
|
+
|
|
47
|
+
## Defined formats:
|
|
48
|
+
|
|
49
|
+
* [Pick](format-docs/Pick.md) Format - A format for unassociated picks from a waveform arrival time picking algorithm.
|
|
50
|
+
* [Detection](format-docs/Detection.md) Format - A format for an earthquake detection picks from a seismic detection algorithm.
|
|
51
|
+
|
|
52
|
+
## Supporting format objects:
|
|
53
|
+
|
|
54
|
+
* [Amplitude](format-docs/Amplitude.md) Object - An object that contains information about an amplitude as part of a pick.
|
|
55
|
+
* [Associated](format-docs/Associated.md) Object - An object that contains associated information if a pick is included in a detection.
|
|
56
|
+
* [Channel](format-docs/Channel.md) Object - A geoJSON object that contains channel/location information as part of a pick.
|
|
57
|
+
* [EventType](format-docs/EventType.md) Object - An object that defines the event type for MachineLearning info.
|
|
58
|
+
* [Filter](format-docs/Filter.md) Object - An object that contains filter information as part of a pick.
|
|
59
|
+
* [Hypocenter](format-docs/Hypocenter.md) Object - A geoJSON object that contains the hypocentral location, arrival time, and error information as part of a detection.
|
|
60
|
+
* [MachineLearning](format-docs/MachineLearning.md) Object - An object that defines the machine learning information for a pick.
|
|
61
|
+
* [Magnitude](format-docs/Magnitude.md) Object - An object that defines an earthquake magnitude estimation, as part of a Machine Learning classification or earthquake detection.
|
|
62
|
+
* [Quality](format-docs/Quality.md) Object - An object that defines the data quality of a pick.
|
|
63
|
+
* [Source](format-docs/Source.md) Object - An object that defines the creator/source of a pick.
|
|
64
|
+
|
|
65
|
+
# Amplitude Object Specification
|
|
66
|
+
|
|
67
|
+
## Description
|
|
68
|
+
|
|
69
|
+
The Amplitude object is an object designed to encode the amplitude information
|
|
70
|
+
that may or may not be part of the [Pick](Pick.md) Format. Amplitude uses the
|
|
71
|
+
[JSON standard](http://www.json.org).
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
The Amplitude object is intended for use as part of the [Pick](Pick.md) Format
|
|
76
|
+
in seismic data messaging between seismic applications and organizations.
|
|
77
|
+
|
|
78
|
+
## Output
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"amplitude" : Number,
|
|
83
|
+
"period" : Number,
|
|
84
|
+
"snr" : Number
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Glossary
|
|
89
|
+
|
|
90
|
+
**Optional Values:**
|
|
91
|
+
|
|
92
|
+
The following are values that **may or may not** be provided as part of an
|
|
93
|
+
amplitude.
|
|
94
|
+
|
|
95
|
+
* amplitude - A decimal number containing the amplitude.
|
|
96
|
+
* period - A decimal number containing the amplitude period.
|
|
97
|
+
* snr - A decimal number containing the signal to noise ratio, capped at 1E9.
|
|
98
|
+
|
|
99
|
+
# Association Object Specification
|
|
100
|
+
|
|
101
|
+
## Description
|
|
102
|
+
|
|
103
|
+
The Association object is an object designed to encode information provided when
|
|
104
|
+
a [Pick](Pick.md). Association uses the [JSON standard](http://www.json.org).
|
|
105
|
+
|
|
106
|
+
## Usage
|
|
107
|
+
|
|
108
|
+
Association is intended for use as part of the [Pick](Pick.md) Format in seismic data messaging between seismic applications and organizations.
|
|
109
|
+
|
|
110
|
+
## Output
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"phase" : String,
|
|
115
|
+
"distance" : Number,
|
|
116
|
+
"azimuth" : Number,
|
|
117
|
+
"residual" : Number,
|
|
118
|
+
"sigma" : Number
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Glossary
|
|
123
|
+
|
|
124
|
+
**Optional Values:**
|
|
125
|
+
|
|
126
|
+
The following are values that **may or may not** be provided as part of
|
|
127
|
+
association.
|
|
128
|
+
|
|
129
|
+
* phase - A string that identifies the seismic phase for this data if Association.
|
|
130
|
+
* distance - A decimal number containing the distance in degrees between the detection's and data's locations if Association.
|
|
131
|
+
* azimuth - A decimal number containing the azimuth in degrees between the detection's and data's locations if Association.
|
|
132
|
+
* residual - A decimal number containing residual in seconds of the data if Association.
|
|
133
|
+
* sigma - A decimal number reflecting the number of standard deviations of the data from the calculated value if Association.
|
|
134
|
+
|
|
135
|
+
# Site Object Specification
|
|
136
|
+
|
|
137
|
+
## Description
|
|
138
|
+
|
|
139
|
+
The Site object is an object designed to define the seismic station used to
|
|
140
|
+
produce a [Pick](Pick.md) message. Site uses the [JSON](https://www.json.org) and [GeoJSON](https://geojson.org/) standards.
|
|
141
|
+
|
|
142
|
+
## Usage
|
|
143
|
+
|
|
144
|
+
Site is intended for use as part of the [Pick](Pick.md) Format in seismic data messaging between seismic applications and organizations.
|
|
145
|
+
|
|
146
|
+
## Output
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"type": "Feature",
|
|
151
|
+
"geometry": {
|
|
152
|
+
"type": "Point",
|
|
153
|
+
"coordinates": [125.6, 10.1]
|
|
154
|
+
},
|
|
155
|
+
"properties": {
|
|
156
|
+
"station" : String,
|
|
157
|
+
"channel" : String,
|
|
158
|
+
"network" : String,
|
|
159
|
+
"location" : String
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Glossary
|
|
165
|
+
|
|
166
|
+
**Required Values:**
|
|
167
|
+
|
|
168
|
+
These are the properties **required** to define a Site.
|
|
169
|
+
|
|
170
|
+
* type - A string indicating the geojson feature type
|
|
171
|
+
* geometry - A geojson point containing the station coordinates in the form [Latitude, Longitude, Elevation (in meters)]
|
|
172
|
+
* properties - The associated properties for this geojson feature
|
|
173
|
+
|
|
174
|
+
**Required Properties:**
|
|
175
|
+
|
|
176
|
+
These geojson feature properties are **required** to define a Site.
|
|
177
|
+
* station - A string the station code.
|
|
178
|
+
* network - A string containing network code.
|
|
179
|
+
|
|
180
|
+
**Optional Properties:**
|
|
181
|
+
|
|
182
|
+
The following are supplementary geojson feature properties that **may or may not** be provided by
|
|
183
|
+
various algorithms.
|
|
184
|
+
|
|
185
|
+
* channel - A string containing the channel code.
|
|
186
|
+
* location - A string containing the location code.
|
|
187
|
+
|
|
188
|
+
# Detection Format Specification
|
|
189
|
+
|
|
190
|
+
## Description
|
|
191
|
+
|
|
192
|
+
Detection is a format designed to encode the basic information of an earthquake
|
|
193
|
+
event Detection. Detection uses the [JSON standard](http://www.json.org).
|
|
194
|
+
|
|
195
|
+
## Usage
|
|
196
|
+
|
|
197
|
+
Detection is intended for use in seismic data messaging between seismic
|
|
198
|
+
applications.
|
|
199
|
+
|
|
200
|
+
## Output
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"type" : "Detection",
|
|
205
|
+
"id" : String,
|
|
206
|
+
"source" :
|
|
207
|
+
{
|
|
208
|
+
"agencyID" : String,
|
|
209
|
+
"author" : String
|
|
210
|
+
},
|
|
211
|
+
"hypocenter" :
|
|
212
|
+
{
|
|
213
|
+
"type": "Feature",
|
|
214
|
+
"geometry": {
|
|
215
|
+
"type": "Point",
|
|
216
|
+
"coordinates": [125.6, 10.1, 1589.0]
|
|
217
|
+
},
|
|
218
|
+
"properties": {
|
|
219
|
+
"originTime" : ISO8601,
|
|
220
|
+
"latitudeError" : Number,
|
|
221
|
+
"longitudeError" : Number,
|
|
222
|
+
"depthError" : Number,
|
|
223
|
+
"originTimeError" : Number
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
"detectionType" : String,
|
|
227
|
+
"detectionTime" : ISO8601,
|
|
228
|
+
"eventType" :
|
|
229
|
+
{
|
|
230
|
+
"type" : String,
|
|
231
|
+
"certainty" : String
|
|
232
|
+
},
|
|
233
|
+
"minimumDistance" : Number,
|
|
234
|
+
"rms" : Number,
|
|
235
|
+
"maximumGap" : Number,
|
|
236
|
+
"detector" : String,
|
|
237
|
+
"pickData" : [Pick Objects],
|
|
238
|
+
"magnitudeData" :
|
|
239
|
+
[
|
|
240
|
+
{
|
|
241
|
+
"type" : String,
|
|
242
|
+
"id" : String,
|
|
243
|
+
"value" : Number,
|
|
244
|
+
"source" :
|
|
245
|
+
{
|
|
246
|
+
"agencyID" : String,
|
|
247
|
+
"author" : String
|
|
248
|
+
},
|
|
249
|
+
"error" : Number,
|
|
250
|
+
"probability" : Number
|
|
251
|
+
}, ...
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Glossary
|
|
257
|
+
|
|
258
|
+
**Required Values:**
|
|
259
|
+
|
|
260
|
+
These are the values **required** to define a detection.
|
|
261
|
+
|
|
262
|
+
* type - A string that identifies this message as a detection.
|
|
263
|
+
* id - A string containing an unique identifier for this Detection.
|
|
264
|
+
* source - An object containing the source of the Detection, see [Source](Source.md).
|
|
265
|
+
* hypocenter - An object containing the hypocenter of the Detection, see [Hypocenter](Hypocenter.md).
|
|
266
|
+
|
|
267
|
+
**Optional Values:**
|
|
268
|
+
|
|
269
|
+
The following are supplementary values that **may or may not** be provided as part of a detection.
|
|
270
|
+
|
|
271
|
+
* detectionType - A string that identifies whether the Detection is `New`, `Update`, or `Final`.
|
|
272
|
+
* detectionTime - A string containing the UTC time this detection was made, i.e. how quickly after origin time was this detection created, in the ISO8601 format `YYYY-MM-DDTHH:MM:SS.SSSZ`.
|
|
273
|
+
* eventType - An object containing the event type of the correlation, see [EventType](EventType.md).
|
|
274
|
+
* rms - A decimal number containing the rms estimate for the detction
|
|
275
|
+
* minimumDistance - A decimal number representing the minimum distance to the closest supporting station.
|
|
276
|
+
* maximumGap - A decimal number representing the maximum gap in degrees between supporting stations.
|
|
277
|
+
* detector - A string identifying the detection grid, algorithm, or other information.
|
|
278
|
+
* pickData - An array of [Pick](Pick.md) objects used to generate this Detection.
|
|
279
|
+
* magnitudeData - An array of [Magnitude](Magnitude.md) objects for this Detection.
|
|
280
|
+
|
|
281
|
+
# EventType Object Specification
|
|
282
|
+
|
|
283
|
+
## Description
|
|
284
|
+
|
|
285
|
+
The EventType object is an object designed to define the originating seismic
|
|
286
|
+
organization that produced a [MachineLearning](MachineLearning.md) object.
|
|
287
|
+
Site uses the [JSON standard](http://www.json.org).
|
|
288
|
+
|
|
289
|
+
## Usage
|
|
290
|
+
|
|
291
|
+
EventType is intended for use as part of the [PicMachineLearningk](MachineLearning.md) Oject in seismic data
|
|
292
|
+
messaging between seismic applications and organizations.
|
|
293
|
+
|
|
294
|
+
## Output
|
|
295
|
+
|
|
296
|
+
```json
|
|
297
|
+
{
|
|
298
|
+
"type" : String,
|
|
299
|
+
"certainty" : String
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Glossary
|
|
304
|
+
|
|
305
|
+
**Required Values:**
|
|
306
|
+
|
|
307
|
+
These are the values **required** to define a EventType
|
|
308
|
+
|
|
309
|
+
* type - A string containing the event type, allowed type strings are: "Earthquake", "MineCollapse", "NuclearExplosion", "QuarryBlast", "InducedOrTriggered", "RockBurst", "FluidInjection", "IceQuake", and "VolcanicEruption"
|
|
310
|
+
|
|
311
|
+
**Optional Values:**
|
|
312
|
+
|
|
313
|
+
The following are values that **may or may not** be provided as part of EventType.
|
|
314
|
+
|
|
315
|
+
* certainty - A string containing the certainty of the event type; allowed strings are "Suspected" and "Confirmed"
|
|
316
|
+
|
|
317
|
+
# Filter Object Specification
|
|
318
|
+
|
|
319
|
+
## Description
|
|
320
|
+
|
|
321
|
+
The Filter object is an object designed to encode a single set of filter
|
|
322
|
+
frequencies that may or may not be part of the filter list in the [Pick](Pick.md)
|
|
323
|
+
Format. Filter uses the [JSON standard](http://www.json.org) .
|
|
324
|
+
|
|
325
|
+
## Usage
|
|
326
|
+
|
|
327
|
+
The Filter object is intended for use as part of the [Pick](Pick.md) Format
|
|
328
|
+
in seismic data messaging between seismic applications and organizations.
|
|
329
|
+
|
|
330
|
+
## Output
|
|
331
|
+
|
|
332
|
+
```json
|
|
333
|
+
{
|
|
334
|
+
"type" : String,
|
|
335
|
+
"highPass" : Number,
|
|
336
|
+
"lowPass" : Number,
|
|
337
|
+
"units" : String
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## Glossary
|
|
342
|
+
|
|
343
|
+
**Optional Values:**
|
|
344
|
+
|
|
345
|
+
The following are values that **may or may not** be provided as part of a filter.
|
|
346
|
+
|
|
347
|
+
* type - A string containing the type of filter
|
|
348
|
+
* highPass - A decimal number containing the high pass frequency in Hz.
|
|
349
|
+
* lowPass - A decimal number containing the low pass frequency in Hz.
|
|
350
|
+
* units - A string containing the filter frequency units.
|
|
351
|
+
|
|
352
|
+
Note: The Type of filter is assumed to be "BandPass", and the Units are assumed
|
|
353
|
+
to be "Hertz"
|
|
354
|
+
|
|
355
|
+
# Hypocenter Object Specification
|
|
356
|
+
|
|
357
|
+
## Description
|
|
358
|
+
|
|
359
|
+
The Hypocenter object is an object designed to define a Hypocenter as part of a [Detection](Detection.md) message. Hypocenter uses the [JSON standard](http://www.json.org) and [GeoJSON](https://geojson.org/) standards.
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
## Usage
|
|
363
|
+
|
|
364
|
+
Hypocenter is intended for use as part of the [Detection](Detection.md) Format in seismic data messaging between seismic applications and organizations.
|
|
365
|
+
|
|
366
|
+
## Output
|
|
367
|
+
|
|
368
|
+
```json
|
|
369
|
+
{
|
|
370
|
+
"type": "Feature",
|
|
371
|
+
"geometry": {
|
|
372
|
+
"type": "Point",
|
|
373
|
+
"coordinates": [125.6, 10.1, 1589.0]
|
|
374
|
+
},
|
|
375
|
+
"properties": {
|
|
376
|
+
"originTime" : ISO8601,
|
|
377
|
+
"latitudeError" : Number,
|
|
378
|
+
"longitudeError" : Number,
|
|
379
|
+
"depthError" : Number,
|
|
380
|
+
"originTimeError" : Number
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
## Glossary
|
|
386
|
+
|
|
387
|
+
**Required Values:**
|
|
388
|
+
|
|
389
|
+
These are the values **required** to define a hypocenter.
|
|
390
|
+
* type - A string indicating the geojson feature type, always a point
|
|
391
|
+
* geometry - A geojson point containing the station coordinates in the form [Latitude, Longitude, Depth (in meters)]
|
|
392
|
+
* properties - The associated properties for this geojson feature
|
|
393
|
+
|
|
394
|
+
**Required Properties:**
|
|
395
|
+
|
|
396
|
+
These geojson feature properties are **required** to define a hypocenter.
|
|
397
|
+
* originTime - A string containing the UTC origin time of this hypocenter, in the ISO8601 format `YYYY-MM-DDTHH:MM:SS.SSSZ`.
|
|
398
|
+
|
|
399
|
+
**Optional Properties:**
|
|
400
|
+
|
|
401
|
+
The following are supplementary geojson feature properties that **may or may not** be provided by
|
|
402
|
+
various algorithms.
|
|
403
|
+
|
|
404
|
+
* latitudeError - A decimal number that identifies the error of the latitude of this hypocenter in kilometers.
|
|
405
|
+
* longitudeError - A decimal number that identifies the error of the longitude of this hypocenter in kilometers.
|
|
406
|
+
* depthError - A decimal number that identifies the depth error of this hypocenter in kilometers.
|
|
407
|
+
* originTimeError - A decimal number that identifies the error of the origin time in seconds.
|
|
408
|
+
|
|
409
|
+
# MachineLearning Object Specification
|
|
410
|
+
|
|
411
|
+
## Description
|
|
412
|
+
|
|
413
|
+
The MachineLearning object is an object designed to encode value added
|
|
414
|
+
information available for a [Pick](Pick.md) from advanced algorithms such as
|
|
415
|
+
machine learning. MachineLearning uses the [JSON standard](http://www.json.org).
|
|
416
|
+
|
|
417
|
+
## Usage
|
|
418
|
+
|
|
419
|
+
MachineLearning is intended for use as part of the [Pick](Pick.md) Format in
|
|
420
|
+
seismic data messaging between seismic
|
|
421
|
+
applications and organizations.
|
|
422
|
+
|
|
423
|
+
## Output
|
|
424
|
+
|
|
425
|
+
```json
|
|
426
|
+
{
|
|
427
|
+
"phase" : String,
|
|
428
|
+
"phaseProbability" : Number,
|
|
429
|
+
"distance" : Number,
|
|
430
|
+
"distanceProbability" : Number,
|
|
431
|
+
"distanceRangeHalfWidth" : Number,
|
|
432
|
+
"distanceRangeSigma" : Number,
|
|
433
|
+
"backAzimuth" : Number,
|
|
434
|
+
"backAzimuthProbability" : Number,
|
|
435
|
+
"magnitude" :
|
|
436
|
+
{
|
|
437
|
+
"type" : String,
|
|
438
|
+
"id" : String,
|
|
439
|
+
"value" : Number,
|
|
440
|
+
"source" :
|
|
441
|
+
{
|
|
442
|
+
"agencyID" : String,
|
|
443
|
+
"author" : String
|
|
444
|
+
},
|
|
445
|
+
"error" : Number,
|
|
446
|
+
"probability" : Number
|
|
447
|
+
},
|
|
448
|
+
"depth" : Number,
|
|
449
|
+
"depthProbability" : Number,
|
|
450
|
+
"eventType" :
|
|
451
|
+
{
|
|
452
|
+
"type" : String,
|
|
453
|
+
"certainty" : String
|
|
454
|
+
},
|
|
455
|
+
"eventTypeProbability" : Number,
|
|
456
|
+
"repickShift" : Number,
|
|
457
|
+
"repickSTD" : Number,
|
|
458
|
+
"repickCredibleIntervalLower" : Number,
|
|
459
|
+
"repickCredibleIntervalUpper" : Number,
|
|
460
|
+
"source" :
|
|
461
|
+
{
|
|
462
|
+
"agencyID" : String,
|
|
463
|
+
"author" : String
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
## Glossary
|
|
469
|
+
|
|
470
|
+
**Optional Values:**
|
|
471
|
+
|
|
472
|
+
The following are values that **may or may not** be provided as part of MachineLearning.
|
|
473
|
+
|
|
474
|
+
* phase - A string that identifies the seismic phase for this data
|
|
475
|
+
* phaseProbability - A decimal number containing the probability of the phase identification
|
|
476
|
+
* distance - A decimal number containing a distance estimation in degrees
|
|
477
|
+
* distanceProbability - A decimal number containing the probability of the distance estimation
|
|
478
|
+
* distanceRangeHalfWidth - A decimal number containing the half-width of a distance range centered at Distance (e.g. Distance is 15 deg +/- 10 deg)
|
|
479
|
+
* distanceRangeSigma - A decimal number containing the standard deviation for a probability PDF curve for Distance (e.g. Distance is 15 deg +/- 3 * DistanceRangeSigma where DistanceProbability is modified by the PDF probability, lowering as it gets further from Distance ). DistanceRangeSigma is mutually exclusive of DistanceRangeHalfWidth, and if both are provided DistanceRangeSigma should be used.
|
|
480
|
+
* backAzimuth - A decimal number containing a backazimuth estimation in degrees
|
|
481
|
+
* backAzimuthProbability - A decimal number containing the probability of the backazimuth estimation
|
|
482
|
+
* magnitude - A [Magnitude](Magnitude.md) object containing the machine learning magnitude estimation
|
|
483
|
+
* depth - A decimal number containing a depth estimation in kilometers
|
|
484
|
+
* depthProbability - A decimal number containing the probability of the depth estimation
|
|
485
|
+
* eventType - An object containing the event type, see [EventType](EventType.md).
|
|
486
|
+
* eventTypeProbability - A decimal number containing the probability of the event type estimation
|
|
487
|
+
* repickShift - A decimal number containing the repick shift in seconds (to regenerate the initial Pick.Time, subtract this value from the current Pick.Time)
|
|
488
|
+
* repickSTD - A decimal number containing the repick shift standard deviation
|
|
489
|
+
* repickCredibleIntervalLower - A decimal number containing the repick shift credible interval lower
|
|
490
|
+
* repickCredibleIntervalUpper - A decimal number containing the repick shift credible interval upper
|
|
491
|
+
* source - An object containing the source of the MachineLearning, see [Source](Source.md).
|
|
492
|
+
|
|
493
|
+
# Magnitude Object Specification
|
|
494
|
+
|
|
495
|
+
## Description
|
|
496
|
+
|
|
497
|
+
The Magnitude object is an object designed to hold data quality for a [Detection](Detection.md) message.
|
|
498
|
+
Site uses the [JSON standard](http://www.json.org).
|
|
499
|
+
|
|
500
|
+
## Usage
|
|
501
|
+
|
|
502
|
+
Magnitude is intended for use as part of the [Detection](Detection.md) Format in seismic data
|
|
503
|
+
messaging between seismic applications and organizations.
|
|
504
|
+
|
|
505
|
+
## Output
|
|
506
|
+
|
|
507
|
+
```json
|
|
508
|
+
{
|
|
509
|
+
"type" : String,
|
|
510
|
+
"id" : String,
|
|
511
|
+
"value" : Number,
|
|
512
|
+
"source" :
|
|
513
|
+
{
|
|
514
|
+
"agencyID" : String,
|
|
515
|
+
"author" : String
|
|
516
|
+
},
|
|
517
|
+
"error" : Number,
|
|
518
|
+
"probability" : Number
|
|
519
|
+
}
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
## Glossary
|
|
523
|
+
|
|
524
|
+
**Required Values:**
|
|
525
|
+
|
|
526
|
+
These are the values **required** to define a Magnitude
|
|
527
|
+
|
|
528
|
+
* type - A string containing the name of the magnitude type.
|
|
529
|
+
* value - A decimal number containing numarical value of the magnitude.
|
|
530
|
+
|
|
531
|
+
**Optional Values:**
|
|
532
|
+
|
|
533
|
+
The following are supplementary values that **may or may not** be provided as part of a Magnitude.
|
|
534
|
+
|
|
535
|
+
* id - A string containing an unique identifier for this Magnitude.
|
|
536
|
+
* source - An object containing the source of the Magnitude, see [Source](Source.md).
|
|
537
|
+
* error - A decimal number containing numarical error estimate of the magnitude.
|
|
538
|
+
* probability - A decimal number containing the probability of the magnitude
|
|
539
|
+
|
|
540
|
+
# Pick Format Specification
|
|
541
|
+
|
|
542
|
+
## Description
|
|
543
|
+
|
|
544
|
+
Pick is a format designed to encode the basic information of an unassociated
|
|
545
|
+
waveform arrival time pick. Pick uses the
|
|
546
|
+
[JSON standard](http://www.json.org).
|
|
547
|
+
|
|
548
|
+
## Usage
|
|
549
|
+
Pick is intended for use in seismic data messaging between seismic
|
|
550
|
+
applications and organizations.
|
|
551
|
+
|
|
552
|
+
## Output
|
|
553
|
+
|
|
554
|
+
```json
|
|
555
|
+
{
|
|
556
|
+
"type" : "Pick",
|
|
557
|
+
"id" : String,
|
|
558
|
+
"channel" :
|
|
559
|
+
{
|
|
560
|
+
"type": "Feature",
|
|
561
|
+
"geometry": {
|
|
562
|
+
"type": "Point",
|
|
563
|
+
"coordinates": [125.6, 10.1, 1589.0]
|
|
564
|
+
},
|
|
565
|
+
"properties": {
|
|
566
|
+
"station" : String,
|
|
567
|
+
"channel" : String,
|
|
568
|
+
"network" : String,
|
|
569
|
+
"location" : String
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
"time" : ISO8601,
|
|
573
|
+
"source" :
|
|
574
|
+
{
|
|
575
|
+
"agencyID" : String,
|
|
576
|
+
"author" : String
|
|
577
|
+
},
|
|
578
|
+
"phase" : String,
|
|
579
|
+
"polarity" : ("up" | "down"),
|
|
580
|
+
"onset" : ("impulsive" | "emergent" | "questionable"),
|
|
581
|
+
"pickerType" : ("manual" | "raypicker" | "filterpicker" | "earthworm" | "other"),
|
|
582
|
+
"filterInfo" : [ {
|
|
583
|
+
"type" : String,
|
|
584
|
+
"highPass" : Number,
|
|
585
|
+
"lowPass" : Number,
|
|
586
|
+
"units" : String
|
|
587
|
+
}, ...],
|
|
588
|
+
"amplitudeInfo" :
|
|
589
|
+
{
|
|
590
|
+
"value" : Number,
|
|
591
|
+
"period" : Number,
|
|
592
|
+
"snr" : Number
|
|
593
|
+
},
|
|
594
|
+
"associationInfo" :
|
|
595
|
+
{
|
|
596
|
+
"phase" : String,
|
|
597
|
+
"distance" : Number,
|
|
598
|
+
"azimuth" : Number,
|
|
599
|
+
"residual" : Number,
|
|
600
|
+
"sigma" : Number
|
|
601
|
+
},
|
|
602
|
+
"qualityInfo" : [ {
|
|
603
|
+
"standard": String,
|
|
604
|
+
"value": Number
|
|
605
|
+
}, ...],
|
|
606
|
+
"machineLearningInfo" :
|
|
607
|
+
{
|
|
608
|
+
"phase" : String,
|
|
609
|
+
"phaseProbability" : Number,
|
|
610
|
+
"distance" : Number,
|
|
611
|
+
"distanceProbability" : Number,
|
|
612
|
+
"distanceRangeHalfWidth" : Number,
|
|
613
|
+
"distanceRangeSigma" : Number,
|
|
614
|
+
"backAzimuth" : Number,
|
|
615
|
+
"backAzimuthProbability" : Number,
|
|
616
|
+
"magnitude" :
|
|
617
|
+
{
|
|
618
|
+
"type" : String,
|
|
619
|
+
"id" : String,
|
|
620
|
+
"value" : Number,
|
|
621
|
+
"source" :
|
|
622
|
+
{
|
|
623
|
+
"agencyID" : String,
|
|
624
|
+
"author" : String
|
|
625
|
+
},
|
|
626
|
+
"error" : Number,
|
|
627
|
+
"probability" : Number
|
|
628
|
+
},
|
|
629
|
+
"depth" : Number,
|
|
630
|
+
"depthProbability" : Number,
|
|
631
|
+
"eventType" : {
|
|
632
|
+
"type" : String,
|
|
633
|
+
"certainty" : String
|
|
634
|
+
},
|
|
635
|
+
"eventTypeProbability" : Number,
|
|
636
|
+
"repickShift" : Number,
|
|
637
|
+
"repickSTD" : Number,
|
|
638
|
+
"repickCredibleIntervalLower" : Number,
|
|
639
|
+
"repickCredibleIntervalUpper" : Number,
|
|
640
|
+
"source" : {
|
|
641
|
+
"agencyID" : String,
|
|
642
|
+
"author" : String
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
## Glossary
|
|
649
|
+
|
|
650
|
+
**Required Values:**
|
|
651
|
+
|
|
652
|
+
These are the values **required** to define a pick.
|
|
653
|
+
|
|
654
|
+
* type - A string that identifies this message as a pick.
|
|
655
|
+
* id - A string containing an unique identifier for this pick.
|
|
656
|
+
* channel - A GeoJSON object containing the channel the pick was made at, see [Channel](Channel.md).
|
|
657
|
+
* source - An object containing the source of the pick, see [Source](Source.md).
|
|
658
|
+
* time - A string containing the UTC arrival time of the phase that was picked, in the ISO8601 format `YYYY-MM-DDTHH:MM:SS.SSSZ`.
|
|
659
|
+
|
|
660
|
+
**Optional Values:**
|
|
661
|
+
|
|
662
|
+
The following are supplementary values that **may or may not** be provided by
|
|
663
|
+
various picking algorithms.
|
|
664
|
+
|
|
665
|
+
* phase - A string that identifies the seismic phase that was picked.
|
|
666
|
+
* polarity - A string containing the phase polarity; "up" or "down".
|
|
667
|
+
* onset - A string containing the phase onset; "impulsive", "emergent", or "questionable" .
|
|
668
|
+
* pickerType - A string describing the type of picker; "manual", "raypicker", "filterpicker", "earthworm", or "other".
|
|
669
|
+
* filter - An array of objects containing the filter frequencies when the pick was made, see [Filter](Filter.md).
|
|
670
|
+
* amplitude - An object containing the amplitude associated with the pick, see [Amplitude](Amplitude.md).
|
|
671
|
+
* associationInfo - An object containing the association information if this pick is used as data in a Detection, see [Associated](Associated.md).
|
|
672
|
+
* machineLearningInfo - An object containing the machine learning information of this pick, see [MachineLearning](MachineLearning.md).
|
|
673
|
+
* qualityInfo - An array of objects containing the containing the quality metric information for this pick, see [Quality](Quality.md).
|
|
674
|
+
|
|
675
|
+
# Quality Object Specification
|
|
676
|
+
|
|
677
|
+
## Description
|
|
678
|
+
|
|
679
|
+
The Quality object is an object designed to hold data quality for a [Pick](Pick.md) message.
|
|
680
|
+
Site uses the [JSON standard](http://www.json.org).
|
|
681
|
+
|
|
682
|
+
## Usage
|
|
683
|
+
|
|
684
|
+
Quality is intended for use as part of the [Pick](Pick.md) Format in seismic data
|
|
685
|
+
messaging between seismic applications and organizations.
|
|
686
|
+
|
|
687
|
+
## Output
|
|
688
|
+
|
|
689
|
+
```json
|
|
690
|
+
{
|
|
691
|
+
"standard": String,
|
|
692
|
+
"value": Number
|
|
693
|
+
}
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
## Glossary
|
|
697
|
+
|
|
698
|
+
**Required Values:**
|
|
699
|
+
|
|
700
|
+
These are the values **required** to define a Quality
|
|
701
|
+
|
|
702
|
+
* standard - A string containing the name of the quality standard.
|
|
703
|
+
* value - A string containing numarical value of the quality standard.
|
|
704
|
+
|
|
705
|
+
# Source Object Specification
|
|
706
|
+
|
|
707
|
+
## Description
|
|
708
|
+
|
|
709
|
+
The Source object is an object designed to define the originating seismic
|
|
710
|
+
organization that produced a [Pick](Pick.md) message.
|
|
711
|
+
Site uses the [JSON standard](http://www.json.org).
|
|
712
|
+
|
|
713
|
+
## Usage
|
|
714
|
+
|
|
715
|
+
Source is intended for use as part of the [Pick](Pick.md) Format in seismic data
|
|
716
|
+
messaging between seismic applications and organizations.
|
|
717
|
+
|
|
718
|
+
## Output
|
|
719
|
+
|
|
720
|
+
```json
|
|
721
|
+
{
|
|
722
|
+
"agencyID" : String,
|
|
723
|
+
"author" : String
|
|
724
|
+
}
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
## Glossary
|
|
728
|
+
|
|
729
|
+
**Required Values:**
|
|
730
|
+
|
|
731
|
+
These are the values **required** to define a Source
|
|
732
|
+
|
|
733
|
+
* agencyID - A string containing the originating agency FDSN ID.
|
|
734
|
+
* author - A string containing the source author.
|
|
735
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
anssformats/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
anssformats/amplitude.py,sha256=DCtkc6siT8dj0C3ynBM01rfaSpKOeHTc-51CDmspELg,647
|
|
3
|
+
anssformats/association.py,sha256=UjDmr213kSzCCIWHMDce06Xjzut3-l1IYKexxJR_C_I,1173
|
|
4
|
+
anssformats/channel.py,sha256=z4sQGpJwSySSuzKCca_UovS6_DbPaP_j4BAZpX-Cqwc,1169
|
|
5
|
+
anssformats/detection.py,sha256=dR76eFRmBp5fKyZoOm70bWcrYhc7Eo1f0mtWQI0u8lw,2015
|
|
6
|
+
anssformats/eventType.py,sha256=6DHjovVVGug5AU1WRKX3RxQbrnwSPlg2KNtH2sLX1Q0,1216
|
|
7
|
+
anssformats/filter.py,sha256=uOAUteSWeBvDcB12_9E_9sqe0wb6iR_lHZdjLv5agNM,675
|
|
8
|
+
anssformats/formatbasemodel.py,sha256=mUKwY0jiHrcr8jdZLCQhzSx3qBg16FEUytRgB5wiuIY,2044
|
|
9
|
+
anssformats/geojson.py,sha256=xjm_9ZxX9P8lzQKDBDO6L-ai1y7PQofVMJ5FwEIAVjU,1244
|
|
10
|
+
anssformats/hypocenter.py,sha256=QkXfQkRzjHbefF4G3TaOTwD5PYcvFkX5dvxjeVS3yfs,1552
|
|
11
|
+
anssformats/machineLearning.py,sha256=YJbnzv4JbJwr_UaE3TAaidKpGHfaM5dOmlAOqbnv32w,3008
|
|
12
|
+
anssformats/magnitude.py,sha256=ncMmwMoj_Lv0kSzjjtQVZ5_41mSkCYFxgExxiaeSqao,993
|
|
13
|
+
anssformats/pick.py,sha256=ME3vnE06jsrQHST9gXwXzn0z_bUX7V5G7QbYzk0c1I8,2682
|
|
14
|
+
anssformats/quality.py,sha256=PK5sPAoJTUgCrmQkiWTerEB2klWbR1ECAU-qIABpcjA,389
|
|
15
|
+
anssformats/source.py,sha256=G78YUwY2fimi8Uy0d1mKjaIIsEDUue50wdHpACQsSMU,398
|
|
16
|
+
anss_formats-0.1.0.dist-info/METADATA,sha256=Dx1lfOeuCkIaYUfdOp2NfhTVSRpuMf5mXO1VgAtTajs,24969
|
|
17
|
+
anss_formats-0.1.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
18
|
+
anss_formats-0.1.0.dist-info/RECORD,,
|
anssformats/channel.py
CHANGED
|
@@ -2,47 +2,11 @@ from typing import Optional, List, Literal
|
|
|
2
2
|
|
|
3
3
|
from pydantic import Field, field_validator, ValidationInfo
|
|
4
4
|
from anssformats.formatbasemodel import FormatBaseModel
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class ChannelGeometry(FormatBaseModel):
|
|
8
|
-
"""A class holding the geojson geometry for the channel
|
|
9
|
-
|
|
10
|
-
type: string containing the type of this geometry
|
|
11
|
-
|
|
12
|
-
coordinates: List of floats containing the longitude in degrees, latitude in degrees, and elevation in meters, in that order
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
type: str = "Point"
|
|
16
|
-
coordinates: List[float]
|
|
17
|
-
|
|
18
|
-
# check that coordinates are valid
|
|
19
|
-
@field_validator("coordinates")
|
|
20
|
-
@classmethod
|
|
21
|
-
def validate_coordinates(
|
|
22
|
-
cls, value: List[float], info: ValidationInfo
|
|
23
|
-
) -> List[float]:
|
|
24
|
-
if value is None:
|
|
25
|
-
raise ValueError("Missing coordinates")
|
|
26
|
-
|
|
27
|
-
if len(value) != 3:
|
|
28
|
-
raise ValueError("Incomplete coordinates")
|
|
29
|
-
|
|
30
|
-
# longitude
|
|
31
|
-
if value[0] < -180.0 or value[0] > 180.0:
|
|
32
|
-
raise ValueError("Longitude coordinate out of valid range")
|
|
33
|
-
|
|
34
|
-
# latitude
|
|
35
|
-
if value[1] < -90.0 or value[1] > 90.0:
|
|
36
|
-
raise ValueError("Latitude coordinate out of valid range")
|
|
37
|
-
|
|
38
|
-
# don't bother validating elevation
|
|
39
|
-
# value[2]
|
|
40
|
-
|
|
41
|
-
return value
|
|
5
|
+
from anssformats.geojson import PointGeometry
|
|
42
6
|
|
|
43
7
|
|
|
44
8
|
class ChannelProperties(FormatBaseModel):
|
|
45
|
-
"""A class holding the
|
|
9
|
+
"""A class holding the channel specific custom properties for a geojson point feature
|
|
46
10
|
|
|
47
11
|
Station: string containing the station code
|
|
48
12
|
|
|
@@ -65,12 +29,12 @@ class Channel(FormatBaseModel):
|
|
|
65
29
|
|
|
66
30
|
type: string containing the type of this geojson
|
|
67
31
|
|
|
68
|
-
geometry:
|
|
32
|
+
geometry: PointGeometry object containing the geojson geometry for this feature
|
|
69
33
|
|
|
70
34
|
properties: ChannelProperties object containing the channel properties
|
|
71
35
|
"""
|
|
72
36
|
|
|
73
37
|
type: str = "Feature"
|
|
74
38
|
|
|
75
|
-
geometry:
|
|
39
|
+
geometry: PointGeometry
|
|
76
40
|
properties: ChannelProperties
|
anssformats/detection.py
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from typing import List, Literal, Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from anssformats.formatbasemodel import CustomDT, FormatBaseModel
|
|
7
|
+
from anssformats.eventType import EventType
|
|
8
|
+
from anssformats.hypocenter import Hypocenter, HypocenterProperties
|
|
9
|
+
from anssformats.source import Source
|
|
10
|
+
from anssformats.pick import Pick
|
|
11
|
+
from anssformats.magnitude import Magnitude
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Detection(FormatBaseModel):
|
|
15
|
+
"""A conversion class used to create, parse, and validate detection data.
|
|
16
|
+
|
|
17
|
+
type: string identifying this message as a detection
|
|
18
|
+
|
|
19
|
+
id: string containing a unique identifier for this detection
|
|
20
|
+
|
|
21
|
+
source: Source object containing the source of the detection
|
|
22
|
+
|
|
23
|
+
hypocenter: Hypocenter object containing the hypocenter of the detection
|
|
24
|
+
|
|
25
|
+
detectionType: optional string containing the origin type of this detection; valid
|
|
26
|
+
values are "New", "Update", "Final", and "Retract"
|
|
27
|
+
|
|
28
|
+
detectionTime: optional datetime containing the time this detection was made
|
|
29
|
+
|
|
30
|
+
eventType: optional EventType object containing the event type of the detection
|
|
31
|
+
|
|
32
|
+
minimumDistance: optional float containing the distance to the closest station
|
|
33
|
+
|
|
34
|
+
rms: optional float containing the detection RMS
|
|
35
|
+
|
|
36
|
+
maximumGap: optional float containing the detection gap
|
|
37
|
+
|
|
38
|
+
detector: optional string containing the detection grid, algorithm, or other
|
|
39
|
+
information
|
|
40
|
+
|
|
41
|
+
pickData: optional list of either Pick objects used to generate
|
|
42
|
+
this detection
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
type: Literal["Detection"]
|
|
48
|
+
id: str
|
|
49
|
+
source: Source
|
|
50
|
+
|
|
51
|
+
hypocenter: Hypocenter
|
|
52
|
+
|
|
53
|
+
detectionType: Optional[Literal["New", "Update", "Final", "Retract"]] = None
|
|
54
|
+
detectionTime: Optional[CustomDT] = None
|
|
55
|
+
|
|
56
|
+
eventType: Optional[EventType] = None
|
|
57
|
+
|
|
58
|
+
minimumDistance: Optional[float] = Field(None, ge=0.0)
|
|
59
|
+
rms: Optional[float] = None
|
|
60
|
+
maximumGap: Optional[float] = Field(None, ge=0.0, le=360.0)
|
|
61
|
+
|
|
62
|
+
detector: Optional[str] = None
|
|
63
|
+
|
|
64
|
+
pickData: Optional[List[Pick]] = None
|
|
65
|
+
|
|
66
|
+
magnitudeData: Optional[List[Magnitude]] = None
|
anssformats/formatbasemodel.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
2
|
from typing import Any
|
|
3
3
|
|
|
4
|
-
from pydantic import BaseModel, GetCoreSchemaHandler
|
|
4
|
+
from pydantic import BaseModel, GetCoreSchemaHandler, field_validator
|
|
5
5
|
from pydantic_core import CoreSchema, core_schema
|
|
6
6
|
|
|
7
7
|
|
|
@@ -22,10 +22,6 @@ def convert_datetime_to_iso8601_with_z_suffix(dt: datetime) -> str:
|
|
|
22
22
|
class FormatBaseModel(BaseModel):
|
|
23
23
|
"""A Pydantic BaseModel used for any required formatting of keys and values"""
|
|
24
24
|
|
|
25
|
-
class Config:
|
|
26
|
-
# conversion for datetime to datetime string
|
|
27
|
-
json_encoders = {datetime: convert_datetime_to_iso8601_with_z_suffix}
|
|
28
|
-
|
|
29
25
|
def model_dump(self):
|
|
30
26
|
"""Override the default model_dump method to always exclude None values"""
|
|
31
27
|
return super().model_dump(exclude_none=True)
|
|
@@ -41,17 +37,22 @@ class CustomDT(datetime):
|
|
|
41
37
|
strings.
|
|
42
38
|
"""
|
|
43
39
|
|
|
40
|
+
@field_validator("*", mode="before")
|
|
44
41
|
@classmethod
|
|
45
42
|
def validate_no_tz(cls, v: Any, info: core_schema.ValidationInfo) -> Any:
|
|
46
43
|
if isinstance(v, str):
|
|
47
44
|
return datetime.strptime(v, "%Y-%m-%dT%H:%M:%S.%fZ").replace(tzinfo=None)
|
|
48
|
-
|
|
49
|
-
return v.replace(tzinfo=None)
|
|
45
|
+
return v.replace(tzinfo=None)
|
|
50
46
|
|
|
51
47
|
@classmethod
|
|
52
48
|
def __get_pydantic_core_schema__(
|
|
53
49
|
cls, source_type: Any, handler: GetCoreSchemaHandler
|
|
54
50
|
) -> CoreSchema:
|
|
55
|
-
return core_schema.
|
|
56
|
-
|
|
51
|
+
return core_schema.with_info_before_validator_function(
|
|
52
|
+
cls.validate_no_tz,
|
|
53
|
+
handler(datetime),
|
|
54
|
+
serialization=core_schema.plain_serializer_function_ser_schema(
|
|
55
|
+
convert_datetime_to_iso8601_with_z_suffix,
|
|
56
|
+
when_used="json-unless-none",
|
|
57
|
+
),
|
|
57
58
|
)
|
anssformats/geojson.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from typing import Optional, List, Literal
|
|
2
|
+
|
|
3
|
+
from pydantic import Field, field_validator, ValidationInfo
|
|
4
|
+
from anssformats.formatbasemodel import FormatBaseModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class PointGeometry(FormatBaseModel):
|
|
8
|
+
"""A class holding a geojson point geometry
|
|
9
|
+
|
|
10
|
+
type: string containing the type of this geometry
|
|
11
|
+
|
|
12
|
+
coordinates: List of floats containing the longitude in degrees, latitude in degrees, and elevation in meters or depth in kilometers, in that order
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
type: str = "Point"
|
|
16
|
+
coordinates: List[float]
|
|
17
|
+
|
|
18
|
+
# check that coordinates are valid
|
|
19
|
+
@field_validator("coordinates")
|
|
20
|
+
@classmethod
|
|
21
|
+
def validate_coordinates(
|
|
22
|
+
cls, value: List[float], info: ValidationInfo
|
|
23
|
+
) -> List[float]:
|
|
24
|
+
if value is None:
|
|
25
|
+
raise ValueError("Missing coordinates")
|
|
26
|
+
|
|
27
|
+
if len(value) != 3:
|
|
28
|
+
raise ValueError("Incomplete coordinates")
|
|
29
|
+
|
|
30
|
+
# longitude
|
|
31
|
+
if value[0] < -180.0 or value[0] > 180.0:
|
|
32
|
+
raise ValueError("Longitude coordinate out of valid range")
|
|
33
|
+
|
|
34
|
+
# latitude
|
|
35
|
+
if value[1] < -90.0 or value[1] > 90.0:
|
|
36
|
+
raise ValueError("Latitude coordinate out of valid range")
|
|
37
|
+
|
|
38
|
+
# don't validate elevation/depth
|
|
39
|
+
# value[2]
|
|
40
|
+
|
|
41
|
+
return value
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from typing import Optional, List, Literal
|
|
2
|
+
|
|
3
|
+
from pydantic import Field, field_validator, ValidationInfo
|
|
4
|
+
from anssformats.formatbasemodel import CustomDT, FormatBaseModel
|
|
5
|
+
from anssformats.geojson import PointGeometry
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class HypocenterProperties(FormatBaseModel):
|
|
9
|
+
"""A class holding the hypocenter specific custom properties for a geojson point feature
|
|
10
|
+
|
|
11
|
+
originTime: required datetime containing the origin time of the hypocenter
|
|
12
|
+
|
|
13
|
+
latitudeError: optional float containing the error of the latitude of this
|
|
14
|
+
hypocenter in kilometers
|
|
15
|
+
|
|
16
|
+
longitudeError: optional float containing the error of the longitude of this
|
|
17
|
+
hypocenter in kilometers
|
|
18
|
+
|
|
19
|
+
depthError: optional float containing the error of the depth of this hypocenter in
|
|
20
|
+
kilometers
|
|
21
|
+
|
|
22
|
+
timeError: optional float containing the error of the origin time of this hypocenter
|
|
23
|
+
in seconds
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
originTime: CustomDT
|
|
27
|
+
latitudeError: Optional[float] = None
|
|
28
|
+
longitudeError: Optional[float] = None
|
|
29
|
+
depthError: Optional[float] = None
|
|
30
|
+
timeError: Optional[float] = None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Hypocenter(FormatBaseModel):
|
|
34
|
+
"""A conversion class used to create, parse, and validate geojson Hypocenter data as part of
|
|
35
|
+
detection data.
|
|
36
|
+
|
|
37
|
+
type: string containing the type of this geojson
|
|
38
|
+
|
|
39
|
+
geometry: PointGeometry object containing the geojson geometry for this feature
|
|
40
|
+
|
|
41
|
+
properties: HypocenterProperties object containing the hypocenter properties
|
|
42
|
+
"""
|
|
43
|
+
|
|
44
|
+
type: str = "Feature"
|
|
45
|
+
|
|
46
|
+
geometry: PointGeometry
|
|
47
|
+
properties: HypocenterProperties
|
anssformats/machineLearning.py
CHANGED
|
@@ -5,6 +5,7 @@ from pydantic import Field
|
|
|
5
5
|
from anssformats.eventType import EventType as EventTypeFormat
|
|
6
6
|
from anssformats.formatbasemodel import FormatBaseModel
|
|
7
7
|
from anssformats.source import Source as SourceFormat
|
|
8
|
+
from anssformats.magnitude import Magnitude
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class MachineLearning(FormatBaseModel):
|
|
@@ -30,12 +31,7 @@ class MachineLearning(FormatBaseModel):
|
|
|
30
31
|
backAzimuthProbability: optional float containing the probability of the
|
|
31
32
|
MachineLearning back azimuth
|
|
32
33
|
|
|
33
|
-
magnitude: optional
|
|
34
|
-
|
|
35
|
-
magnitudeType: optional string containing the MachineLearning magnitude type
|
|
36
|
-
|
|
37
|
-
magnitudeProbability: optional float containing the probability of the
|
|
38
|
-
MachineLearning magnitude
|
|
34
|
+
magnitude: optional Magnitude object containing the MachineLearning magnitude
|
|
39
35
|
|
|
40
36
|
depth: optional float containing the MachineLearning depth in kilometers
|
|
41
37
|
|
|
@@ -68,9 +64,7 @@ class MachineLearning(FormatBaseModel):
|
|
|
68
64
|
backAzimuth: Optional[float] = Field(None, ge=0.0)
|
|
69
65
|
backAzimuthProbability: Optional[float] = None
|
|
70
66
|
|
|
71
|
-
magnitude: Optional[
|
|
72
|
-
magnitudeType: Optional[str] = None
|
|
73
|
-
magnitudeProbability: Optional[float] = None
|
|
67
|
+
magnitude: Optional[Magnitude] = None
|
|
74
68
|
|
|
75
69
|
depth: Optional[float] = Field(None, ge=-100.0, le=1500.0)
|
|
76
70
|
depthProbability: Optional[float] = None
|
anssformats/magnitude.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from anssformats.formatbasemodel import FormatBaseModel
|
|
6
|
+
from anssformats.source import Source
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Magnitude(FormatBaseModel):
|
|
10
|
+
"""A conversion class used to create, parse, and validate Magnitude data as part
|
|
11
|
+
of detection data.
|
|
12
|
+
|
|
13
|
+
Attributes
|
|
14
|
+
----------
|
|
15
|
+
|
|
16
|
+
value: float containing the magnitude value
|
|
17
|
+
|
|
18
|
+
type: string containing the magnitude type
|
|
19
|
+
|
|
20
|
+
error: optional float containing the associated magnitude error (if any)
|
|
21
|
+
|
|
22
|
+
probability: optional float containing the associated magnitude probability (if any)
|
|
23
|
+
|
|
24
|
+
id: optional string containing a unique identifier for this magnitude
|
|
25
|
+
|
|
26
|
+
source: optional Source object containing the source of the magnitude
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
value: float = Field(None, ge=-2.0, le=10.0)
|
|
30
|
+
type: str
|
|
31
|
+
|
|
32
|
+
error: Optional[float] = Field(None, ge=0.0)
|
|
33
|
+
probability: Optional[float] = Field(None, ge=0.0, le=100.0)
|
|
34
|
+
id: Optional[str] = None
|
|
35
|
+
source: Optional[Source] = None
|
anssformats/pick.py
CHANGED
|
@@ -4,7 +4,6 @@ from pydantic import Field
|
|
|
4
4
|
|
|
5
5
|
from anssformats.amplitude import Amplitude
|
|
6
6
|
from anssformats.association import Association
|
|
7
|
-
from anssformats.beam import Beam
|
|
8
7
|
from anssformats.machineLearning import MachineLearning
|
|
9
8
|
from anssformats.filter import Filter
|
|
10
9
|
from anssformats.formatbasemodel import CustomDT, FormatBaseModel
|
|
@@ -43,9 +42,6 @@ class Pick(FormatBaseModel):
|
|
|
43
42
|
amplitude: optional Amplitude object containing the amplitude associated with the
|
|
44
43
|
pick
|
|
45
44
|
|
|
46
|
-
beamInfo: optional Beam object containing the waveform beam information associated with
|
|
47
|
-
the pick
|
|
48
|
-
|
|
49
45
|
associationInfo: optional Association object containing the association information
|
|
50
46
|
if this pick is used as data in a Detection
|
|
51
47
|
|
|
@@ -72,7 +68,6 @@ class Pick(FormatBaseModel):
|
|
|
72
68
|
|
|
73
69
|
filterInfo: Optional[List[Filter]] = None
|
|
74
70
|
amplitudeInfo: Optional[Amplitude] = None
|
|
75
|
-
beamInfo: Optional[Beam] = None
|
|
76
71
|
|
|
77
72
|
associationInfo: Optional[Association] = None
|
|
78
73
|
machineLearningInfo: Optional[MachineLearning] = None
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: anss-formats
|
|
3
|
-
Version: 0.0.3
|
|
4
|
-
Summary: Python implementation of the library used to communicate seismic event detection information between systems
|
|
5
|
-
License: CC0-1.0
|
|
6
|
-
Keywords: anss,earthquakes,formats,detection
|
|
7
|
-
Author: John Patton
|
|
8
|
-
Author-email: jpatton@usgs.gov
|
|
9
|
-
Requires-Python: >3.9.1,<3.12
|
|
10
|
-
Classifier: License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
-
Provides-Extra: pycurl
|
|
15
|
-
Requires-Dist: certifi (>=2024.07.04,<2025.0.0)
|
|
16
|
-
Requires-Dist: cryptography (>=44.0.1,<45.0.0)
|
|
17
|
-
Requires-Dist: docutils (!=0.21.post1)
|
|
18
|
-
Requires-Dist: dparse (>=0.6.2,<0.7.0)
|
|
19
|
-
Requires-Dist: pydantic (>=2.6.0,<3.0.0)
|
|
20
|
-
Requires-Dist: requests (>=2.32.2,<3.0.0)
|
|
21
|
-
Requires-Dist: twine (>=5.1.1,<6.0.0)
|
|
22
|
-
Project-URL: Homepage, https://gitlab.com/anss-netops/anss-data-formats
|
|
23
|
-
Project-URL: Repository, https://gitlab.com/anss-netops/anss-data-formats
|
|
24
|
-
Description-Content-Type: text/markdown
|
|
25
|
-
|
|
26
|
-
# ANSS Data Formats
|
|
27
|
-
The US Geological Survey (USGS) Advanced National Seismic System (ANSS) defines a number of data exchange formats to communicate seismic event detection information between processing systems. These formats are defined using objects as defined in the [JSON standard](http://www.json.org).
|
|
28
|
-
|
|
29
|
-
The purpose of this project is to:
|
|
30
|
-
|
|
31
|
-
1. Define formats to hold data representing the estimates of various types of
|
|
32
|
-
seismic event detections.
|
|
33
|
-
2. Store the format definitions in a source controlled manner.
|
|
34
|
-
3. Host libraries used to generate, parse, and validate the formats
|
|
35
|
-
|
|
36
|
-
## Defined formats:
|
|
37
|
-
|
|
38
|
-
* [Pick](format-docs/Pick.md) Format - A format for unassociated picks from a waveform arrival time picking algorithm.
|
|
39
|
-
|
|
40
|
-
## Supporting format objects:
|
|
41
|
-
|
|
42
|
-
* [Amplitude](format-docs/Amplitude.md) Object - An object that contains information about an amplitude as part of a pick.
|
|
43
|
-
* [Beam](format-docs/Beam.md) Object - An object that contains information about a waveform beam as part of a pick.
|
|
44
|
-
* [Associated](format-docs/Associated.md) Object - An object that contains associated information if a pick is included in a detection.
|
|
45
|
-
* [Filter](format-docs/Filter.md) Object - An object that contains filter information as part of a pick.
|
|
46
|
-
* [Site](format-docs/Site.md) Object - An object that defines the station used to create a pick.
|
|
47
|
-
* [Source](format-docs/Source.md) Object - An object that defines the creator/source of a pick.
|
|
48
|
-
* [Quality](format-docs/Quality.md) Object - An object that defines the data quality of a pick.
|
|
49
|
-
* [MachineLearning](format-docs/MachineLearning.md) Object - An object that defines the machine learning information for a pick.
|
|
50
|
-
* [EventType](format-docs/EventType.md) Object - An object that defines the event type for MachineLearning info.
|
|
51
|
-
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
anssformats/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
anssformats/amplitude.py,sha256=DCtkc6siT8dj0C3ynBM01rfaSpKOeHTc-51CDmspELg,647
|
|
3
|
-
anssformats/association.py,sha256=UjDmr213kSzCCIWHMDce06Xjzut3-l1IYKexxJR_C_I,1173
|
|
4
|
-
anssformats/beam.py,sha256=lKmdXi_9Y9kglXPrsDG8WT2_41ssX92PrLxxjws7wT4,1004
|
|
5
|
-
anssformats/channel.py,sha256=AQ6wrBCtMhXwN3gdxWQKkiutqnVB9H2FmbMrOY6CTC8,2240
|
|
6
|
-
anssformats/eventType.py,sha256=6DHjovVVGug5AU1WRKX3RxQbrnwSPlg2KNtH2sLX1Q0,1216
|
|
7
|
-
anssformats/filter.py,sha256=uOAUteSWeBvDcB12_9E_9sqe0wb6iR_lHZdjLv5agNM,675
|
|
8
|
-
anssformats/formatbasemodel.py,sha256=naZFyuL6YOIMdpYpxD91l7MbbG6eafz3-itzLilSoG8,1933
|
|
9
|
-
anssformats/machineLearning.py,sha256=6xwmv_F2VuxZl-ng7qUKlV7Mrlw6aQ-LKg6A6x3vdfo,3261
|
|
10
|
-
anssformats/pick.py,sha256=Spaw7Paw_UCkVxNSJxJSirmiXM3e2KEY8-nIwVgk2Vg,2867
|
|
11
|
-
anssformats/quality.py,sha256=PK5sPAoJTUgCrmQkiWTerEB2klWbR1ECAU-qIABpcjA,389
|
|
12
|
-
anssformats/source.py,sha256=G78YUwY2fimi8Uy0d1mKjaIIsEDUue50wdHpACQsSMU,398
|
|
13
|
-
anss_formats-0.0.3.dist-info/METADATA,sha256=T5YvzS6RgpGi3agxOheaDV8rbuzlJhOmPnoVn54jexM,2814
|
|
14
|
-
anss_formats-0.0.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
15
|
-
anss_formats-0.0.3.dist-info/RECORD,,
|
anssformats/beam.py
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
|
|
3
|
-
from pydantic import Field
|
|
4
|
-
|
|
5
|
-
from anssformats.formatbasemodel import FormatBaseModel
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Beam(FormatBaseModel):
|
|
9
|
-
"""A conversion class used to create, parse, and validate beam detection data.
|
|
10
|
-
|
|
11
|
-
Attributes
|
|
12
|
-
----------
|
|
13
|
-
|
|
14
|
-
backAzimuth: float containing the back azimuth in degrees
|
|
15
|
-
|
|
16
|
-
backAzimuthError: optional float containing the back azimuth error
|
|
17
|
-
|
|
18
|
-
slowness: float containing the horizontal slowness
|
|
19
|
-
|
|
20
|
-
slownessError: optional float containing the horizontal slowness error
|
|
21
|
-
|
|
22
|
-
powerRatio: optional float containing the power ratio
|
|
23
|
-
|
|
24
|
-
powerRatioError: optional float containing the power ratio error
|
|
25
|
-
"""
|
|
26
|
-
|
|
27
|
-
backAzimuth: float = Field(ge=0.0)
|
|
28
|
-
backAzimuthError: Optional[float] = Field(None, ge=0.0)
|
|
29
|
-
|
|
30
|
-
slowness: float = Field(ge=0.0)
|
|
31
|
-
slownessError: Optional[float] = Field(None, ge=0.0)
|
|
32
|
-
|
|
33
|
-
powerRatio: Optional[float] = Field(None, ge=0.0)
|
|
34
|
-
powerRatioError: Optional[float] = Field(None, ge=0.0)
|
|
File without changes
|