Ejemplo n.º 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()
Ejemplo n.º 2
0
 def __init__(self):
     config = AbstractUrbansimConfiguration()
     db_server = DatabaseServer(ScenarioDatabaseConfiguration())
     db = db_server.get_database('PSRC_2000_baseyear')
     config_changes = {
         'description':
         'baseline with no travel model',
         'in_storage':
         StorageFactory().get_storage('sql_storage', storage_location=db),
         'cache_directory':
         None,  ### TODO: Set this cache_directory to something useful.
         'creating_baseyear_cache_configuration':
         CreatingBaseyearCacheConfiguration(
             cache_directory_root='c:/urbansim_cache',
             cache_from_database=True,
             cache_scenario_database=
             'urbansim.model_coordinators.cache_scenario_database',
             tables_to_cache=[
                 'annual_employment_control_totals',
                 'annual_household_control_totals', 'buildings',
                 'building_types', 'development_event_history', 'gridcells',
                 'households', 'job_building_types', 'jobs', 'travel_data',
                 'zones', 'counties',
                 'commercial_development_location_choice_model_coefficients',
                 'commercial_development_location_choice_model_specification',
                 'commercial_employment_location_choice_model_coefficients',
                 'commercial_employment_location_choice_model_specification',
                 'home_based_employment_location_choice_model_specification',
                 'home_based_employment_location_choice_model_coefficients',
                 'industrial_employment_location_choice_model_coefficients',
                 'industrial_employment_location_choice_model_specification',
                 'industrial_development_location_choice_model_coefficients',
                 'industrial_development_location_choice_model_specification',
                 'residential_development_location_choice_model_coefficients',
                 'residential_development_location_choice_model_specification',
                 'fazes', 'urbansim_constants',
                 'household_location_choice_model_coefficients',
                 'household_location_choice_model_specification',
                 'land_price_model_coefficients',
                 'land_price_model_specification',
                 'residential_land_share_model_coefficients',
                 'residential_land_share_model_specification',
                 'plan_type_group_definitions', 'plan_type_groups',
                 'large_areas', 'household_characteristics_for_ht',
                 'development_types', 'development_type_group_definitions',
                 'development_constraints',
                 'annual_relocation_rates_for_households',
                 'annual_relocation_rates_for_jobs', 'base_year', 'cities',
                 'development_events', 'development_type_groups',
                 'employment_adhoc_sector_group_definitions',
                 'employment_adhoc_sector_groups', 'employment_events',
                 'employment_sectors', 'land_use_events', 'plan_types',
                 'race_names', 'target_vacancies', 'jobs_for_estimation',
                 'households_for_estimation',
                 'development_events_exogenous', 'job_building_types'
             ],
             tables_to_cache_nchunks={'gridcells': 1},
             tables_to_copy_to_previous_years={
                 'development_type_groups': 1995,
                 'development_types': 1995,
                 'development_type_group_definitions': 1995,
                 'urbansim_constants': 1995,
             },
         ),
         'scenario_database_configuration':
         ScenarioDatabaseConfiguration(
             database_name='PSRC_2000_baseyear', ),
         'base_year':
         2000,
         'years': (2001, 2030),
     }
     config.merge(config_changes)
     self.merge(config)
 'creating_baseyear_cache_configuration':CreatingBaseyearCacheConfiguration(
     cache_directory_root = 'e:/urbansim_cache',
     cache_scenario_database = 'urbansim.model_coordinators.cache_scenario_database',
     tables_to_cache = [
         'annual_employment_control_totals',
         'annual_household_control_totals',
         'buildings',
         'building_types',
         'development_event_history',
         'gridcells',
         'households',
         'job_building_types',
         'jobs',
         'travel_data',
         'zones',
         'counties',
         'commercial_development_location_choice_model_coefficients',
         'commercial_development_location_choice_model_specification',
         'commercial_employment_location_choice_model_coefficients',
         'commercial_employment_location_choice_model_specification',
         'home_based_employment_location_choice_model_specification',
         'home_based_employment_location_choice_model_coefficients',
         'industrial_employment_location_choice_model_coefficients',
         'industrial_employment_location_choice_model_specification',
         'industrial_development_location_choice_model_coefficients',
         'industrial_development_location_choice_model_specification',
         'residential_development_location_choice_model_coefficients',
         'residential_development_location_choice_model_specification',
         'fazes',
         'urbansim_constants',
         'household_location_choice_model_coefficients',
         'household_location_choice_model_specification',
         'land_price_model_coefficients',
         'land_price_model_specification',
         'residential_land_share_model_coefficients',
         'residential_land_share_model_specification',
         'plan_type_group_definitions',
         'plan_type_groups',
         'large_areas',
         'household_characteristics_for_ht',
         'development_types',
         'development_type_group_definitions',
         'development_constraints',
         'annual_relocation_rates_for_households',
         'annual_relocation_rates_for_jobs',
         'base_year',
         'cities',
         'development_events',
         'development_type_groups',
         'employment_adhoc_sector_group_definitions',
         'employment_adhoc_sector_groups',
         'employment_events',
         'employment_sectors',
         'land_use_events',
         'plan_types',
         'race_names',
         'target_vacancies',
         'jobs_for_estimation',
         'households_for_estimation',
         'development_events_exogenous',
         'job_building_types'
         ],
     # The default chunk sizes cause an out-of-memory problem at PSRC,
     # so reduce the amount of memory for different actions.
     tables_to_cache_nchunks = {'gridcells': 5},
     tables_to_copy_to_previous_years = {},
     ),
    def __init__(self):
        config = AbstractUrbansimConfiguration()
        db_server = DatabaseServer(ScenarioDatabaseConfiguration())
        db = db_server.get_database('PSRC_2000_baseyear')

        config_changes = {
            'description':
            'baseline with travel model',
            'in_storage':
            StorageFactory().get_storage('sql_storage', storage_location=db),
            'cache_directory':
            None,  ### TODO: Set this cache_directory to something useful.
            'creating_baseyear_cache_configuration':
            CreatingBaseyearCacheConfiguration(
                cache_directory_root='d:/urbansim_cache',
                cache_from_database=True,
                baseyear_cache=BaseyearCacheConfiguration(
                    r'D:\urbansim_cache\run_1417.2006_12_08_01_50'),
                cache_scenario_database=
                'urbansim.model_coordinators.cache_scenario_database',
                tables_to_cache=[
                    'annual_employment_control_totals',
                    'annual_household_control_totals', 'buildings',
                    'building_types', 'development_event_history', 'gridcells',
                    'households', 'job_building_types', 'jobs', 'travel_data',
                    'zones', 'counties',
                    'commercial_development_location_choice_model_coefficients',
                    'commercial_development_location_choice_model_specification',
                    'commercial_employment_location_choice_model_coefficients',
                    'commercial_employment_location_choice_model_specification',
                    'home_based_employment_location_choice_model_specification',
                    'home_based_employment_location_choice_model_coefficients',
                    'industrial_employment_location_choice_model_coefficients',
                    'industrial_employment_location_choice_model_specification',
                    'industrial_development_location_choice_model_coefficients',
                    'industrial_development_location_choice_model_specification',
                    'residential_development_location_choice_model_coefficients',
                    'residential_development_location_choice_model_specification',
                    'fazes', 'urbansim_constants',
                    'household_location_choice_model_coefficients',
                    'household_location_choice_model_specification',
                    'land_price_model_coefficients',
                    'land_price_model_specification',
                    'residential_land_share_model_coefficients',
                    'residential_land_share_model_specification',
                    'plan_type_group_definitions', 'plan_type_groups',
                    'large_areas', 'household_characteristics_for_ht',
                    'development_types', 'development_type_group_definitions',
                    'development_constraints',
                    'annual_relocation_rates_for_households',
                    'annual_relocation_rates_for_jobs', 'base_year', 'cities',
                    'development_events', 'development_type_groups',
                    'employment_adhoc_sector_group_definitions',
                    'employment_adhoc_sector_groups', 'employment_events',
                    'employment_sectors', 'land_use_events', 'plan_types',
                    'race_names', 'target_vacancies', 'jobs_for_estimation',
                    'households_for_estimation',
                    'development_events_exogenous', 'job_building_types'
                ],
                tables_to_cache_nchunks={'gridcells': 4},
                tables_to_copy_to_previous_years={
                    'development_type_groups': 1995,
                    'development_types': 1995,
                    'development_type_group_definitions': 1995,
                },
            ),
            'models': [],  # run no urbansim models
            'scenario_database_configuration':
            ScenarioDatabaseConfiguration(
                database_name='PSRC_2000_baseyear', ),
            'base_year':
            2000,
            'years': (2001, 2001),
            'unroll_gridcells':
            False
        }
        config.merge(config_changes)

        travel_model_config = create_travel_model_configuration(
            'baseline_travel_model_psrc_fresh',
            mode='get_emme2_data_after_run',
            years_to_run={2001: '2000_06'},
            emme2_batch_file='QUICKRUN.BAT')
        config['travel_model_configuration'] = travel_model_config
        self.merge(config)