本文整理汇总了Python中obspy.core.event.Catalog.comments方法的典型用法代码示例。如果您正苦于以下问题:Python Catalog.comments方法的具体用法?Python Catalog.comments怎么用?Python Catalog.comments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obspy.core.event.Catalog
的用法示例。
在下文中一共展示了Catalog.comments方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _deserialize
# 需要导入模块: from obspy.core.event import Catalog [as 别名]
# 或者: from obspy.core.event.Catalog import comments [as 别名]
def _deserialize(self):
catalog = Catalog()
res_id = '/'.join((res_id_prefix,
self.filename.replace(':', '/')))\
.replace('\\', '/').replace('//', '/')
catalog.resource_id = ResourceIdentifier(id=res_id)
catalog.description = 'Created from NEIC PDE mchedr format'
catalog.comments = ''
catalog.creation_info = CreationInfo(creation_time=UTCDateTime())
for line in self.fh.readlines():
# XXX: ugly, probably we should do everything in byte strings
# here? Is the pde / mchedr format unicode aware?
line = line.decode()
record_id = line[0:2]
if record_id == 'HY':
event = self._parse_record_hy(line)
catalog.append(event)
elif record_id == 'P ':
pick, arrival = self._parse_record_p(line, event)
elif record_id == 'E ':
self._parse_record_e(line, event)
elif record_id == 'L ':
self._parse_record_l(line, event)
elif record_id == 'A ':
self._parse_record_a(line, event)
elif record_id == 'C ':
self._parse_record_c(line, event)
elif record_id == 'AH':
self._parse_record_ah(line, event)
elif record_id == 'AE':
self._parse_record_ae(line, event)
elif record_id == 'Dp':
focal_mechanism = self._parse_record_dp(line, event)
elif record_id == 'Dt':
self._parse_record_dt(line, focal_mechanism)
elif record_id == 'Da':
self._parse_record_da(line, focal_mechanism)
elif record_id == 'Dc':
self._parse_record_dc(line, focal_mechanism)
elif record_id == 'M ':
self._parse_record_m(line, event, pick)
elif record_id == 'S ':
self._parse_record_s(line, event, pick, arrival)
self.fh.close()
# strip extra whitespaces from event comments
for event in catalog:
for comment in event.comments:
comment.text = comment.text.strip()
event.scope_resource_ids()
return catalog
示例2: _deserialize
# 需要导入模块: from obspy.core.event import Catalog [as 别名]
# 或者: from obspy.core.event.Catalog import comments [as 别名]
def _deserialize(self):
catalog = Catalog()
res_id = "/".join((res_id_prefix, self.filename))
catalog.resource_id = ResourceIdentifier(id=res_id)
catalog.description = "Created from NEIC PDE mchedr format"
catalog.comments = ""
catalog.creation_info = CreationInfo(creation_time=UTCDateTime())
for line in self.fh.readlines():
# XXX: ugly, probably we should do everything in byte strings
# here? Is the pde / mchedr format unicode aware?
line = line.decode()
record_id = line[0:2]
if record_id == "HY":
event = self._parseRecordHY(line)
catalog.append(event)
elif record_id == "P ":
pick, arrival = self._parseRecordP(line, event)
elif record_id == "E ":
self._parseRecordE(line, event)
elif record_id == "L ":
self._parseRecordL(line, event)
elif record_id == "A ":
self._parseRecordA(line, event)
elif record_id == "C ":
self._parseRecordC(line, event)
elif record_id == "AH":
self._parseRecordAH(line, event)
elif record_id == "AE":
self._parseRecordAE(line, event)
elif record_id == "Dp":
focal_mechanism = self._parseRecordDp(line, event)
elif record_id == "Dt":
self._parseRecordDt(line, focal_mechanism)
elif record_id == "Da":
self._parseRecordDa(line, focal_mechanism)
elif record_id == "Dc":
self._parseRecordDc(line, focal_mechanism)
elif record_id == "M ":
self._parseRecordM(line, event, pick)
elif record_id == "S ":
self._parseRecordS(line, event, pick, arrival)
self.fh.close()
# strip extra whitespaces from event comments
for event in catalog:
for comment in event.comments:
comment.text = comment.text.strip()
return catalog