本文整理汇总了Python中hmtk.seismicity.catalogue.Catalogue.data[key]方法的典型用法代码示例。如果您正苦于以下问题:Python Catalogue.data[key]方法的具体用法?Python Catalogue.data[key]怎么用?Python Catalogue.data[key]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hmtk.seismicity.catalogue.Catalogue
的用法示例。
在下文中一共展示了Catalogue.data[key]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: read_file
# 需要导入模块: from hmtk.seismicity.catalogue import Catalogue [as 别名]
# 或者: from hmtk.seismicity.catalogue.Catalogue import data[key] [as 别名]
def read_file(self):
"""
"""
filedata = open(self.input_file, 'rU')
catalogue = Catalogue()
# Reading the data file
data = csv.DictReader(filedata)
# Parsing the data content
for irow, row in enumerate(data):
if irow == 0:
valid_key_list = self._header_check(
row.keys(),
catalogue.TOTAL_ATTRIBUTE_LIST)
for key in valid_key_list:
if key in catalogue.FLOAT_ATTRIBUTE_LIST:
catalogue.data[key] = self._float_check(
catalogue.data[key],
row[key])
elif key in catalogue.INT_ATTRIBUTE_LIST:
catalogue.data[key] = self._int_check(
catalogue.data[key],
row[key])
else:
catalogue.data[key].append(row[key])
catalogue.update_end_year()
return catalogue
示例2: test_get_decimal_time
# 需要导入模块: from hmtk.seismicity.catalogue import Catalogue [as 别名]
# 或者: from hmtk.seismicity.catalogue.Catalogue import data[key] [as 别名]
def test_get_decimal_time(self):
# Tests the decimal time function. The function itself is tested in
# tests.seismicity.utils so only minimal testing is undertaken here to
# ensure coverage
time_dict = {'year': np.array([1990, 2000]),
'month': np.array([3, 9]),
'day': np.ones(2, dtype=int),
'hour': np.ones(2, dtype=int),
'minute': np.ones(2, dtype=int),
'second': np.ones(2, dtype=float)}
expected_dec_time = decimal_time(time_dict['year'],
time_dict['month'],
time_dict['day'],
time_dict['hour'],
time_dict['minute'],
time_dict['second'])
cat = Catalogue()
for key in ['year', 'month', 'day', 'hour', 'minute', 'second']:
cat.data[key] = np.copy(time_dict[key])
np.testing.assert_array_almost_equal(expected_dec_time,
cat.get_decimal_time())