Skip to content

Commit

Permalink
Merge pull request #231 from mhearne-usgs/scalingtiime
Browse files Browse the repository at this point in the history
Added measurement time to magnitude data frame
  • Loading branch information
hschovanec-usgs authored Sep 3, 2020
2 parents 963177d + cc95fc0 commit 5d3fcb2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libcomcat/dataframes.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ def get_magnitude_data_frame(detail, catalog, magtype):
"""
columns = columns = ['Channel', 'Type', 'Amplitude',
'Period', 'Status', 'Magnitude',
'Weight', 'Distance', 'Azimuth']
'Weight', 'Distance', 'Azimuth',
'MeasurementTime']
df = pd.DataFrame(columns=columns)
phasedata = detail.getProducts('phase-data', source=catalog)[0]
quakeurl = phasedata.getContentURL('quakeml.xml')
Expand Down Expand Up @@ -356,14 +357,17 @@ def get_magnitude_data_frame(detail, catalog, magtype):
row['Amplitude'] = amp.generic_amplitude
row['Period'] = amp.period
row['Status'] = amp.evaluation_mode
row['MeasurementTime'] = amp.scaling_time.datetime
else:
row['Amplitude'] = np.nan
row['Period'] = np.nan
row['Status'] = 'automatic'
row['MeasurementTime'] = np.nan
row['Magnitude'] = smag.mag
row['Weight'] = contribution.weight
row['Distance'] = distance
row['Azimuth'] = azimuth

df = df.append(row, ignore_index=True)
df = df[columns]
return df
Expand Down

0 comments on commit 5d3fcb2

Please sign in to comment.