# Input data format

**URL:** <https://discourse.obspy.org/t/input-data-format/1970>\
**Category:** Related: Qopen\
**Created:** [July 3, 2024, 4:16pm UTC](https://discourse.obspy.org/t/input-data-format/1970 "2024-07-03T16:16:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thanks](https://discourse.obspy.org/user_avatar/discourse.obspy.org/thanks/32/842_2.png) [@Thanks](https://discourse.obspy.org/u/Thanks)\
**Post date:** [July 3, 2024, 4:16pm UTC](https://discourse.obspy.org/t/input-data-format/1970/1 "2024-07-03T16:16:12Z")

</div>

Dear Dr. Eulenfeld,

I aim to discover the seismic attenuation property at the caldera by applying the Qopen to our dataset. Our event and P- and S-wave traveltime information is in the hyp file format from Nonlinloc; Waveforms data are response-removed and all station recordings for each event are stored as a mseed file, also, Waveform data are response-removed and each station with each component for each event is stored as a SAC file; An inventory is ready and probably not necessary since the response has already been removed.

From examples on Github, several varieties of conf.json, “events”, and “data” are present, and I do not have a clear idea of which one to follow. I am writing this email to ask you for some recommendations on how to adjust the conf.json file and the event, travel time, and waveform format to fit well into the requirements of Qopen. Are there any examples that can give a proper reference to start with? Thanks for your development of Qopen and I am looking forward to your reply.

Regards,

Steve

---

<div class="post-metadata">

**Author:** ![trichter](https://discourse.obspy.org/user_avatar/discourse.obspy.org/trichter/32/226_2.png) [@trichter](https://discourse.obspy.org/u/trichter)\
**Post date:** [July 3, 2024, 9:13pm UTC](https://discourse.obspy.org/t/input-data-format/1970/2 "2024-07-03T21:13:08Z")

</div>

Hi Steve!

Welcome to the forum!

The station inventory is needed anyway for the coordinates and the channel descriptions (level channel). The problem with HYP files is that the channel in the arrival data is often not fully specified with a SEED id. I had a similar problem in this [repository](https://github.com/trichter/robust_earthquake_spectra/blob/7b7bcd6cd29a1bdcf59346fcb5e421b86f7c41d3/qopen/conf.json), which belongs to an BSSA publication. However, event metadata was in HYPODDPHA format. But the resolve\_seedid parameter is also present for ObsPy’s HYP read support. See also [this configuration](https://github.com/trichter/qopen_ridgecrest/blob/d1f4443a393c83587fe2b49889c621c422ac75c2/qopen/conf.json).  
Hopefully something like this will get you started:

```python
# data part conf.json
"events": "globexpression/*.hyp",
"inventory": "globexpression/*.xml",
"read_events_kwargs": {"resolve_seedid": true},
#"filter_inventory": {"channel": "HH?", "location": ""}, # necessary if multiple sampling rates are defined in you XML
"data": "plugin",
"plugin": "data : get_waveforms",

```

If you still have problems, perhaps you could post a sample hyp file and a printout of picks/arrivals from obspy.read\_events() for one of your files.

Using the plugin interface for data is best when dealing with large datasets like yours. See the repositories referenced above for examples of `data.py` files. Either read the SAC files and set the `remove_response` option to `null`, or read the raw MSEED waveforms and set `remove_reponse` to either `"sensitivity"` or `"full"`.  
The get\_waveforms function is passed an event, station name, a period of time and so on and Qopen expects this function to return a three-component stream of specified time period and station. Here is the code snippet from Qopen that will call this function:

```python
        evid, station = pair
        seedid = one_channel[station][:-1] + '?'
        net, sta, loc, cha = seedid.split('.')
        t1 = origins[evid].time + request_window[0]
        t2 = origins[evid].time + request_window[1]
        kwargs2 = {'network': net, 'station': sta, 'location': loc,
                   'channel': cha, 'starttime': t1, 'endtime': t2,
                   'event': event_dict[evid]}
        stream = get_waveforms(**kwargs2)

```

Good luck with Qopen and your research! And keep us updated.

Best,  
Tom

Edit: I just fixed the documentation of [read\_nlloc\_hyp](https://docs.obspy.org/master/packages/autogen/obspy.io.nlloc.core.read_nlloc_hyp.html#obspy.io.nlloc.core.read_nlloc_hyp) (it is the documentation of master branch, [docs.obspy.org](http://docs.obspy.org) still points to the unfixed documentation of the latest release). The parameters in the bottom can be used in the read\_events\_kwargs dictionary to work around the problem of not fully specified channels. Actually, the only thing the resolve\_seedid option does is to pass the inventory to the read\_events function for this purpose. Qopen queries the picks/arrivals with the full SEED id of the station channels. Therefore, it is important that waveform\_id in picks and station channels have the same SEED ids.

---

<div class="post-metadata">

**Author:** ![Thanks](https://discourse.obspy.org/user_avatar/discourse.obspy.org/thanks/32/842_2.png) [@Thanks](https://discourse.obspy.org/u/Thanks)\
**Post date:** [July 5, 2024, 4:31pm UTC](https://discourse.obspy.org/t/input-data-format/1970/3 "2024-07-05T16:31:51Z")

</div>

This link includes one example of hyp file from Nonlinloc:  
[https://drive.google.com/drive/folders/1voqj3N3wsSa2Kl0zuqOEUlRALVTk23aD?usp=sharing](https://drive.google.com/drive/folders/1voqj3N3wsSa2Kl0zuqOEUlRALVTk23aD?usp=sharing)

I use Obspy to read it and the code and its outputs are as follows:  
**from obspy import read**  
**cat = read\_events(“./qopen.hyp”)**  
**event = cat[0]**  
**print(event)**  
Event: 2007-07-15T02:50:34.786718Z | +65.018, -16.271

```
         resource_id: ResourceIdentifier(id="smi:local/c7df8948-454c-43c2-b17f-704d1ee8594c")
       creation_info: CreationInfo(author='FirstName LastName obs:./obs/new_hpf_120320/20070715025039100000.nonlinloc NLLoc:v7.00.00(27Oct2017)', creation_time=UTCDateTime(2024, 3, 12, 20, 45), version='')
 preferred_origin_id: ResourceIdentifier(id="smi:local/554c3038-9f33-4c45-9b2a-7ed3eae75e20")
                ---------
            comments: 1 Elements
               picks: 12 Elements
             origins: 1 Elements

```

**print(event.origins[0])**  
**print(event.origins[0].time)**  
**print(event.origins[0].longitude)**  
**print(event.origins[0].latitude)**  
**print(event.origins[0].depth/1000)**  
Origin  
resource\_id: ResourceIdentifier(id=“smi:local/554c3038-9f33-4c45-9b2a-7ed3eae75e20”)  
time: UTCDateTime(2007, 7, 15, 2, 50, 34, 786718)  
longitude: -16.270705 [uncertainty=0.0017162581521154327]  
latitude: 65.01764 [uncertainty=0.0015552960519945266]  
depth: 15676.758 [confidence\_level=68, uncertainty=359.37584782508685]  
depth\_type: ‘from location’  
quality: OriginQuality(associated\_phase\_count=12, used\_phase\_count=12, associated\_station\_count=-1, used\_station\_count=6, depth\_phase\_count=-1, standard\_error=0.0528838, azimuthal\_gap=82.5845, secondary\_azimuthal\_gap=90.3778, ground\_truth\_level=‘-’, minimum\_distance=0.027458716797034825, maximum\_distance=0.3351861557419701, median\_distance=0.16394992604540826)  
origin\_uncertainty: OriginUncertainty(min\_horizontal\_uncertainty=241.93200000000002, max\_horizontal\_uncertainty=306.633, azimuth\_max\_horizontal\_uncertainty=57.4783, preferred\_description=‘uncertainty ellipse’, confidence\_level=68.0)  
creation\_info: CreationInfo(author=‘FirstName LastName obs:./obs/new\_hpf\_120320/20070715025039100000.nonlinloc NLLoc:v7.00.00(27Oct2017)’, creation\_time=UTCDateTime(2024, 3, 12, 20, 45), version=‘’)  
---------  
comments: 1 Elements  
arrivals: 12 Elements  
2007-07-15T02:50:34.786718Z  
-16.270705  
65.01764  
15.676758

**print(event.picks)**  
**print(event.picks[0])**  
**print(event.picks[0].phase\_hint)**  
**print(event.picks[0].waveform\_id)**  
**print(event.picks[0].waveform\_id.network\_code)**  
**print(event.picks[0].waveform\_id.station\_code)**  
**print(event.picks[0].waveform\_id.channel\_code)**  
**print(event.picks[0].time)**  
[Pick(resource\_id=ResourceIdentifier(id=“smi:local/dc427c57-a4ec-49b3-b23c-95b1b065b16c”), time=UTCDateTime(2007, 7, 15, 2, 50, 37, 730000) [uncertainty=0.02], waveform\_id=WaveformStreamID(network\_code=‘’, station\_code=‘Sta1’, channel\_code=‘Z’), phase\_hint=‘P’), Pick(resource\_id=ResourceIdentifier(id=“smi:local/140369ee-ca4e-4aa7-80b9-e26579f62642”), time=UTCDateTime(2007, 7, 15, 2, 50, 40, 60000) [uncertainty=0.1], waveform\_id=WaveformStreamID(network\_code=‘’, station\_code=‘Sta1’, channel\_code=‘N’), phase\_hint=‘S’), Pick(resource\_id=ResourceIdentifier(id=“smi:local/41ae0954-a9d1-46c8-b123-8be07e372f58”), time=UTCDateTime(2007, 7, 15, 2, 50, 37, 870000) [uncertainty=0.02], waveform\_id=WaveformStreamID(network\_code=‘’, station\_code=‘Sta2’, channel\_code=‘Z’), phase\_hint=‘P’), Pick(resource\_id=ResourceIdentifier(id=“smi:local/fd49d597-b86a-45d6-8eec-b8cf5d4d5166”), time=UTCDateTime(2007, 7, 15, 2, 50, 40, 160000) [uncertainty=0.1], waveform\_id=WaveformStreamID(network\_code=‘’, station\_code=‘Sta2’, channel\_code=‘N’), phase\_hint=‘S’), Pick(resource\_id=ResourceIdentifier(id=“smi:local/980deb47-4eba-450b-8625-524a3d58b8eb”), time=UTCDateTime(2007, 7, 15, 2, 50, 37, 930000) [uncertainty=0.02], waveform\_id=WaveformStreamID(network\_code=‘’, station\_code=‘Sta3’, channel\_code=‘Z’), phase\_hint=‘P’), Pick(resource\_id=ResourceIdentifier(id=“smi:local/f2207e82-a262-4254-9c41-5523139fc5ac”), time=UTCDateTime(2007, 7, 15, 2, 50, 40, 240000) [uncertainty=0.1], waveform\_id=WaveformStreamID(network\_code=‘’, station\_code=‘Sta3’, channel\_code=‘N’), phase\_hint=‘S’), Pick(resource\_id=ResourceIdentifier(id=“smi:local/5c001e88-def4-467e-98bf-fe76a6253f55”), time=UTCDateTime(2007, 7, 15, 2, 50, 37, 990000) [uncertainty=0.02], waveform\_id=WaveformStreamID(network\_code=‘’, station\_code=‘Sta4’, channel\_code=‘Z’), phase\_hint=‘P’), Pick(resource\_id=ResourceIdentifier(id=“smi:local/e7673a36-9577-4bba-9e62-f82036a73b3d”), time=UTCDateTime(2007, 7, 15, 2, 50, 40, 360000) [uncertainty=0.1], waveform\_id=WaveformStreamID(network\_code=‘’, station\_code=‘Sta4’, channel\_code=‘N’), phase\_hint=‘S’), Pick(resource\_id=ResourceIdentifier(id=“smi:local/c5ee25db-4d4e-4070-8304-d72c1309dd37”), time=UTCDateTime(2007, 7, 15, 2, 50, 38, 360000) [uncertainty=0.02], waveform\_id=WaveformStreamID(network\_code=‘’, station\_code=‘Sta5’, channel\_code=‘Z’), phase\_hint=‘P’), Pick(resource\_id=ResourceIdentifier(id=“smi:local/1e323ffa-5105-4662-9683-688d6a919af2”), time=UTCDateTime(2007, 7, 15, 2, 50, 40, 980000) [uncertainty=0.1], waveform\_id=WaveformStreamID(network\_code=‘’, station\_code=‘Sta5’, channel\_code=‘N’), phase\_hint=‘S’), Pick(resource\_id=ResourceIdentifier(id=“smi:local/d5d7a980-ae20-4d98-a772-6040fdd66339”), time=UTCDateTime(2007, 7, 15, 2, 50, 38, 440000) [uncertainty=0.02], waveform\_id=WaveformStreamID(network\_code=‘’, station\_code=‘Sta6’, channel\_code=‘Z’), phase\_hint=‘P’), Pick(resource\_id=ResourceIdentifier(id=“smi:local/9766ef4f-e3cf-4949-8b74-94b1a3314269”), time=UTCDateTime(2007, 7, 15, 2, 50, 41, 110000) [uncertainty=0.1], waveform\_id=WaveformStreamID(network\_code=‘’, station\_code=‘Sta6’, channel\_code=‘N’), phase\_hint=‘S’)]  
Pick  
resource\_id: ResourceIdentifier(id=“smi:local/dc427c57-a4ec-49b3-b23c-95b1b065b16c”)  
time: UTCDateTime(2007, 7, 15, 2, 50, 37, 730000) [uncertainty=0.02]  
waveform\_id: WaveformStreamID(network\_code=‘’, station\_code=‘Sta1’, channel\_code=‘Z’)  
phase\_hint: ‘P’  
P  
WaveformStreamID(network\_code=‘’, station\_code=‘Sta1’, channel\_code=‘Z’)

Sta1  
Z  
2007-07-15T02:50:37.730000Z

Do you have any recommendations on how to utilize the hyp file in Qopen given the above information? Danke!

Regards,

Steve

---

<div class="post-metadata">

**Author:** ![trichter](https://discourse.obspy.org/user_avatar/discourse.obspy.org/trichter/32/226_2.png) [@trichter](https://discourse.obspy.org/u/trichter)\
**Post date:** [July 22, 2024, 2:08pm UTC](https://discourse.obspy.org/t/input-data-format/1970/4 "2024-07-22T14:08:29Z")

</div>

Hey! The waveform, station, and event metadata have to fit together. The `read_events_kwargs` option can be used to manipulate the event metadata on the fly. Have you solved the problem in the meantime?

It is not clear from the posted event metadata alone how to configure everything correctly. If you need more guidance, I would need more information on the waveform and station metadata (best would be some waveform data from the provided event and the STATIONXML).
