本文整理汇总了Python中obspy.core.event.Origin.type方法的典型用法代码示例。如果您正苦于以下问题:Python Origin.type方法的具体用法?Python Origin.type怎么用?Python Origin.type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obspy.core.event.Origin
的用法示例。
在下文中一共展示了Origin.type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _parse_record_AH
# 需要导入模块: from obspy.core.event import Origin [as 别名]
# 或者: from obspy.core.event.Origin import type [as 别名]
def _parse_record_AH(self, line, event):
"""
Parses the 'additional hypocenter' record AH
"""
date = line[2:10]
time = line[11:20]
# unused: hypocenter_quality = line[20]
latitude = self._float(line[21:27])
lat_type = line[27]
longitude = self._float(line[29:36])
lon_type = line[36]
# unused: preliminary_flag = line[37]
depth = self._float(line[38:43])
# unused: depth_quality = line[43]
standard_dev = self._float_unused(line[44:48])
station_number = self._int_unused(line[48:51])
phase_number = self._int_unused(line[51:55])
source_code = line[56:60].strip()
evid = event.resource_id.id.split('/')[-1]
origin = Origin()
res_id = '/'.join((res_id_prefix, 'origin', evid, source_code.lower()))
origin.resource_id = ResourceIdentifier(id=res_id)
origin.creation_info = CreationInfo(agency_id=source_code)
origin.time = UTCDateTime(date + time)
origin.latitude = latitude * self._coordinate_sign(lat_type)
origin.longitude = longitude * self._coordinate_sign(lon_type)
origin.depth = depth * 1000
origin.depth_type = 'from location'
origin.quality = OriginQuality()
origin.quality.standard_error = standard_dev
origin.quality.used_station_count = station_number
origin.quality.used_phase_count = phase_number
origin.type = 'hypocenter'
event.origins.append(origin)
示例2: _parse_record_HY
# 需要导入模块: from obspy.core.event import Origin [as 别名]
# 或者: from obspy.core.event.Origin import type [as 别名]
def _parse_record_HY(self, line):
"""
Parses the 'hypocenter' record HY
"""
date = line[2:10]
time = line[11:20]
# unused: location_quality = line[20]
latitude = self._float(line[21:27])
lat_type = line[27]
longitude = self._float(line[29:36])
lon_type = line[36]
depth = self._float(line[38:43])
# unused: depth_quality = line[43]
standard_dev = self._float(line[44:48])
station_number = self._int(line[48:51])
# unused: version_flag = line[51]
FE_region_number = line[52:55]
FE_region_name = self._decode_FE_region_number(FE_region_number)
source_code = line[55:60].strip()
event = Event()
# FIXME: a smarter way to define evid?
evid = date + time
res_id = '/'.join((res_id_prefix, 'event', evid))
event.resource_id = ResourceIdentifier(id=res_id)
description = EventDescription(
type='region name',
text=FE_region_name)
event.event_descriptions.append(description)
description = EventDescription(
type='Flinn-Engdahl region',
text=FE_region_number)
event.event_descriptions.append(description)
origin = Origin()
res_id = '/'.join((res_id_prefix, 'origin', evid))
origin.resource_id = ResourceIdentifier(id=res_id)
origin.creation_info = CreationInfo()
if source_code:
origin.creation_info.agency_id = source_code
else:
origin.creation_info.agency_id = 'USGS-NEIC'
res_id = '/'.join((res_id_prefix, 'earthmodel/ak135'))
origin.earth_model_id = ResourceIdentifier(id=res_id)
origin.time = UTCDateTime(date + time)
origin.latitude = latitude * self._coordinate_sign(lat_type)
origin.longitude = longitude * self._coordinate_sign(lon_type)
origin.depth = depth * 1000
origin.depth_type = 'from location'
origin.quality = OriginQuality()
origin.quality.associated_station_count = station_number
origin.quality.standard_error = standard_dev
# associated_phase_count can be incremented in records 'P ' and 'S '
origin.quality.associated_phase_count = 0
# depth_phase_count can be incremented in record 'S '
origin.quality.depth_phase_count = 0
origin.type = 'hypocenter'
origin.region = FE_region_name
event.origins.append(origin)
return event
示例3: _parse_record_dp
# 需要导入模块: from obspy.core.event import Origin [as 别名]
# 或者: from obspy.core.event.Origin import type [as 别名]
def _parse_record_dp(self, line, event):
"""
Parses the 'source parameter data - primary' record Dp
"""
source_contributor = line[2:6].strip()
computation_type = line[6]
exponent = self._int_zero(line[7])
scale = math.pow(10, exponent)
centroid_origin_time = line[8:14] + '.' + line[14]
orig_time_stderr = line[15:17]
if orig_time_stderr == 'FX':
orig_time_stderr = 'Fixed'
else:
orig_time_stderr = \
self._float_with_format(orig_time_stderr, '2.1', scale)
centroid_latitude = self._float_with_format(line[17:21], '4.2')
lat_type = line[21]
if centroid_latitude is not None:
centroid_latitude *= self._coordinate_sign(lat_type)
lat_stderr = line[22:25]
if lat_stderr == 'FX':
lat_stderr = 'Fixed'
else:
lat_stderr = self._float_with_format(lat_stderr, '3.2', scale)
centroid_longitude = self._float_with_format(line[25:30], '5.2')
lon_type = line[30]
if centroid_longitude is not None:
centroid_longitude *= self._coordinate_sign(lon_type)
lon_stderr = line[31:34]
if lon_stderr == 'FX':
lon_stderr = 'Fixed'
else:
lon_stderr = self._float_with_format(lon_stderr, '3.2', scale)
centroid_depth = self._float_with_format(line[34:38], '4.1')
depth_stderr = line[38:40]
if depth_stderr == 'FX' or depth_stderr == 'BD':
depth_stderr = 'Fixed'
else:
depth_stderr = self._float_with_format(depth_stderr, '2.1', scale)
station_number = self._int_zero(line[40:43])
component_number = self._int_zero(line[43:46])
station_number2 = self._int_zero(line[46:48])
component_number2 = self._int_zero(line[48:51])
# unused: half_duration = self._float_with_format(line[51:54], '3.1')
moment = self._float_with_format(line[54:56], '2.1')
moment_stderr = self._float_with_format(line[56:58], '2.1')
moment_exponent = self._int(line[58:60])
if (moment is not None) and (moment_exponent is not None):
moment *= math.pow(10, moment_exponent)
if (moment_stderr is not None) and (moment_exponent is not None):
moment_stderr *= math.pow(10, moment_exponent)
evid = event.resource_id.id.split('/')[-1]
# Create a new origin only if centroid time is defined:
origin = None
if centroid_origin_time.strip() != '.':
origin = Origin()
res_id = '/'.join((res_id_prefix, 'origin',
evid, source_contributor.lower(),
'mw' + computation_type.lower()))
origin.resource_id = ResourceIdentifier(id=res_id)
origin.creation_info = \
CreationInfo(agency_id=source_contributor)
date = event.origins[0].time.strftime('%Y%m%d')
origin.time = UTCDateTime(date + centroid_origin_time)
# Check if centroid time is on the next day:
if origin.time < event.origins[0].time:
origin.time += timedelta(days=1)
self._store_uncertainty(origin.time_errors, orig_time_stderr)
origin.latitude = centroid_latitude
origin.longitude = centroid_longitude
origin.depth = centroid_depth * 1000
if lat_stderr == 'Fixed' and lon_stderr == 'Fixed':
origin.epicenter_fixed = True
else:
self._store_uncertainty(origin.latitude_errors,
self._lat_err_to_deg(lat_stderr))
self._store_uncertainty(origin.longitude_errors,
self._lon_err_to_deg(lon_stderr,
origin.latitude))
if depth_stderr == 'Fixed':
origin.depth_type = 'operator assigned'
else:
origin.depth_type = 'from location'
self._store_uncertainty(origin.depth_errors,
depth_stderr, scale=1000)
quality = OriginQuality()
quality.used_station_count = \
station_number + station_number2
quality.used_phase_count = \
component_number + component_number2
origin.quality = quality
origin.type = 'centroid'
event.origins.append(origin)
focal_mechanism = FocalMechanism()
res_id = '/'.join((res_id_prefix, 'focalmechanism',
evid, source_contributor.lower(),
'mw' + computation_type.lower()))
focal_mechanism.resource_id = ResourceIdentifier(id=res_id)
focal_mechanism.creation_info = \
#.........这里部分代码省略.........
示例4: _parseRecordDp
# 需要导入模块: from obspy.core.event import Origin [as 别名]
# 或者: from obspy.core.event.Origin import type [as 别名]
def _parseRecordDp(self, line, event):
"""
Parses the 'source parameter data - primary' record Dp
"""
source_contributor = line[2:6].strip()
computation_type = line[6]
exponent = self._intZero(line[7])
scale = math.pow(10, exponent)
centroid_origin_time = line[8:14] + "." + line[14]
orig_time_stderr = line[15:17]
if orig_time_stderr == "FX":
orig_time_stderr = "Fixed"
else:
orig_time_stderr = self._floatWithFormat(orig_time_stderr, "2.1", scale)
centroid_latitude = self._floatWithFormat(line[17:21], "4.2")
lat_type = line[21]
if centroid_latitude is not None:
centroid_latitude *= self._coordinateSign(lat_type)
lat_stderr = line[22:25]
if lat_stderr == "FX":
lat_stderr = "Fixed"
else:
lat_stderr = self._floatWithFormat(lat_stderr, "3.2", scale)
centroid_longitude = self._floatWithFormat(line[25:30], "5.2")
lon_type = line[30]
if centroid_longitude is not None:
centroid_longitude *= self._coordinateSign(lon_type)
lon_stderr = line[31:34]
if lon_stderr == "FX":
lon_stderr = "Fixed"
else:
lon_stderr = self._floatWithFormat(lon_stderr, "3.2", scale)
centroid_depth = self._floatWithFormat(line[34:38], "4.1")
depth_stderr = line[38:40]
if depth_stderr == "FX" or depth_stderr == "BD":
depth_stderr = "Fixed"
else:
depth_stderr = self._floatWithFormat(depth_stderr, "2.1", scale)
station_number = self._intZero(line[40:43])
component_number = self._intZero(line[43:46])
station_number2 = self._intZero(line[46:48])
component_number2 = self._intZero(line[48:51])
# unused: half_duration = self._floatWithFormat(line[51:54], '3.1')
moment = self._floatWithFormat(line[54:56], "2.1")
moment_stderr = self._floatWithFormat(line[56:58], "2.1")
moment_exponent = self._int(line[58:60])
if (moment is not None) and (moment_exponent is not None):
moment *= math.pow(10, moment_exponent)
if (moment_stderr is not None) and (moment_exponent is not None):
moment_stderr *= math.pow(10, moment_exponent)
evid = event.resource_id.id.split("/")[-1]
# Create a new origin only if centroid time is defined:
origin = None
if centroid_origin_time.strip() != ".":
origin = Origin()
res_id = "/".join(
(res_id_prefix, "origin", evid, source_contributor.lower(), "mw" + computation_type.lower())
)
origin.resource_id = ResourceIdentifier(id=res_id)
origin.creation_info = CreationInfo(agency_id=source_contributor)
date = event.origins[0].time.strftime("%Y%m%d")
origin.time = UTCDateTime(date + centroid_origin_time)
# Check if centroid time is on the next day:
if origin.time < event.origins[0].time:
origin.time += timedelta(days=1)
self._storeUncertainty(origin.time_errors, orig_time_stderr)
origin.latitude = centroid_latitude
origin.longitude = centroid_longitude
origin.depth = centroid_depth * 1000
if lat_stderr == "Fixed" and lon_stderr == "Fixed":
origin.epicenter_fixed = True
else:
self._storeUncertainty(origin.latitude_errors, self._latErrToDeg(lat_stderr))
self._storeUncertainty(origin.longitude_errors, self._lonErrToDeg(lon_stderr, origin.latitude))
if depth_stderr == "Fixed":
origin.depth_type = "operator assigned"
else:
origin.depth_type = "from location"
self._storeUncertainty(origin.depth_errors, depth_stderr, scale=1000)
quality = OriginQuality()
quality.used_station_count = station_number + station_number2
quality.used_phase_count = component_number + component_number2
origin.quality = quality
origin.type = "centroid"
event.origins.append(origin)
focal_mechanism = FocalMechanism()
res_id = "/".join(
(res_id_prefix, "focalmechanism", evid, source_contributor.lower(), "mw" + computation_type.lower())
)
focal_mechanism.resource_id = ResourceIdentifier(id=res_id)
focal_mechanism.creation_info = CreationInfo(agency_id=source_contributor)
moment_tensor = MomentTensor()
if origin is not None:
moment_tensor.derived_origin_id = origin.resource_id
else:
# this is required for QuakeML validation:
res_id = "/".join((res_id_prefix, "no-origin"))
moment_tensor.derived_origin_id = ResourceIdentifier(id=res_id)
for mag in event.magnitudes:
#.........这里部分代码省略.........