本文整理汇总了Python中urbansim.datasets.dataset.Dataset.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.__init__方法的具体用法?Python Dataset.__init__怎么用?Python Dataset.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类urbansim.datasets.dataset.Dataset
的用法示例。
在下文中一共展示了Dataset.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from urbansim.datasets.dataset import Dataset [as 别名]
# 或者: from urbansim.datasets.dataset.Dataset import __init__ [as 别名]
def __init__(self, **kwargs):
districts = self._try_load_district_dataset(**kwargs)
if districts is not None:
district_ids = districts.get_id_attribute()
OD_array = array([[x, y] for x in district_ids for y in district_ids])
storage = StorageFactory().get_storage("dict_storage")
storage.write_table(
table_name=self.in_table_name_default,
table_data={
"commute_id": OD_array[:, 0] * 1000 + OD_array[:, 1],
"origin_district_id": OD_array[:, 0],
"destination_district_id": OD_array[:, 1],
},
)
UrbansimDataset.__init__(
self,
in_storage=storage,
# in_table_name=self.in_table_name_default,
# id_name=self.id_name_default,
# dataset_name=self.dataset_name
)
else:
UrbansimDataset.__init__(self, **kwargs)
示例2: __init__
# 需要导入模块: from urbansim.datasets.dataset import Dataset [as 别名]
# 或者: from urbansim.datasets.dataset.Dataset import __init__ [as 别名]
def __init__(self, id_values=1, **kwargs):
storage = StorageFactory().get_storage('dict_storage')
storage.write_table(table_name='regions',
table_data={
self.id_name_default:array([id_values])
}
)
resources = Resources({
'in_storage':storage,
'in_table_name':'regions'
})
UrbansimDataset.__init__(self, resources=resources, **kwargs)
示例3: __init__
# 需要导入模块: from urbansim.datasets.dataset import Dataset [as 别名]
# 或者: from urbansim.datasets.dataset.Dataset import __init__ [as 别名]
def __init__(self, submarket_definition=[], **kwargs):
if submarket_definition:
self.submarket_definition = submarket_definition
dataset, short_names, submarket_ids = self.solve_dependencies(**kwargs)
table_data = {}
table_data['submarket_id'], unique_index = unique( submarket_ids, return_index=True )
table_data.update([(short_name, dataset[short_name][unique_index]) for short_name in short_names])
storage = StorageFactory().get_storage('dict_storage')
storage.write_table(table_name=self.in_table_name_default,
table_data=table_data
)
UrbansimDataset.__init__(self, in_storage=storage,
#in_table_name=self.in_table_name_default,
#id_name=self.id_name_default,
#dataset_name=self.dataset_name
)
示例4: __init__
# 需要导入模块: from urbansim.datasets.dataset import Dataset [as 别名]
# 或者: from urbansim.datasets.dataset.Dataset import __init__ [as 别名]
def __init__(self, *args, **kwargs):
UrbansimDataset.__init__(self, *args, **kwargs)
self.mask = None
示例5: __init__
# 需要导入模块: from urbansim.datasets.dataset import Dataset [as 别名]
# 或者: from urbansim.datasets.dataset.Dataset import __init__ [as 别名]
def __init__(self, id_values=None, **kwargs):
UrbansimDataset.__init__(self, **kwargs)
self.development_constraints = None
示例6: __init__
# 需要导入模块: from urbansim.datasets.dataset import Dataset [as 别名]
# 或者: from urbansim.datasets.dataset.Dataset import __init__ [as 别名]
def __init__(self, what='', resources=None, **kwargs):
# what is a legacy argument that is not used any more
UrbansimDataset.__init__(self, resources, **kwargs)
self.independent_variables = []
示例7: __init__
# 需要导入模块: from urbansim.datasets.dataset import Dataset [as 别名]
# 或者: from urbansim.datasets.dataset.Dataset import __init__ [as 别名]
def __init__(self, resources=None, dataset1=None, dataset2=None, index1=None, index2=None, **kwargs):
""" This dataset is an interaction of two datasets (originally, parcel and development template).
It's similar to InteractionSet, but flattend to 1d, thus regression model can use this dataset without changes
"""
UrbansimDataset.__init__(self, resources=resources, **kwargs)
self._set_my_class_attributes(dataset1, dataset2, index1, index2)
示例8: __init__
# 需要导入模块: from urbansim.datasets.dataset import Dataset [as 别名]
# 或者: from urbansim.datasets.dataset.Dataset import __init__ [as 别名]
def __init__(self, *args, **kwargs):
UrbansimDataset.__init__(self, *args, **kwargs)
self.low_income_level = -1
self.mid_income_level = -1