本文整理汇总了Python中hmtk.seismicity.catalogue.Catalogue.start_year方法的典型用法代码示例。如果您正苦于以下问题:Python Catalogue.start_year方法的具体用法?Python Catalogue.start_year怎么用?Python Catalogue.start_year使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hmtk.seismicity.catalogue.Catalogue
的用法示例。
在下文中一共展示了Catalogue.start_year方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from hmtk.seismicity.catalogue import Catalogue [as 别名]
# 或者: from hmtk.seismicity.catalogue.Catalogue import start_year [as 别名]
def setUp(self):
cat1 = Catalogue()
cat1.end_year = 2000
cat1.start_year = 1900
cat1.data['eventID'] = [1.0, 2.0, 3.0]
cat1.data['magnitude'] = np.array([1.0, 2.0, 3.0])
cat2 = Catalogue()
cat2.end_year = 1990
cat2.start_year = 1910
cat2.data['eventID'] = [1.0, 2.0, 3.0]
cat2.data['magnitude'] = np.array([1.0, 2.0, 3.0])
self.cat1 = cat1
self.cat2 = cat2
示例2: read_file
# 需要导入模块: from hmtk.seismicity.catalogue import Catalogue [as 别名]
# 或者: from hmtk.seismicity.catalogue.Catalogue import start_year [as 别名]
def read_file(self, start_year=None, end_year=None):
"""
"""
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])
if start_year:
catalogue.start_year = start_year
else:
catalogue.update_start_year()
if end_year:
catalogue.end_year = end_year
else:
catalogue.update_end_year()
return catalogue