当前位置: 首页>>代码示例>>Python>>正文


Python dataset.Dataset类代码示例

本文整理汇总了Python中urbansim.datasets.dataset.Dataset的典型用法代码示例。如果您正苦于以下问题:Python Dataset类的具体用法?Python Dataset怎么用?Python Dataset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Dataset类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    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)
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:26,代码来源:district_commute_dataset.py

示例2: __init__

    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)
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:15,代码来源:region_dataset.py

示例3: _compute_if_needed

    def _compute_if_needed(self, name, dataset_pool, resources=None, quiet=False, version=None):
        """ Compute variable given by the argument 'name' only if this variable
        has not been computed before.
        Check first if this variable belongs to dataset1 or dataset2.
        dataset_pool holds available datasets.
        """
        if not isinstance(name, VariableName):
            variable_name = VariableName(name)
        else:
            variable_name = name
        short_name = variable_name.get_alias()

        dataset_name = variable_name.get_dataset_name()
        if dataset_name == self.get_dataset_name():
            new_version = UrbansimDataset._compute_if_needed(self, variable_name, dataset_pool, resources, quiet=quiet, version=version)
        else:
            if dataset_name == self.dataset1.get_dataset_name():
                owner_dataset = self.dataset1
#                index = self.get_2d_index_of_dataset1()
            elif dataset_name == self.dataset2.get_dataset_name():
                owner_dataset = self.dataset2
#                index = self.get_2d_index()
            else:
                self._raise_error(StandardError, "Cannot find variable '%s'\nin either dataset or in the interaction set." %
                                variable_name.get_expression())
            owner_dataset.compute_variables([variable_name], dataset_pool, resources=resources, quiet=True)
            new_version =  self.compute_variables_return_versions_and_final_value("%s = %s.disaggregate(%s.%s)" % \
                                   ( short_name, self.get_dataset_name(), owner_dataset.get_dataset_name(), short_name ),
                                   dataset_pool=dataset_pool, resources=resources, quiet=quiet )[0]
        return new_version
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:30,代码来源:development_project_proposal_dataset.py

示例4: get_2d_attribute

 def get_2d_attribute(self, attribute):
     return UrbansimDataset.get_2d_attribute(self, attribute=attribute)
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:2,代码来源:land_cover_dataset.py

示例5: __init__

    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
                             )
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:21,代码来源:submarket_dataset.py

示例6: flatten_by_id

 def flatten_by_id(self, two_d_array):
     return UrbansimDataset.flatten_by_id(self, two_d_array)
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:2,代码来源:land_cover_dataset.py

示例7: __init__

 def __init__(self, *args, **kwargs):
     UrbansimDataset.__init__(self, *args, **kwargs)
     self.mask = None
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:3,代码来源:land_cover_dataset.py

示例8: __init__

 def __init__(self, id_values=None, **kwargs):
     UrbansimDataset.__init__(self, **kwargs)
     self.development_constraints = None
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:3,代码来源:parcel_dataset.py

示例9: __init__

 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 = []
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:4,代码来源:rate_dataset.py

示例10: __init__

 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)
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:6,代码来源:development_project_proposal_dataset.py

示例11: _update_id_mapping

 def _update_id_mapping(self):
     UrbansimDataset._update_id_mapping(self)
     self._create_id_mapping_array()
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:3,代码来源:county_dataset.py

示例12: __init__

 def __init__(self, *args, **kwargs):
     UrbansimDataset.__init__(self, *args, **kwargs)               
     
     self.low_income_level = -1
     self.mid_income_level = -1
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:5,代码来源:household_dataset.py


注:本文中的urbansim.datasets.dataset.Dataset类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。