Skip to content

Commit e5438e1

Browse files
authored
Merge pull request #126 from mhearne-usgs/authorfix
Added Agency to list of phase dataframe columns.
2 parents 475529d + ad68648 commit e5438e1

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

libcomcat/utils.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,12 @@ def _get_phaserow(pick, catevent):
197197
- Status: "manual" or "automatic".
198198
- Residual: Arrival time residual.
199199
- Weight: Arrival weight.
200+
- Agency: Agency ID.
200201
"""
201202
pick_id = pick.resource_id
202203
waveform_id = pick.waveform_id
203204
arrival = get_arrival(catevent, pick_id)
204205
if arrival is None:
205-
#print('could not find arrival for pick %s' % pick_id)
206206
return None
207207

208208
# save info to row of dataframe
@@ -215,7 +215,8 @@ def _get_phaserow(pick, catevent):
215215
'Arrival Time': etime,
216216
'Status': pick.evaluation_mode,
217217
'Residual': arrival.time_residual,
218-
'Weight': arrival.time_weight}
218+
'Weight': arrival.time_weight,
219+
'Agency': arrival.creation_info.agency_id}
219220
return row
220221

221222

@@ -228,31 +229,33 @@ def get_phase_dataframe(detail, catalog='preferred'):
228229
Source network ('us','ak', etc. ,or 'preferred'.)
229230
:returns:
230231
Pandas DataFrame containing columns:
231-
- Channel: Network.Station.Channel.Location (NSCL) style station description.
232-
("--" indicates missing information)
232+
- Channel: Network.Station.Channel.Location (NSCL) style station
233+
description. ("--" indicates missing information)
233234
- Distance: Distance (kilometers) from epicenter to station.
234235
- Azimuth: Azimuth (degrees) from epicenter to station.
235236
- Phase: Name of the phase (Pn,Pg, etc.)
236237
- Arrival Time: Pick arrival time (UTC).
237238
- Status: "manual" or "automatic".
238239
- Residual: Arrival time residual.
239240
- Weight: Arrival weight.
241+
- Agency: Agency ID.
240242
:raises:
241-
AttributeError if input DetailEvent does not have a phase-data product for the input catalog.
243+
AttributeError if input DetailEvent does not have a phase-data product
244+
for the input catalog.
242245
"""
243246
if catalog is None:
244247
catalog = 'preferred'
245248
df = pd.DataFrame(columns=['Channel', 'Distance', 'Azimuth',
246249
'Phase', 'Arrival Time', 'Status',
247-
'Residual', 'Weight'])
250+
'Residual', 'Weight', 'Agency'])
248251

249252
phasedata = detail.getProducts('phase-data', source=catalog)[0]
250253
quakeurl = phasedata.getContentURL('quakeml.xml')
251254
try:
252255
fh = urlopen(quakeurl, timeout=TIMEOUT)
253256
data = fh.read()
254257
fh.close()
255-
except Exception as msg:
258+
except Exception:
256259
return None
257260
unpickler = Unpickler()
258261
with warnings.catch_warnings():
@@ -272,7 +275,7 @@ def get_detail_data_frame(events, get_all_magnitudes=False,
272275
get_focals='preferred',
273276
get_moment_supplement=False,
274277
verbose=False):
275-
"""Take the results of a search and extract the detailed event informat in a pandas DataFrame.
278+
"""Extract the detailed event informat into a pandas DataFrame.
276279
277280
Usage:
278281
TODO

0 commit comments

Comments
 (0)