Example #1
0
    def __init__(self):
        config = UrbansimParcelConfiguration()

        config_changes = {
            "description": "data preparation for PSRC parcel",
            "cache_directory": None,
            "creating_baseyear_cache_configuration": CreatingBaseyearCacheConfiguration(
                cache_directory_root=r"/Users/hana/urbansim_cache/psrc/parcel",
                # cache_directory_root = r'/urbansim_cache/psrc_parcel',
                # cache_directory_root = r'/workspace/urbansim_cache/psrc_parcel',
                cache_from_database=False,
                baseyear_cache=BaseyearCacheConfiguration(
                    existing_cache_to_copy=r"/Users/hana/urbansim_cache/psrc/cache_source_parcel",
                    # existing_cache_to_copy = r'/urbansim_cache/psrc_parcel/cache_source',
                    # existing_cache_to_copy = r'/workspace/urbansim_cache/psrc_parcel/estimation',
                    years_to_cache=[2000],
                ),
                cache_scenario_database="urbansim.model_coordinators.cache_scenario_database",
            ),
            "dataset_pool_configuration": DatasetPoolConfiguration(
                package_order=["psrc_parcel", "urbansim_parcel", "urbansim", "opus_core"]
            ),
            "base_year": 2000,
            "years": (2001, 2001),
            "models": [  # models are executed in the same order as in this list
                "employment_relocation_model",
                {"employment_location_choice_model": {"group_members": "_all_"}},
            ],
            "datasets_to_preload": {"zone": {}, "job": {}, "job_building_type": {}, "building": {}},
        }
        # use configuration in config as defaults and merge with config_changes
        config.replace(config_changes)
        self.merge(config)
        self["models_configuration"]["non_home_based_employment_location_choice_model"] = {}
        self["models_configuration"]["non_home_based_employment_location_choice_model"][
            "controller"
        ] = EmploymentLocationChoiceModelByZonesConfigurationCreator(
            location_set="building",
            input_index="erm_index",
            sampler=None,
            capacity_string="urbansim_parcel.building.vacant_non_home_based_job_space",
            number_of_units_string=None,
            lottery_max_iterations=30,
        ).execute()
        self["models_configuration"]["home_based_employment_location_choice_model"] = {}
        self["models_configuration"]["home_based_employment_location_choice_model"][
            "controller"
        ] = EmploymentLocationChoiceModelByZonesConfigurationCreator(
            location_set="building",
            input_index="erm_index",
            sampler=None,
            capacity_string="urbansim_parcel.building.vacant_home_based_job_space",
            number_of_units_string=None,
            lottery_max_iterations=30,
        ).execute()
        self["models_configuration"]["employment_relocation_model"][
            "controller"
        ] = EmploymentRelocationModelConfigurationCreator(
            location_id_name="building_id", probabilities=None, rate_table=None, output_index="erm_index"
        ).execute()
    def __init__(self):
        config = UrbansimParcelConfiguration()

        config_changes = {
            'description':'data preparation for PSRC parcel (buildings)',
            'cache_directory': None,
            'creating_baseyear_cache_configuration': CreatingBaseyearCacheConfiguration(
                #cache_directory_root = r'/Users/hana/urbansim_cache/psrc/parcel',
                cache_directory_root = r'/urbansim_cache/psrc_parcel',
                #cache_directory_root = r'/workspace/urbansim_cache/psrc_parcel',
                cache_from_database = False,
                baseyear_cache = BaseyearCacheConfiguration(
                    #existing_cache_to_copy = r'/Users/hana/urbansim_cache/psrc/cache_source_parcel',
                    existing_cache_to_copy = r'/urbansim_cache/psrc_parcel/cache_source',
                    #existing_cache_to_copy = r'/workspace/urbansim_cache/psrc_parcel/estimation',
                    years_to_cache = [2000]
                    ),
                cache_scenario_database = 'urbansim.model_coordinators.cache_scenario_database',
                ),
            'dataset_pool_configuration': DatasetPoolConfiguration(
                package_order=['psrc_parcel', 'urbansim_parcel', 'urbansim', 'opus_core'],
                ),
            'base_year':2000,
            'years':(2001, 2001),
            'models':[ # models are executed in the same order as in this list
                 "expected_sale_price_model",
                 "development_proposal_choice_model",
                 "building_construction_model",
                ],
            "datasets_to_preload":{
                    'zone':{},
                    'household':{},
                    'building': {},
                   #'development_project_proposal': {}
                },
            "datasets_to_cache_after_each_model": [
                     'parcel', 'building', 'development_project_proposal', 'household', 'job'
                     ]
        }
        #use configuration in config as defaults and merge with config_changes
        config.replace(config_changes)
        self.merge(config)
        self['models_configuration']['development_proposal_choice_model']['controller']["import"] =  {
                       "psrc_parcel.models.development_proposal_sampling_model_by_zones":
                       "DevelopmentProposalSamplingModelByZones"
                       }
        self['models_configuration']['development_proposal_choice_model']['controller']["init"]["name"] =\
                        "DevelopmentProposalSamplingModelByZones"
        self['models_configuration']['development_proposal_choice_model']['controller']['run']['arguments']["zones"] = 'zone'
        self['models_configuration']['development_proposal_choice_model']['controller']['run']['arguments']["type"] = "'non_residential'"
        self['models_configuration']['expected_sale_price_model']['controller']["init"]['arguments']["filter_attribute"] = "'urbansim_parcel.development_project_proposal.is_size_fit'"
        self['models_configuration']['expected_sale_price_model']['controller']["prepare_for_run"]['arguments']["parcel_filter"] = \
            "'numpy.logical_and(numpy.logical_or(numpy.logical_not(urbansim_parcel.parcel.is_residential_land_use_type), numpy.logical_and(parcel.land_use_type_id==26, urbansim_parcel.parcel.is_non_residential_plan_type)), urbansim_parcel.parcel.vacant_land_area > 0)'"
                #"'numpy.logical_or(parcel.land_use_type_id==26, numpy.logical_and(urbansim_parcel.parcel.is_residential_land_use_type, urbansim_parcel.parcel.vacant_land_area > 0))'"
        self['models_configuration']['building_construction_model']['controller']["run"]['arguments']["consider_amount_built_in_parcels"] = False
        self['models_configuration']['building_construction_model']['controller']['run']['arguments']["current_year"] = 2000
                
Example #3
0
    def __init__(self):
        config = UrbansimParcelConfiguration()

        config_changes = {
            'description':'data preparation for PSRC parcel (households)',
            'cache_directory': None,
            'creating_baseyear_cache_configuration': CreatingBaseyearCacheConfiguration(
                cache_directory_root = r'/Users/hana/urbansim_cache/psrc/parcel',
                #cache_directory_root = r'/urbansim_cache/psrc_parcel',
                #cache_directory_root = r'/workspace/urbansim_cache/psrc_parcel',
                cache_from_database = False,
                baseyear_cache = BaseyearCacheConfiguration(
                    existing_cache_to_copy = r'/Users/hana/urbansim_cache/psrc/cache_source_parcel',                         
                    #existing_cache_to_copy = r'/urbansim_cache/psrc_parcel/cache_source',
                    #existing_cache_to_copy = r'/workspace/urbansim_cache/psrc_parcel/estimation',
                    years_to_cache = [2000]
                    ),
                cache_scenario_database = 'urbansim.model_coordinators.cache_scenario_database',
                ),
            'dataset_pool_configuration': DatasetPoolConfiguration(
                package_order=['psrc_parcel', 'urbansim_parcel', 'urbansim', 'opus_core'],
                ),
            'base_year':2000,
            'years':(2001, 2001),
            'models':[ # models are executed in the same order as in this list
                 "household_relocation_model",
                 "household_location_choice_model",
                ],
            "datasets_to_preload":{
                    'zone':{},
                    'household':{},
                    'building': {}
                }
        }
        #use configuration in config as defaults and merge with config_changes
        config.replace(config_changes)
        self.merge(config)
        self['models_configuration']['household_location_choice_model'] = {}
        self['models_configuration']['household_location_choice_model']['controller'] = \
                   HouseholdLocationChoiceModelByZonesConfigurationCreator(
                                location_set = "building",
                                sampler = None,
                                input_index = 'hrm_index',
                                capacity_string = "urbansim_parcel.building.vacant_residential_units",
                                number_of_units_string = None,
                                nchunks=1,
                                lottery_max_iterations=20
                                ).execute()
        self['models_configuration']['household_relocation_model']['controller'] = \
                    HouseholdRelocationModelConfigurationCreator(
                               location_id_name = 'building_id',
                               probabilities = None,
                               rate_table=None,
                               rate_dataset_name = None,
                               output_index = 'hrm_index').execute()
                    
Example #4
0
    def __init__(self):
        opus_home = os.environ["OPUS_HOME"]
        config = UrbansimParcelConfiguration()
        config_changes = {
            "project_name": "seattle_parcel",
            "description": "Seattle parcel baseline",
            "cache_directory": os.path.join(os.environ["OPUS_HOME"], "data/vibe_parcel/base_year_data"),
            "creating_baseyear_cache_configuration": CreatingBaseyearCacheConfiguration(
                cache_directory_root=os.path.join(os.environ["OPUS_HOME"], "data/vibe_parcel/runs"),
                cache_from_database=True,
                baseyear_cache=BaseyearCacheConfiguration(
                    existing_cache_to_copy=os.path.join(os.environ["OPUS_HOME"], "data/vibe_parcel/base_year_data")
                ),
                cache_scenario_database="urbansim.model_coordinators.cache_scenario_database",
                tables_to_cache=[
                    "households",
                    "persons",
                    "buildings",
                    "parcels",
                    "gridcells",
                    "zones",
                    "jobs",
                    "households_for_estimation",
                    "jobs_for_estimation",
                    "development_event_history",
                    "travel_data",
                    "building_types",
                    "job_building_types",
                    "urbansim_constants",
                    "target_vacancies",
                    "home_based_employment_location_choice_model_coefficients",
                    "home_based_employment_location_choice_model_specification",
                    "non_home_based_employment_location_choice_model_coefficients",
                    "non_home_based_employment_location_choice_model_specification",
                    "household_location_choice_model_coefficients",
                    "household_location_choice_model_specification",
                    "real_estate_price_model_coefficients",
                    "real_estate_price_model_specification",
                    "annual_household_control_totals",
                    "annual_relocation_rates_for_households",
                    "household_characteristics_for_ht",
                    "annual_employment_control_totals",
                    "annual_relocation_rates_for_jobs",
                    "land_use_types",
                    "generic_land_use_types",
                    "employment_sectors",
                    "employment_adhoc_sector_groups",
                    "employment_adhoc_sector_group_definitions",
                    "development_templates",
                    "development_template_components",
                    "development_constraints",
                    "building_sqft_per_job",
                    "fazes",
                    "large_areas",
                    "demolition_cost_per_sqft",
                    "constant_taz_columns",
                ],
                tables_to_cache_nchunks={"parcels": 1},
                unroll_gridcells=False,
            ),
            "scenario_database_configuration": ScenarioDatabaseConfiguration(database_name="urbansim"),
            "dataset_pool_configuration": DatasetPoolConfiguration(
                # package_order=['psrc_parcel', 'urbansim_parcel', 'urbansim', 'opus_core'],
                # ),
                package_order=["psrc_parcel", "urbansim_parcel", "urbansim", "opus_core"]
            ),
            "base_year": 2011,
            "years": (2012, 2014),
            "models": [  # models are executed in the same order as in this list
                # "process_pipeline_events", # uncomented by model
                "real_estate_price_model",
                "expected_sale_price_model",
                "development_proposal_choice_model",
                "building_construction_model",
                "household_transition_model",
                # "employment_transition_model",
                "household_relocation_model",
                "household_location_choice_model",
                # "employment_relocation_model",
                # {"employment_location_choice_model":{'group_members': '_all_'}},
                #'distribute_unplaced_jobs_model'
            ],
            "models_in_year": {
                2011: [  # This is not run anymore, since all jobs are located and only a few households are not.
                    "household_relocation_model_for_2011",
                    "household_location_choice_model_for_2011",
                    # "employment_relocation_model_for_1980",
                    # {"employment_location_choice_model":{'group_members': '_all_'}}
                ]
            },
            "flush_dataset_to_cache_after_each_model": False,
            "flush_variables": False,
            "low_memory_run": False,
            "datasets_to_cache_after_each_model": [
                "parcel",
                "building",
                "household",  #'job',
                "development_project_proposal_component",  # to be cached for diagnostic purpose (lmwang)
                "development_project_proposal",
                "travel_data",
            ],
            "unroll_gridcells": False,
            "datasets_to_preload": {
                "zone": {},
                "household": {},
                "building": {},
                "parcel": {"package_name": "urbansim_parcel"},
                "person": {"package_name": "urbansim_parcel"},
                "development_template": {"package_name": "urbansim_parcel"},
                "development_template_component": {"package_name": "urbansim_parcel"},
                #'job':{},
                "building_type": {"package_name": "urbansim_parcel"},
                "travel_data": {},
                # "job_building_type":{}
            },
        }
        config.replace(config_changes)

        """config['models_configuration']["household_location_choice_model"]["controller"]["import"] = \
                {"psrc_parcel.models.household_location_choice_model" : "HouseholdLocationChoiceModel"}
        config['models_configuration']["employment_location_choice_model"]['controller']["import"] = \
                {"psrc_parcel.models.employment_location_choice_model" : "EmploymentLocationChoiceModel"}
        config['models_configuration']["home_based_employment_location_choice_model"]['controller']["import"] = \
                {"psrc_parcel.models.employment_location_choice_model" : "EmploymentLocationChoiceModel"}
        config['models_configuration']['household_relocation_model_for_1980'] = {}
        config['models_configuration']['household_relocation_model_for_1980']['controller'] = \
                    HouseholdRelocationModelConfigurationCreator(
                               location_id_name = 'building_id',
                               probabilities = None,
                               rate_table=None,
                               output_index = 'hrm_index').execute()
        config['models_configuration']['household_location_choice_model_for_1980'] = Configuration(
                                   config['models_configuration']['household_location_choice_model']
                                                                                                   )
        config['models_configuration']['household_location_choice_model_for_1980']['controller']['run']['arguments']['chunk_specification'] = "{'nchunks':1}"
        config['models_configuration']['household_location_choice_model_for_1980']['controller']['run']['arguments']['maximum_runs'] = 1
        config['models_configuration']['employment_relocation_model_for_1980'] = {}
        config['models_configuration']['employment_relocation_model_for_1980']['controller'] = \
                    EmploymentRelocationModelConfigurationCreator(
                               location_id_name = 'building_id',
                               probabilities = None,
                               rate_table=None,
                               output_index = 'erm_index').execute()"""

        if self.multiple_runs:
            from multiple_runs_modification import MultipleRunsModification

            MultipleRunsModification().modify_configuration(config)

        self.merge(config)
Example #5
0
    def __init__(self):
        config = UrbansimParcelConfiguration()
        if os.environ.has_key('OPUS_DATA_PATH'):
            data_path_prefix = os.path.join(os.environ['OPUS_DATA_PATH'],
                                            'psrc_parcel')
        else:
            data_path_prefix = os.path.join(os.environ['OPUS_HOME'],
                                            'data/psrc_parcel')

        config_changes = {
            'project_name':
            'psrc_parcel',
            'description':
            'PSRC parcel baseline',
            'cache_directory':
            os.path.join(data_path_prefix, 'base_year_data'),
            'creating_baseyear_cache_configuration':
            CreatingBaseyearCacheConfiguration(
                cache_directory_root=os.path.join(data_path_prefix, 'runs'),
                cache_from_database=False,
                baseyear_cache=BaseyearCacheConfiguration(
                    years_to_cache=[2000],
                    #existing_cache_to_copy = r'/urbansim_cache/psrc_parcel/runs/cache_hh_persons_init',
                    existing_cache_to_copy=os.path.join(
                        data_path_prefix, 'base_year_data'),
                ),
                cache_scenario_database=
                'urbansim.model_coordinators.cache_scenario_database',
                tables_to_cache=[
                    #'business',
                    'households',
                    'buildings',
                    'parcels',
                    'gridcells',
                    'zones',
                    "jobs",
                    "households_for_estimation",
                    "households_for_estimation_LAG1",
                    "jobs_for_estimation",
                    #"development_event_history",
                    "persons",
                    "persons_for_estimation",
                    "travel_data",
                    "building_types",
                    "job_building_types",
                    'urbansim_constants',
                    "target_vacancies",
                    "home_based_employment_location_choice_model_coefficients",
                    "home_based_employment_location_choice_model_specification",
                    "non_home_based_employment_location_choice_model_coefficients",
                    "non_home_based_employment_location_choice_model_specification",
                    "household_location_choice_model_coefficients",
                    "household_location_choice_model_specification",
                    "real_estate_price_model_coefficients",
                    "real_estate_price_model_specification",
                    "annual_household_control_totals",
                    "annual_relocation_rates_for_households",
                    "household_characteristics_for_ht",
                    "annual_employment_control_totals",
                    "annual_relocation_rates_for_jobs",
                    "land_use_types",
                    "generic_land_use_types",
                    'employment_sectors',
                    'employment_adhoc_sector_groups',
                    'employment_adhoc_sector_group_definitions',
                    'development_templates',
                    'development_template_components',
                    'development_constraints',
                    "building_sqft_per_job",
                    "fazes",
                    "large_areas",
                    "demolition_cost_per_sqft",
                    'constant_taz_columns',
                    'zipcodes',
                    'cities',
                    'districts',
                    'area_types',
                    "work_at_home_choice_model_coefficients",
                    "work_at_home_choice_model_specification",
                    "workplace_choice_model_for_resident_coefficients",
                    "workplace_choice_model_for_resident_specification",
                    "development_project_proposals",
                    "development_project_proposals_for_estimation",
                    "school_districts",
                    "tours",
                    ## some attribute coding lookup tables
                    "education",
                    "employment_status",
                    "grade",
                    "race_names",
                    "relationship",
                    "sex",
                    "student",
                ],
                tables_to_cache_nchunks={'parcels': 1},
                unroll_gridcells=False),
            'scenario_database_configuration':
            ScenarioDatabaseConfiguration(
                database_name='psrc_2005_parcel_baseyear',
                #database_name = 'psrc_2005_parcel_baseyear_change_20080804E',
                #database_name = 'psrc_2005_parcel_baseyear_change_lmwang',
            ),
            'dataset_pool_configuration':
            DatasetPoolConfiguration(package_order=[
                'psrc_parcel', 'urbansim_parcel', 'urbansim', 'opus_core'
            ], ),
            #            'models_configuration':models_configuration,
            'base_year':
            2000,
            'years': (2001, 2030),
            'models':
            [  # models are executed in the same order as in this list
                #"process_pipeline_events",
                "real_estate_price_model",
                "expected_sale_price_model",
                "development_proposal_choice_model",
                "building_construction_model",
                "modify_workers_jobs_after_moving_households",  # from demolished buildings
                "modify_workers_jobs_after_moving_jobs",  # from demolished buildings
                "household_transition_model",
                "employment_transition_model",
                'job_person_consistency_keeper',
                "household_relocation_model",
                "household_location_choice_model",
                "modify_workers_jobs_after_moving_households",
                "employment_relocation_model",
                #{"employment_location_choice_model":{'group_members': '_all_'}},
                {
                    "employment_location_choice_model": {
                        'group_members': ['non_home_based']
                    }
                },
                'distribute_unplaced_jobs_model',
                'distribute_unplaced_mining_utilities_jobs_model',
                "modify_workers_jobs_after_moving_jobs",
                'work_at_home_choice_model',
                'workplace_choice_model_for_resident'
            ],
            'models_in_year': {
                2000:
                [  # This is not run anymore, since all jobs are located and only a few households are not.
                    "household_relocation_model_for_2000",
                    "household_location_choice_model_for_2000",
                    "employment_relocation_model_for_2000", {
                        "employment_location_choice_model": {
                            'group_members': '_all_'
                        }
                    }
                ]
            },
            'flush_dataset_to_cache_after_each_model':
            False,
            'flush_variables':
            False,
            'low_memory_run':
            False,
            'datasets_to_cache_after_each_model': [
                "parcel",
                "building",
                'household',
                'job',
                'development_project_proposal_component',  #to be cached for diagnostic purpose (lmwang)
                'development_project_proposal',
                'travel_data',
                'persons'
            ],
            'unroll_gridcells':
            False,
            "datasets_to_preload": {
                'zone': {},
                'household': {},
                'building': {},
                'parcel': {
                    'package_name': 'urbansim_parcel'
                },
                'development_template': {
                    'package_name': 'urbansim_parcel'
                },
                'development_template_component': {
                    'package_name': 'urbansim_parcel'
                },
                'job': {},
                'person': {
                    'package_name': 'urbansim_parcel'
                },
                "building_type": {
                    'package_name': 'urbansim_parcel'
                },
                'travel_data': {},
                "job_building_type": {}
            }
        }
        config.replace(config_changes)

        config['models_configuration']["household_location_choice_model"]["controller"]["import"] = \
                {"psrc_parcel.models.household_location_choice_model" : "HouseholdLocationChoiceModel"}
        config['models_configuration']["employment_location_choice_model"]['controller']["import"] = \
                {"psrc_parcel.models.employment_location_choice_model" : "EmploymentLocationChoiceModel"}
        config['models_configuration']["home_based_employment_location_choice_model"]['controller']["import"] = \
                {"psrc_parcel.models.employment_location_choice_model" : "EmploymentLocationChoiceModel"}
        config['models_configuration'][
            'household_relocation_model_for_2000'] = {}
        config['models_configuration']['household_relocation_model_for_2000']['controller'] = \
                    HouseholdRelocationModelConfigurationCreator(
                               location_id_name = 'building_id',
                               probabilities = None,
                               rate_table=None,
                               output_index = 'hrm_index').execute()
        config['models_configuration'][
            'household_location_choice_model_for_2000'] = Configuration(
                config['models_configuration']
                ['household_location_choice_model'])
        config['models_configuration'][
            'household_location_choice_model_for_2000']['controller']['run'][
                'arguments']['chunk_specification'] = "{'nchunks':1}"
        config['models_configuration'][
            'household_location_choice_model_for_2000']['controller']['run'][
                'arguments']['maximum_runs'] = 1
        config['models_configuration'][
            'employment_relocation_model_for_2000'] = {}
        config['models_configuration']['employment_relocation_model_for_2000']['controller'] = \
                    EmploymentRelocationModelConfigurationCreator(
                               location_id_name = 'building_id',
                               probabilities = None,
                               rate_table=None,
                               output_index = 'erm_index').execute()

        self.merge(config)
        if self.multiple_runs:
            self.sample_inputs()
Example #6
0
    def __init__(self):
        opus_home = os.environ['OPUS_HOME']
        config = UrbansimParcelConfiguration()
        config_changes = {
            'project_name':
            'seattle_parcel',
            'description':
            'Seattle parcel baseline',
            'cache_directory':
            os.path.join(os.environ['OPUS_HOME'],
                         'data/vibe_parcel/base_year_data'),
            'creating_baseyear_cache_configuration':
            CreatingBaseyearCacheConfiguration(
                cache_directory_root=os.path.join(os.environ['OPUS_HOME'],
                                                  'data/vibe_parcel/runs'),
                cache_from_database=True,
                baseyear_cache=BaseyearCacheConfiguration(
                    existing_cache_to_copy=os.path.join(
                        os.environ['OPUS_HOME'],
                        'data/vibe_gridcell/base_year_data'), ),
                cache_scenario_database=
                'urbansim.model_coordinators.cache_scenario_database',
                tables_to_cache=[
                    'households', 'persons', 'buildings', 'parcels',
                    'gridcells', 'zones', "jobs", "households_for_estimation",
                    "jobs_for_estimation", "development_event_history",
                    "travel_data", "building_types", "job_building_types",
                    'urbansim_constants', "target_vacancies",
                    "home_based_employment_location_choice_model_coefficients",
                    "home_based_employment_location_choice_model_specification",
                    "non_home_based_employment_location_choice_model_coefficients",
                    "non_home_based_employment_location_choice_model_specification",
                    "household_location_choice_model_coefficients",
                    "household_location_choice_model_specification",
                    "real_estate_price_model_coefficients",
                    "real_estate_price_model_specification",
                    "annual_household_control_totals",
                    "annual_relocation_rates_for_households",
                    "household_characteristics_for_ht",
                    "annual_employment_control_totals",
                    "annual_relocation_rates_for_jobs", "land_use_types",
                    "generic_land_use_types", 'employment_sectors',
                    'employment_adhoc_sector_groups',
                    'employment_adhoc_sector_group_definitions',
                    'development_templates', 'development_template_components',
                    'development_constraints', "building_sqft_per_job",
                    "fazes", "large_areas", "demolition_cost_per_sqft",
                    'constant_taz_columns'
                ],
                tables_to_cache_nchunks={'parcels': 1},
                unroll_gridcells=False),
            'scenario_database_configuration':
            ScenarioDatabaseConfiguration(
                database_name='urbansim_export_test', ),
            'dataset_pool_configuration':
            DatasetPoolConfiguration(
                #package_order=['psrc_parcel', 'urbansim_parcel', 'urbansim', 'opus_core'],
                #),
                package_order=[
                    'psrc_parcel', 'urbansim_parcel', 'urbansim', 'opus_core'
                ], ),
            'base_year':
            1980,
            'years': (1981, 1985),
            'models':
            [  # models are executed in the same order as in this list
                #"process_pipeline_events", # uncomented by model
                "real_estate_price_model",
                "expected_sale_price_model",
                "development_proposal_choice_model",
                "building_construction_model",
                "household_transition_model",
                #"employment_transition_model",
                "household_relocation_model",
                "household_location_choice_model",
                #"employment_relocation_model",
                #{"employment_location_choice_model":{'group_members': '_all_'}},
                #'distribute_unplaced_jobs_model'
            ],
            'models_in_year': {
                1980:
                [  # This is not run anymore, since all jobs are located and only a few households are not.
                    "household_relocation_model_for_1980",
                    "household_location_choice_model_for_1980",
                    #"employment_relocation_model_for_1980",
                    #{"employment_location_choice_model":{'group_members': '_all_'}}
                ]
            },
            'flush_dataset_to_cache_after_each_model':
            False,
            'flush_variables':
            False,
            'low_memory_run':
            False,
            'datasets_to_cache_after_each_model': [
                "parcel",
                "building",
                'household',  #'job',
                'development_project_proposal_component',  #to be cached for diagnostic purpose (lmwang)
                'development_project_proposal',
                'travel_data'
            ],
            'unroll_gridcells':
            False,
            "datasets_to_preload": {
                'zone': {},
                'household': {},
                'building': {},
                'parcel': {
                    'package_name': 'urbansim_parcel'
                },
                'person': {
                    'package_name': 'urbansim_parcel'
                },
                'development_template': {
                    'package_name': 'urbansim_parcel'
                },
                'development_template_component': {
                    'package_name': 'urbansim_parcel'
                },
                #'job':{},
                "building_type": {
                    'package_name': 'urbansim_parcel'
                },
                'travel_data': {},
                #"job_building_type":{}
            }
        }
        config.replace(config_changes)
        '''config['models_configuration']["household_location_choice_model"]["controller"]["import"] = \
                {"psrc_parcel.models.household_location_choice_model" : "HouseholdLocationChoiceModel"}
        config['models_configuration']["employment_location_choice_model"]['controller']["import"] = \
                {"psrc_parcel.models.employment_location_choice_model" : "EmploymentLocationChoiceModel"}
        config['models_configuration']["home_based_employment_location_choice_model"]['controller']["import"] = \
                {"psrc_parcel.models.employment_location_choice_model" : "EmploymentLocationChoiceModel"}
        config['models_configuration']['household_relocation_model_for_1980'] = {}
        config['models_configuration']['household_relocation_model_for_1980']['controller'] = \
                    HouseholdRelocationModelConfigurationCreator(
                               location_id_name = 'building_id',
                               probabilities = None,
                               rate_table=None,
                               output_index = 'hrm_index').execute()
        config['models_configuration']['household_location_choice_model_for_1980'] = Configuration(
                                   config['models_configuration']['household_location_choice_model']
                                                                                                   )
        config['models_configuration']['household_location_choice_model_for_1980']['controller']['run']['arguments']['chunk_specification'] = "{'nchunks':1}"
        config['models_configuration']['household_location_choice_model_for_1980']['controller']['run']['arguments']['maximum_runs'] = 1
        config['models_configuration']['employment_relocation_model_for_1980'] = {}
        config['models_configuration']['employment_relocation_model_for_1980']['controller'] = \
                    EmploymentRelocationModelConfigurationCreator(
                               location_id_name = 'building_id',
                               probabilities = None,
                               rate_table=None,
                               output_index = 'erm_index').execute()'''

        if self.multiple_runs:
            from multiple_runs_modification import MultipleRunsModification
            MultipleRunsModification().modify_configuration(config)

        self.merge(config)
    def __init__(self):
        config = UrbansimParcelConfiguration()

        config_changes = {
            'description':
            'data preparation for PSRC parcel (buildings)',
            'cache_directory':
            None,
            'creating_baseyear_cache_configuration':
            CreatingBaseyearCacheConfiguration(
                #cache_directory_root = r'/Users/hana/urbansim_cache/psrc/parcel',
                cache_directory_root=r'/urbansim_cache/psrc_parcel',
                #cache_directory_root = r'/workspace/urbansim_cache/psrc_parcel',
                cache_from_database=False,
                baseyear_cache=BaseyearCacheConfiguration(
                    #existing_cache_to_copy = r'/Users/hana/urbansim_cache/psrc/cache_source_parcel',
                    existing_cache_to_copy=
                    r'/urbansim_cache/psrc_parcel/cache_source',
                    #existing_cache_to_copy = r'/workspace/urbansim_cache/psrc_parcel/estimation',
                    years_to_cache=[2000]),
                cache_scenario_database=
                'urbansim.model_coordinators.cache_scenario_database',
            ),
            'dataset_pool_configuration':
            DatasetPoolConfiguration(package_order=[
                'psrc_parcel', 'urbansim_parcel', 'urbansim', 'opus_core'
            ], ),
            'base_year':
            2000,
            'years': (2001, 2001),
            'models':
            [  # models are executed in the same order as in this list
                "expected_sale_price_model",
                "development_proposal_choice_model",
                "building_construction_model",
            ],
            "datasets_to_preload": {
                'zone': {},
                'household': {},
                'building': {},
                #'development_project_proposal': {}
            },
            "datasets_to_cache_after_each_model": [
                'parcel', 'building', 'development_project_proposal',
                'household', 'job'
            ]
        }
        #use configuration in config as defaults and merge with config_changes
        config.replace(config_changes)
        self.merge(config)
        self['models_configuration']['development_proposal_choice_model'][
            'controller']["import"] = {
                "psrc_parcel.models.development_proposal_sampling_model_by_zones":
                "DevelopmentProposalSamplingModelByZones"
            }
        self['models_configuration']['development_proposal_choice_model']['controller']["init"]["name"] =\
                        "DevelopmentProposalSamplingModelByZones"
        self['models_configuration']['development_proposal_choice_model'][
            'controller']['run']['arguments']["zones"] = 'zone'
        self['models_configuration']['development_proposal_choice_model'][
            'controller']['run']['arguments']["type"] = "'non_residential'"
        self['models_configuration']['expected_sale_price_model'][
            'controller']["init"]['arguments'][
                "filter_attribute"] = "'urbansim_parcel.development_project_proposal.is_size_fit'"
        self['models_configuration']['expected_sale_price_model']['controller']["prepare_for_run"]['arguments']["parcel_filter"] = \
            "'numpy.logical_and(numpy.logical_or(numpy.logical_not(urbansim_parcel.parcel.is_residential_land_use_type), numpy.logical_and(parcel.land_use_type_id==26, urbansim_parcel.parcel.is_non_residential_plan_type)), urbansim_parcel.parcel.vacant_land_area > 0)'"
        #"'numpy.logical_or(parcel.land_use_type_id==26, numpy.logical_and(urbansim_parcel.parcel.is_residential_land_use_type, urbansim_parcel.parcel.vacant_land_area > 0))'"
        self['models_configuration']['building_construction_model'][
            'controller']["run"]['arguments'][
                "consider_amount_built_in_parcels"] = False
        self['models_configuration']['building_construction_model'][
            'controller']['run']['arguments']["current_year"] = 2000
Example #8
0
    def __init__(self):
        config = UrbansimParcelConfiguration()
        data_path_prefix = paths.get_opus_data_path_path('psrc_parcel')
            
        config_changes = {
            'project_name':'psrc_parcel',
            'description':'PSRC parcel baseline',
            'cache_directory': os.path.join(data_path_prefix, 'base_year_data'),
            'creating_baseyear_cache_configuration':CreatingBaseyearCacheConfiguration(
               cache_directory_root = os.path.join(data_path_prefix, 'runs'),
                cache_from_database = False,
                baseyear_cache = BaseyearCacheConfiguration(
                    years_to_cache = [2000],
                    #existing_cache_to_copy = r'/urbansim_cache/psrc_parcel/runs/cache_hh_persons_init',
                    existing_cache_to_copy = os.path.join(data_path_prefix, 'base_year_data'),
                   ),
                cache_scenario_database = 'urbansim.model_coordinators.cache_scenario_database',
                tables_to_cache = [
                    #'business',
                    'households',
                    'buildings',
                    'parcels',
                    'gridcells',
                    'zones',
                    "jobs",
                    "households_for_estimation",
                    "households_for_estimation_LAG1",
                    "jobs_for_estimation",
                    #"development_event_history",
                    "persons",
                    "persons_for_estimation",
                    "travel_data",
                    "building_types",
                    "job_building_types",
                    'urbansim_constants',
                    "target_vacancies",
                    "home_based_employment_location_choice_model_coefficients",
                    "home_based_employment_location_choice_model_specification",
                    "non_home_based_employment_location_choice_model_coefficients",
                    "non_home_based_employment_location_choice_model_specification",
                    "household_location_choice_model_coefficients",
                    "household_location_choice_model_specification",
                    "real_estate_price_model_coefficients",
                    "real_estate_price_model_specification",
                    "annual_household_control_totals",
                    "annual_relocation_rates_for_households",
                    "household_characteristics_for_ht",
                    "annual_employment_control_totals",
                    "annual_relocation_rates_for_jobs",
                    "land_use_types",
                    "generic_land_use_types",
                    'employment_sectors',
                    'employment_adhoc_sector_groups',
                    'employment_adhoc_sector_group_definitions',
                    'development_templates',
                    'development_template_components',
                    'development_constraints',
                    "building_sqft_per_job",
                    "fazes",
                    "large_areas",
                    "demolition_cost_per_sqft",
                    'constant_taz_columns',
                    'zipcodes',
                    'cities',
                    'districts',
                    'area_types',
                    "work_at_home_choice_model_coefficients",
                    "work_at_home_choice_model_specification",
                    "workplace_choice_model_for_resident_coefficients",
                    "workplace_choice_model_for_resident_specification",
                    "development_project_proposals",
                    "development_project_proposals_for_estimation",
                    "school_districts",
                    "tours",
                    ## some attribute coding lookup tables
                    "education",
                    "employment_status",
                    "grade",
                    "race_names",
                    "relationship",
                    "sex",
                    "student",
                    ],
                tables_to_cache_nchunks={'parcels': 1},
                unroll_gridcells = False
                ),
            'scenario_database_configuration': ScenarioDatabaseConfiguration(
                database_name = 'psrc_2005_parcel_baseyear',
                #database_name = 'psrc_2005_parcel_baseyear_change_20080804E',
                #database_name = 'psrc_2005_parcel_baseyear_change_lmwang',
                ),
            'dataset_pool_configuration': DatasetPoolConfiguration(
                package_order=['psrc_parcel', 'urbansim_parcel', 'urbansim', 'opus_core'],
                ),
#            'models_configuration':models_configuration,

            'base_year':2000,
            'years':(2001, 2030),
            'models':[ # models are executed in the same order as in this list
                #"process_pipeline_events",
                "real_estate_price_model",
                "expected_sale_price_model",
                "development_proposal_choice_model",
                "building_construction_model",
                "modify_workers_jobs_after_moving_households", # from demolished buildings
                "modify_workers_jobs_after_moving_jobs", # from demolished buildings
                "household_transition_model",
                "employment_transition_model",
                'job_person_consistency_keeper',
                "household_relocation_model",
                "household_location_choice_model",
                "modify_workers_jobs_after_moving_households",
                "employment_relocation_model",
                #{"employment_location_choice_model":{'group_members': '_all_'}},
                {"employment_location_choice_model":{'group_members': ['non_home_based']}},
                'distribute_unplaced_jobs_model',
                'distribute_unplaced_mining_utilities_jobs_model',
                "modify_workers_jobs_after_moving_jobs",
                'work_at_home_choice_model',
                'workplace_choice_model_for_resident'
                ],
            'models_in_year': {2000: [ # This is not run anymore, since all jobs are located and only a few households are not.
                 "household_relocation_model_for_2000",
                "household_location_choice_model_for_2000",
                "employment_relocation_model_for_2000",
                {"employment_location_choice_model":{'group_members': '_all_'}}
                                       ]
                                       },
                'flush_dataset_to_cache_after_each_model':False,
                'flush_variables':False,
                'low_memory_run':False,
                'datasets_to_cache_after_each_model':["parcel", "building", 'household', 'job', 
                                                      'development_project_proposal_component',  #to be cached for diagnostic purpose (lmwang)
                                                      'development_project_proposal', 'travel_data', 'persons'],
                'unroll_gridcells':False,
                "datasets_to_preload":{
                    'zone':{},
                    'household':{},
                    'building':{},
                    'parcel':{'package_name':'urbansim_parcel'},
                    'development_template': {'package_name':'urbansim_parcel'},
                    'development_template_component': {'package_name':'urbansim_parcel'},
                    'job':{},
                    'person':{'package_name':'urbansim_parcel'},        
                    "building_type":{'package_name':'urbansim_parcel'},
                    'travel_data':{},
                    "job_building_type":{}
                }
        }
        config.replace(config_changes)

        config['models_configuration']["household_location_choice_model"]["controller"]["import"] = \
                {"psrc_parcel.models.household_location_choice_model" : "HouseholdLocationChoiceModel"}
        config['models_configuration']["employment_location_choice_model"]['controller']["import"] = \
                {"psrc_parcel.models.employment_location_choice_model" : "EmploymentLocationChoiceModel"}
        config['models_configuration']["home_based_employment_location_choice_model"]['controller']["import"] = \
                {"psrc_parcel.models.employment_location_choice_model" : "EmploymentLocationChoiceModel"}
        config['models_configuration']['household_relocation_model_for_2000'] = {}
        config['models_configuration']['household_relocation_model_for_2000']['controller'] = \
                    HouseholdRelocationModelConfigurationCreator(
                               location_id_name = 'building_id',
                               probabilities = None,
                               rate_table=None,
                               output_index = 'hrm_index').execute()
        config['models_configuration']['household_location_choice_model_for_2000'] = Configuration(
                                   config['models_configuration']['household_location_choice_model']                                        
                                                                                                   )
        config['models_configuration']['household_location_choice_model_for_2000']['controller']['run']['arguments']['chunk_specification'] = "{'nchunks':1}"
        config['models_configuration']['household_location_choice_model_for_2000']['controller']['run']['arguments']['maximum_runs'] = 1
        config['models_configuration']['employment_relocation_model_for_2000'] = {}
        config['models_configuration']['employment_relocation_model_for_2000']['controller'] = \
                    EmploymentRelocationModelConfigurationCreator(
                               location_id_name = 'building_id',
                               probabilities = None,
                               rate_table=None,
                               output_index = 'erm_index').execute()
 
        self.merge(config)
        if self.multiple_runs:
            self.sample_inputs()
Example #9
0
    def __init__(self):
        opus_home = os.environ['OPUS_HOME']
        config = UrbansimParcelConfiguration()
        config_changes = {
            'project_name':'seattle_parcel',
            'description':'Seattle parcel baseline',
            'cache_directory':  os.path.join(opus_home, 'data/seattle_parcel/base_year_data'),
            'creating_baseyear_cache_configuration':CreatingBaseyearCacheConfiguration(
            cache_directory_root = os.path.join(opus_home, 'data/seattle_parcel/runs'),
                cache_from_database = False,
                baseyear_cache = BaseyearCacheConfiguration(
		    existing_cache_to_copy =  os.path.join(os.environ['OPUS_HOME'], 'data/seattle_parcel/base_year_data'),
                    #existing_cache_to_copy = r'/Users/borning/opus_home/data/seattle_parcel/base_year_data',
                    ),
                cache_scenario_database = 'urbansim.model_coordinators.cache_scenario_database',
                tables_to_cache = [
                    'households',
                    'persons',
                    'buildings',
                    'parcels',
                    'gridcells',
                    'zones',
                    "jobs",
                    "households_for_estimation",
                    "jobs_for_estimation",
                    "development_event_history",
                    "travel_data",
                    "building_types",
                    "job_building_types",
                    'urbansim_constants',
                    "target_vacancies",
                    "home_based_employment_location_choice_model_coefficients",
                    "home_based_employment_location_choice_model_specification",
                    "non_home_based_employment_location_choice_model_coefficients",
                    "non_home_based_employment_location_choice_model_specification",
                    "household_location_choice_model_coefficients",
                    "household_location_choice_model_specification",
                    "real_estate_price_model_coefficients",
                    "real_estate_price_model_specification",
                    "annual_household_control_totals",
                    "annual_relocation_rates_for_households",
                    "household_characteristics_for_ht",
                    "annual_employment_control_totals",
                    "annual_relocation_rates_for_jobs",
                    "land_use_types",
                    "generic_land_use_types",
                    'employment_sectors',
                    'employment_adhoc_sector_groups',
                    'employment_adhoc_sector_group_definitions',
                    'development_templates',
                    'development_template_components',
                    'development_constraints',
                    "building_sqft_per_job",
                    "fazes",
                    "large_areas",
                    "demolition_cost_per_sqft",
                    'constant_taz_columns'
                    ],
                tables_to_cache_nchunks={'parcels': 1},
                unroll_gridcells = False
                ),
            'scenario_database_configuration': ScenarioDatabaseConfiguration(
                database_name = 'seattle_2000_parcel_baseyear_data',
                ),
            'dataset_pool_configuration': DatasetPoolConfiguration(
                package_order=['psrc_parcel', 'urbansim_parcel', 'urbansim', 'opus_core'],
                ),

            'base_year':2000,
            'years':(2001, 2006),
            'models':[ # models are executed in the same order as in this list
                #"process_pipeline_events",
                "real_estate_price_model",
                "expected_sale_price_model",
                "development_proposal_choice_model",
                "building_construction_model",
                "household_transition_model",
                "employment_transition_model",
                "household_relocation_model",
                "household_location_choice_model",
                "employment_relocation_model",
                {"employment_location_choice_model":{'group_members': '_all_'}},
                'distribute_unplaced_jobs_model'
                ],
            'models_in_year': {2000: [ # This is not run anymore, since all jobs are located and only a few households are not.
                 "household_relocation_model_for_2000",
                "household_location_choice_model_for_2000",
                "employment_relocation_model_for_2000",
                {"employment_location_choice_model":{'group_members': '_all_'}}
                                       ]
                                       },
                'flush_dataset_to_cache_after_each_model':False,
                'flush_variables':False,
                'low_memory_run':False,
                'datasets_to_cache_after_each_model':["parcel", "building", 'household', 'job',
                                                      'development_project_proposal_component',  #to be cached for diagnostic purpose (lmwang)
                                                      'development_project_proposal', 'travel_data'],
                'unroll_gridcells':False,
                "datasets_to_preload":{
                    'zone':{},
                    'household':{},
                    'building':{},
                    'parcel':{'package_name':'urbansim_parcel'},
                    'person':{'package_name':'urbansim_parcel'},
                    'development_template': {'package_name':'urbansim_parcel'},
                    'development_template_component': {'package_name':'urbansim_parcel'},
                    'job':{},
                    "building_type":{'package_name':'urbansim_parcel'},
                    'travel_data':{},
                    "job_building_type":{}
                }
        }
        config.replace(config_changes)

        config['models_configuration']["household_location_choice_model"]["controller"]["import"] = \
                {"psrc_parcel.models.household_location_choice_model" : "HouseholdLocationChoiceModel"}
        config['models_configuration']["employment_location_choice_model"]['controller']["import"] = \
                {"psrc_parcel.models.employment_location_choice_model" : "EmploymentLocationChoiceModel"}
        config['models_configuration']["home_based_employment_location_choice_model"]['controller']["import"] = \
                {"psrc_parcel.models.employment_location_choice_model" : "EmploymentLocationChoiceModel"}
        config['models_configuration']['household_relocation_model_for_2000'] = {}
        config['models_configuration']['household_relocation_model_for_2000']['controller'] = \
                    HouseholdRelocationModelConfigurationCreator(
                               location_id_name = 'building_id',
                               probabilities = None,
                               rate_table=None,
                               output_index = 'hrm_index').execute()
        config['models_configuration']['household_location_choice_model_for_2000'] = Configuration(
                                   config['models_configuration']['household_location_choice_model']
                                                                                                   )
        config['models_configuration']['household_location_choice_model_for_2000']['controller']['run']['arguments']['chunk_specification'] = "{'nchunks':1}"
        config['models_configuration']['household_location_choice_model_for_2000']['controller']['run']['arguments']['maximum_runs'] = 1
        config['models_configuration']['employment_relocation_model_for_2000'] = {}
        config['models_configuration']['employment_relocation_model_for_2000']['controller'] = \
                    EmploymentRelocationModelConfigurationCreator(
                               location_id_name = 'building_id',
                               probabilities = None,
                               rate_table=None,
                               output_index = 'erm_index').execute()

        if self.multiple_runs:
            from multiple_runs_modification import MultipleRunsModification
            MultipleRunsModification().modify_configuration(config)

        self.merge(config)
    def __init__(self):
        config = UrbansimParcelConfiguration()

        config_changes = {
            'description':
            'data preparation for PSRC parcel (households)',
            'cache_directory':
            None,
            'creating_baseyear_cache_configuration':
            CreatingBaseyearCacheConfiguration(
                cache_directory_root=r'/Users/hana/urbansim_cache/psrc/parcel',
                #cache_directory_root = r'/urbansim_cache/psrc_parcel',
                #cache_directory_root = r'/workspace/urbansim_cache/psrc_parcel',
                cache_from_database=False,
                baseyear_cache=BaseyearCacheConfiguration(
                    existing_cache_to_copy=
                    r'/Users/hana/urbansim_cache/psrc/cache_source_parcel',
                    #existing_cache_to_copy = r'/urbansim_cache/psrc_parcel/cache_source',
                    #existing_cache_to_copy = r'/workspace/urbansim_cache/psrc_parcel/estimation',
                    years_to_cache=[2000]),
                cache_scenario_database=
                'urbansim.model_coordinators.cache_scenario_database',
            ),
            'dataset_pool_configuration':
            DatasetPoolConfiguration(package_order=[
                'psrc_parcel', 'urbansim_parcel', 'urbansim', 'opus_core'
            ], ),
            'base_year':
            2000,
            'years': (2001, 2001),
            'models':
            [  # models are executed in the same order as in this list
                "household_relocation_model",
                "household_location_choice_model",
            ],
            "datasets_to_preload": {
                'zone': {},
                'household': {},
                'building': {}
            }
        }
        #use configuration in config as defaults and merge with config_changes
        config.replace(config_changes)
        self.merge(config)
        self['models_configuration']['household_location_choice_model'] = {}
        self['models_configuration']['household_location_choice_model']['controller'] = \
                   HouseholdLocationChoiceModelByZonesConfigurationCreator(
                                location_set = "building",
                                sampler = None,
                                input_index = 'hrm_index',
                                capacity_string = "urbansim_parcel.building.vacant_residential_units",
                                number_of_units_string = None,
                                nchunks=1,
                                lottery_max_iterations=20
                                ).execute()
        self['models_configuration']['household_relocation_model']['controller'] = \
                    HouseholdRelocationModelConfigurationCreator(
                               location_id_name = 'building_id',
                               probabilities = None,
                               rate_table=None,
                               output_index = 'hrm_index').execute()