def __my_configuration(self): tables_to_cache = [ # 'business', 'households', 'buildings', 'parcels', 'zones', # "households_for_estimation" ] return { 'cache_directory' : r'/home/lmwang/work/sf/cache_source_0125', # change or leave out 'creating_baseyear_cache_configuration':CreatingBaseyearCacheConfiguration( # cache_directory_root = '/tmp/urbcache/sandbox_runs/estimation', unroll_gridcells = False, cache_from_database = True, baseyear_cache = BaseyearCacheConfiguration( existing_cache_to_copy = r'/urbansim_cache/sanfrancisco/cache_source', ), cache_scenario_database = 'urbansim.model_coordinators.cache_scenario_database', tables_to_cache = tables_to_cache, tables_to_copy_to_previous_years = {}, ), 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name = 'sanfrancisco_baseyear_start', ), 'estimation_database_configuration': EstimationDatabaseConfiguration( database_name = 'sanfrancisco_baseyear_change_20080121', ), 'dataset_pool_configuration': DatasetPoolConfiguration( package_order=['sanfrancisco', 'urbansim', 'opus_core'], ), 'base_year': 2001, }
def __my_configuration(self): tables_to_cache = Baseline( )['creating_baseyear_cache_configuration'].tables_to_cache tables_to_cache.append('workers_for_estimation') return { 'cache_directory': 'D:/urbansim_cache/psrc/estimation', # change or leave out 'creating_baseyear_cache_configuration': CreatingBaseyearCacheConfiguration( # cache_directory_root = '/tmp/urbcache/sandbox_runs/estimation', unroll_gridcells=True, cache_from_database=True, baseyear_cache=BaseyearCacheConfiguration( existing_cache_to_copy=r'D:/urbansim_cache/full_psrc', ), cache_scenario_database= 'urbansim.model_coordinators.cache_scenario_database', tables_to_cache=tables_to_cache, tables_to_cache_nchunks={ 'parcels': 4, 'gridcells': 5 }, tables_to_copy_to_previous_years={}, ), 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name='GSPSRC_2000_baseyear_change_20070102', ), 'dataset_pool_configuration': DatasetPoolConfiguration( package_order=['psrc', 'urbansim', 'opus_core'], ), 'base_year': 2000, }
def get(self, database): db_config = ScenarioDatabaseConfiguration() db_server = DatabaseServer(db_config) db = db_server.get_database(database) storage = StorageFactory().get_storage('sql_storage', storage_location=db) return storage
def __init__(self): Baseline.__init__(self) self['config_changes_for_estimation'] = ConfigChangesForEstimation() self['cache_directory'] = os.path.join(os.environ['OPUS_HOME'], 'data/eugene_zone/base_year_data') self['scenario_database_configuration'] = ScenarioDatabaseConfiguration(database_name = 'eugene_1980_baseyear_zone') self['estimation_database_configuration'] = EstimationDatabaseConfiguration(database_name = 'eugene_1980_baseyear_zone') self['datasets_to_cache_after_each_model' ] = [] self['low_memory_mode'] = False self['base_year'] = 1980 self['years'] = (1980,1980) self['seed'] = 1
def __init__( self, cache_directory, year, travel_model_data_directory='baseline_travel_model_psrc_baseline'): config = AbstractUrbansimConfiguration() config_changes = { 'description': 'baseline with travel model', 'cache_directory': cache_directory, 'creating_baseyear_cache_configuration': CreatingBaseyearCacheConfiguration( cache_scenario_database= 'urbansim.model_coordinators.cache_scenario_database', unroll_gridcells=False, tables_to_cache=[], tables_to_copy_to_previous_years={}, ), 'models': [], # run no urbansim models 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name='PSRC_2000_baseyear', ), 'base_year': year, 'years': (year, year), } config.merge(config_changes) years_to_run = { 2005: '2000_06', 2010: '2010_06', 2015: '2010_06', 2020: '2020_06', 2025: '2020_06', 2030: '2030_06', } year_to_run = {year: years_to_run[year]} travel_model_config = create_travel_model_configuration( travel_model_data_directory, mode='get_emme2_data_after_run', years_to_run=year_to_run, emme2_batch_file='QUICKRUN.BAT') config['travel_model_configuration'] = travel_model_config self.merge(config)
def __my_configuration(self): tables_to_cache = ['business', 'households', 'buildings', 'development_event_history', 'target_vacancies', 'annual_household_control_totals', 'annual_business_control_totals', 'annual_relocation_rates_for_business', 'annual_relocation_rates_for_households', 'household_characteristics_for_ht', 'parcels', 'zones', "tracts", "households_for_estimation", "business_for_estimation", "persons", "travel_data", "annual_relocation_rates_for_business", "buildings_for_estimation", "building_use", "building_use_classification", 'urbansim_constants' ] return { 'cache_directory' : r'/urbansim_cache/sanfrancisco/cache_source', # change or leave out 'creating_baseyear_cache_configuration':CreatingBaseyearCacheConfiguration( # cache_directory_root = '/tmp/urbcache/sandbox_runs/estimation', unroll_gridcells = False, cache_from_database = True, baseyear_cache = BaseyearCacheConfiguration( existing_cache_to_copy = r'/urbansim_cache/sanfrancisco/cache_source', ), cache_scenario_database = 'urbansim.model_coordinators.cache_scenario_database', tables_to_cache = tables_to_cache, tables_to_copy_to_previous_years = {}, ), 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name = 'sanfrancisco_baseyear', ), 'dataset_pool_configuration': DatasetPoolConfiguration( package_order=['sanfrancisco', 'urbansim', 'opus_core'], ), 'base_year': 2001, }
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE from psrc.configs.subset_configuration import SubsetConfiguration from opus_core.database_management.flatten_scenario_database_chain \ import FlattenScenarioDatabaseChain from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration """ This utility creates, on localhost, a flattened copy of the subset test database chain located on trondheim.. """ server_config_to = ScenarioDatabaseConfiguration() server_config_from = ScenarioDatabaseConfiguration() run_configuration = SubsetConfiguration() from_database_configuration = ScenarioDatabaseConfiguration( database_name=run_configuration['scenario_database_configuration']. database_name) to_database_configuration = ScenarioDatabaseConfiguration( database_name=run_configuration['scenario_database_configuration']. database_name) tables_to_copy = run_configuration[ 'creating_baseyear_cache_configuration'].tables_to_cache copier = FlattenScenarioDatabaseChain() copier.copy_scenario_database( from_database_configuration=from_database_configuration, to_database_configuration=to_database_configuration, tables_to_copy=tables_to_copy)
'job_id': array(job_ids), }, ) persons = PersonDataset(in_storage=in_storage, in_table_name=persons_table_name) persons.write_dataset(out_storage=out_storage, out_table_name=persons_table_name) if __name__ == '__main__': config = Baseline() config.replace( { 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name='psrc_2005_parcel_baseyear', ), 'estimation_database_configuration': EstimationDatabaseConfiguration( database_name='psrc_2005_parcel_baseyear_change_20080219', ), 'dataset_pool_configuration': DatasetPoolConfiguration( package_order=['urbansim_parcel', 'urbansim', 'opus_core'], ), 'low_memory_mode': False, 'cache_directory': '/urbansim_cache/psrc_parcel/persons', 'debuglevel': 7, 'base_year': 2000, 'years': (2000, 2000),
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE import os from opus_core.storage_factory import StorageFactory from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration from opus_core.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration from urbansim.configs.base_configuration import AbstractUrbansimConfiguration from urbansim.configurations.creating_baseyear_cache_configuration import CreatingBaseyearCacheConfiguration from opus_core.database_management.database_server import DatabaseServer config = AbstractUrbansimConfiguration() db_server = DatabaseServer(ScenarioDatabaseConfiguration()) db = db_server.get_database('PSRC_2000_scenario_E_constrained_king_county') config_changes = { 'description': 'constrained king county capacity baseline with full 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, cache_scenario_database= 'urbansim.model_coordinators.cache_scenario_database',
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()
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)
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE import os from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration from opus_core.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration from opus_core.configurations.baseyear_cache_configuration import BaseyearCacheConfiguration my_configuration = { 'cache_directory': '/urbansim_cache/vibe_min', # change or leave out 'scenario_database_configuration': ScenarioDatabaseConfiguration(database_name='urbansim_export_test', ), 'estimation_database_configuration': EstimationDatabaseConfiguration( database_name='eugene_1980_baseyear_estimation', ), 'datasets_to_cache_after_each_model': [], 'low_memory_mode': False, 'base_year': 1980, 'years': (1980, 1980), 'seed': 10, #(10,10) }
cache_from_database=False, unroll_gridcells=False, baseyear_cache=BaseyearCacheConfiguration( existing_cache_to_copy= '/Users/hana/urbansim_cache/washtenaw/cache_source', #years_to_cache = range(2005,2006) ), cache_scenario_database= 'urbansim.model_coordinators.cache_scenario_database', tables_to_cache=Baseline.tables_to_cache, tables_to_copy_to_previous_years=Baseline.tables_to_copy_to_previous_years, ) my_configuration = { 'scenario_database_configuration': ScenarioDatabaseConfiguration(database_name='region_pilot_baseyear', ), # 'models': [ #'prescheduled_events', #'events_coordinator', #'residential_land_share_model', #'land_price_model', #'development_project_transition_model', #'residential_development_project_location_choice_model', #'commercial_development_project_location_choice_model', #'industrial_development_project_location_choice_model', #'development_event_transition_model', #'events_coordinator', #'residential_land_share_model', # 'deletion_event_model', #'regional_household_transition_model', #'regional_household_relocation_model',
def __my_configuration(self): tables_to_cache = [ 'households', 'buildings', 'parcels', 'gridcells', 'zones', "jobs", "households_for_estimation", "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', 'tours', 'households_2001', ] return { 'cache_directory': '/urbansim_cache/psrc_parcel/developer_model', # change or leave out #'cache_directory' : '/workspace/urbansim_cache/psrc_parcel_lmwang/estimation/', 'creating_baseyear_cache_configuration': CreatingBaseyearCacheConfiguration( # cache_directory_root = '/tmp/urbcache/sandbox_runs/estimation', unroll_gridcells=False, cache_from_database=True, baseyear_cache=BaseyearCacheConfiguration( existing_cache_to_copy= r'/urbansim_cache/psrc_parcel_2005/cache_source', ), cache_scenario_database= 'urbansim.model_coordinators.cache_scenario_database', tables_to_cache=tables_to_cache, tables_to_cache_nchunks={ 'parcels': 4, 'buildings': 5 }, tables_to_copy_to_previous_years={}, ), 'scenario_database_configuration': ScenarioDatabaseConfiguration( #database_name = 'psrc_2005_parcel_baseyear_change_20070608', database_name='psrc_2005_parcel_baseyear_change_20080622_2006', ), 'dataset_pool_configuration': DatasetPoolConfiguration(package_order=[ 'psrc_parcel', 'urbansim_parcel', 'urbansim', 'opus_core' ], ), 'base_year': 2006, }
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE import os from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration from opus_core.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration from psrc.configs.baseline_without_travel_model import run_configuration as config run_configuration = config.copy() run_configuration[ 'scenario_database_configuration'] = ScenarioDatabaseConfiguration( database_name='PSRC_2000_baseyear_sampled_10_percent', ), run_configuration['datasets_to_cache_after_each_model'] = []
def __my_configuration(self): # tables_to_cache = Baseline()['creating_baseyear_cache_configuration'].tables_to_cache tables_to_cache =[ #'development_event_history', 'edges', 'parcels', 'gridcells', 'households', 'households_for_estimation', 'jobs', 'travel_data', 'persons', #need to cache 'persons_for_estimation', 'zones', 'cities', 'buildings', 'building_types', 'urbansim_constants', 'job_building_types', 'tours', #'land_price_model_coefficients', #'land_price_model_specification',] ] return { 'cache_directory' : 'C:/tmp/urbansim_cache/psrc_parcel', # change or leave out 'creating_baseyear_cache_configuration':CreatingBaseyearCacheConfiguration( # cache_directory_root = '/tmp/urbcache/sandbox_runs/estimation', unroll_gridcells = False, cache_from_database = True, baseyear_cache = BaseyearCacheConfiguration( existing_cache_to_copy = r'D:/urbansim_cache/full_psrc', ), cache_scenario_database = 'urbansim.model_coordinators.cache_scenario_database', tables_to_cache = tables_to_cache, tables_to_cache_nchunks = { 'parcels':8, 'gridcells':5, 'buildings':10, }, # tables_to_copy_to_previous_years = { # 'development_type_groups': 1995, # 'development_types': 1995, # 'development_type_group_definitions': 1995, # 'development_constraints': 1995, # 'urbansim_constants': 1995, # }, ), 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name = "psrc_activity2006_ver2" # 2006 PSRC Activity Survey for households_for_estimation, ), 'estimation_database_configuration':EstimationDatabaseConfiguration( database_name = 'PSRC_2000_parcels_estimation_output', ), 'dataset_pool_configuration': DatasetPoolConfiguration( package_order=['psrc', 'urbansim', 'opus_core'], ), 'base_year': 2000, 'years': (2000,2000), 'datasets_to_preload' :{ 'gridcell':{ 'package_name':'urbansim', 'nchunks':2, }, 'parcel':{ 'package_name':'psrc', 'nchunks':3, }, 'household':{ 'package_name':'urbansim', }, 'person':{ 'package_name':'psrc', }, 'zone':{ 'package_name':'urbansim', }, 'travel_data':{ 'package_name':'urbansim', }, 'building':{ 'package_name':'urbansim', }, # 'edge':{ # 'package_name':'transit_accessibility', # } }, 'seed':1,#(1,1) }
"home_based_choice_model_specification", "home_based_workplace_choice_model_coefficients", "home_based_workplace_choice_model_specification", "workplace_location_choice_model_for_resident_specification", "workplace_location_choice_model_for_resident_coefficients", "workplace_location_choice_model_for_immigrant_specification", "workplace_location_choice_model_for_immigrant_coefficients", ], 'unroll_gridcells': False, 'tables_to_cache_nchunks': { 'gridcells': 4, }, }, 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name='GSPSRC_2000_baseyear_change_20060924_wlcm_init', ), 'datasets_to_cache_after_each_model': ['person'], 'low_memory_mode': True, 'base_year': 2000, 'years': (2001, 2001), "datasets_to_preload": { 'gridcell': {}, 'job': {}, 'person': { 'package_name': 'psrc' }, 'zone': {}, 'household': {}, }
def __init__(self): from copy import deepcopy config = deepcopy(AbstractUrbansimConfiguration()) cache_directory = os.path.join(package().get_opus_core_path(), 'data', 'test_cache') config_changes = { 'description': 'Test cache', 'base_year': 1980, 'years': (1981, 1982), 'models': [ 'prescheduled_events', 'events_coordinator', 'residential_land_share_model', 'land_price_model', 'development_project_transition_model', 'residential_development_project_location_choice_model', 'commercial_development_project_location_choice_model', 'industrial_development_project_location_choice_model', 'development_event_transition_model', 'events_coordinator', 'residential_land_share_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', ], 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name='eugene_1980_baseyear', ), 'cache_directory': cache_directory, 'creating_baseyear_cache_configuration': CreatingBaseyearCacheConfiguration( cache_directory_root='c:/urbansim_cache', cache_from_database=False, baseyear_cache=BaseyearCacheConfiguration( existing_cache_to_copy=cache_directory, ), 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_sectors', 'plan_types', 'race_names', 'target_vacancies' #'jobs_for_estimation', #'households_for_estimation', #'development_events_exogenous', ], tables_to_cache_nchunks={'gridcells': 1}, tables_to_copy_to_previous_years={ 'development_type_group_definitions': 1975, 'development_type_groups': 1975, 'development_types': 1975, 'urbansim_constants': 1975, }, ), } config.merge(config_changes) self.merge(config)
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, 2002), '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='MODEL05.BAT') config['travel_model_configuration'] = travel_model_config self.merge(config)
def __init__(self): UrbansimZoneConfiguration.__init__(self) config_changes = { 'project_name': 'eugene_zone', 'description': 'Eugene zone baseline', 'base_year': 1980, 'years': (1981, 1985), 'debuglevel': 4, 'models': [ 'real_estate_price_model', 'development_project_transition_model', 'commercial_development_project_location_choice_model', 'industrial_development_project_location_choice_model', 'residential_development_project_location_choice_model', 'add_projects_to_buildings', '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', ], 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name='eugene_1980_baseyear_zone'), 'cache_directory': os.path.join(os.environ['OPUS_HOME'], 'data/eugene_zone/base_year_data'), 'creating_baseyear_cache_configuration': CreatingBaseyearCacheConfiguration( cache_directory_root=os.path.join(os.environ['OPUS_HOME'], 'data/eugene_zone/runs'), cache_from_database=False, baseyear_cache=BaseyearCacheConfiguration( existing_cache_to_copy=os.path.join( os.environ['OPUS_HOME'], 'data/eugene_zone/base_year_data')), cache_scenario_database= 'urbansim.model_coordinators.cache_scenario_database', tables_to_cache=[ 'annual_employment_control_totals', 'annual_household_control_totals', 'households', 'job_building_types', 'building_types', 'jobs', 'travel_data', 'zones', 'pseudo_buildings', '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', 'household_characteristics_for_ht', 'annual_relocation_rates_for_households', 'annual_relocation_rates_for_jobs', 'base_year', 'cities', 'development_event_history', 'employment_adhoc_sector_group_definitions', 'employment_adhoc_sector_groups', 'employment_sectors', 'race_names', 'target_vacancies', 'jobs_for_estimation', 'households_for_estimation', ], unroll_gridcells=False), 'dataset_pool_configuration': DatasetPoolConfiguration(package_order=[ 'eugene_zone', 'eugene', 'urbansim_zone', 'urbansim', 'opus_core' ], ), } self.merge(config_changes)
if __name__ == '__main__': """ Flattens the full scenario database chain. """ parser = OptionParser() parser.add_option("--database_configuration", dest="database_configuration", default = "scenario_database_server", action="store", help="Name of the database server configuration in database_server_configurations.xml where the scenario database is located. Defaults to 'scenario_database_server'.") parser.add_option("-f", "--from_database", dest="from_database_name", type="string", help="The database to flatten. (REQUIRED)") parser.add_option("-t", "--to_database", dest="to_database_name", type="string", help="The new database to create. (REQUIRED)") (options, args) = parser.parse_args() from_database_configuration = ScenarioDatabaseConfiguration( database_name = options.from_database_name, database_configuration = options.database_configuration ) to_database_configuration = ScenarioDatabaseConfiguration( database_name = options.to_database_name, database_configuration = options.database_configuration ) copier = FlattenScenarioDatabaseChain() copier.copy_scenario_database(from_database_configuration = from_database_configuration, to_database_configuration = to_database_configuration)
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE import os from opus_core.storage_factory import StorageFactory from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration from opus_core.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration from urbansim.configs.base_configuration import AbstractUrbansimConfiguration from urbansim.configurations.creating_baseyear_cache_configuration import CreatingBaseyearCacheConfiguration from opus_core.database_management.database_server import DatabaseServer 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, cache_scenario_database= 'urbansim.model_coordinators.cache_scenario_database',
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE import os from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration from opus_core.database_management.configurations.estimation_database_configuration import EstimationDatabaseConfiguration from opus_core.configurations.dataset_pool_configuration import DatasetPoolConfiguration my_configuration = { 'cache_directory': r'e:/urbansim_cache/sanfrancisco/cache_source', ### TODO: Set this cache_directory to something useful. 'scenario_database_configuration': ScenarioDatabaseConfiguration(database_name="sanfrancisco_baseyear", ), 'dataset_pool_configuration': DatasetPoolConfiguration( package_order=['sanfrancisco', 'urbansim', 'opus_core'], ), 'estimation_database_configuration': EstimationDatabaseConfiguration( database_name="sanfrancisco_baseyear_change_20080125", ), 'dataset_pool_configuration': DatasetPoolConfiguration( package_order=['sanfrancisco', 'urbansim', 'opus_core'], ), 'datasets_to_cache_after_each_model': [], 'base_year': 2001, 'years': (2001, 2001), 'datasets_to_cache_after_each_model': [], 'low_memory_mode': False, "datasets_to_preload": {
except ImportError: import_stmt = 'from %s import run_configuration as config' % opus_path exec(import_stmt) elif options.xml_configuration is not None: if options.scenario_name is None: parser.print_help() sys.exit(1) config = XMLConfiguration(options.xml_configuration).get_run_configuration(options.scenario_name) else: parser.print_help() sys.exit(1) if options.cache_directory is not None: config['cache_directory'] = options.cache_directory if options.database_name is not None or options.database_configuration is not None: if not config.has_key('scenario_database_configuration'): config['scenario_database_configuration'] = ScenarioDatabaseConfiguration(database_name = options.database_name, database_configuration = options.database_configuration ) else: if options.database_configuration is not None: config['scenario_database_configuration'] = ScenarioDatabaseConfiguration(database_configuration = options.database_configuration) if options.database_name is not None: config['scenario_database_configuration'].database = options.database_name SessionConfiguration(new_instance=True, package_order=config['dataset_pool_configuration'].package_order, in_storage=AttributeCache()) cacher = CreateBaseyearCache() cache_dir = cacher.run(config)
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE from psrc.configs.baseline import Baseline from opus_core.database_management.flatten_scenario_database_chain \ import FlattenScenarioDatabaseChain from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration """ This utility creates a new flattened database containing the necessary files from the scenario database chain pointed to by PSRC_2000_baseyear. """ run_configuration = Baseline() from_database_configuration = ScenarioDatabaseConfiguration( database_name='PSRC_2000_baseyear') to_database_configuration = ScenarioDatabaseConfiguration( database_name='PSRC_2000_baseyear_flattened') tables_to_copy = run_configuration[ 'creating_baseyear_cache_configuration'].tables_to_cache copier = FlattenScenarioDatabaseChain() copier.copy_scenario_database( from_database_configuration=from_database_configuration, to_database_configuration=to_database_configuration, tables_to_copy=tables_to_copy)
max(options.point1.y, options.point2.y)) input_db_name = options.input_db_name output_db_name = options.output_db_name if output_db_name is None: output_db_name = ('%s_subset_%s_%s_to_%s_%s' % (input_db_name, low_point.x, low_point.y, high_point.x, high_point.y)) from opus_core.database_management.flatten_scenario_database_chain import FlattenScenarioDatabaseChain from opus_core.database_management.database_server import DatabaseServer from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration from_database_configuration = ScenarioDatabaseConfiguration( database_name=input_db_name, database_configuration=options.database_configuration) to_database_configuration = ScenarioDatabaseConfiguration( database_name='temporary_flattened_scenario_database', database_configuration=options.database_configuration) FlattenScenarioDatabaseChain().copy_scenario_database( from_database_configuration=from_database_configuration, to_database_configuration=to_database_configuration, tables_to_copy=[]) db_server = DatabaseServer(to_database_configuration) db = db_server.get_database('temporary_flattened_scenario_database') GenerateDBSubsetByCoords().make_database_subset(db_server, db,
def __init__(self): config = AbstractUrbansimConfiguration() end_year = 2030 config_changes = { 'description':'baseline with travel model', 'cache_directory':None, ### TODO: Set this cache_directory to something useful. 'creating_baseyear_cache_configuration':CreatingBaseyearCacheConfiguration( cache_directory_root = '/urbansim_cache/psrc/gridcell_run_set', #'/projects/urbansim5/urbansim_cache/psrc_gridcell', 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', 'persons', 'persons_for_estimation', ], tables_to_cache_nchunks = {'gridcells': 4}, tables_to_copy_to_previous_years = { 'development_type_groups': 1995, 'development_types': 1995, 'development_type_group_definitions': 1995, 'development_constraints': 1995, 'urbansim_constants': 1995, }, ), 'scenario_database_configuration': ScenarioDatabaseConfiguration( database_name = 'PSRC_2000_baseyear', ), 'dataset_pool_configuration': DatasetPoolConfiguration( package_order=['psrc', 'urbansim', 'opus_core'], ), 'base_year':2000, 'years':(2001, end_year), } config.merge(config_changes) self.merge(config) self['post_year_configuration'] = create_post_year_configuration(end_year)
# TODO: Once all fully-specified configurations are stored as classes, # get rid of this use. import_stmt = 'from %s import run_configuration as config' % opus_path exec(import_stmt) elif options.xml_configuration is not None: if options.scenario_name is None: parser.print_help() sys.exit(1) config = XMLConfiguration( options.xml_configuration).get_run_configuration( options.scenario_name) from_database_configuration = config.get( 'scenario_database_configuration', ScenarioDatabaseConfiguration( database_name=options.scenario_database_name, database_configuration=options.scenario_database_configuration, )) to_database_name = options.flattened_database_name or ( from_database_configuration.database_name + '_flattened') to_database_configuration = ScenarioDatabaseConfiguration( protocol=from_database_configuration.protocol, host_name=from_database_configuration.host_name, user_name=from_database_configuration.user_name, password=from_database_configuration.password, database_name=to_database_name) if config.get('creating_baseyear_cache_configuration', None): tables_to_copy = config[ 'creating_baseyear_cache_configuration'].tables_to_cache else: tables_to_copy = [] # copy all tables in the chain
def __init__(self): config = AbstractUrbansimConfiguration() config_changes = { 'project_name': 'washtenaw', 'description': 'Region Pilot Baseline', 'scenario_database_configuration': ScenarioDatabaseConfiguration(database_name='washtenaw_class', ), 'models': [ 'prescheduled_events', 'events_coordinator', 'residential_land_share_model', 'land_price_model', 'regional_development_project_transition_model', 'residential_regional_development_project_location_choice_model', 'commercial_regional_development_project_location_choice_model', 'industrial_regional_development_project_location_choice_model', 'development_event_transition_model', 'events_coordinator', 'residential_land_share_model', 'jobs_event_model', #'households_event_model', 'regional_household_transition_model', 'regional_household_relocation_model', 'regional_household_location_choice_model', 'regional_employment_transition_model', 'regional_employment_relocation_model', { 'regional_employment_location_choice_model': { 'group_members': ['_all_'] } }, 'regional_distribute_unplaced_jobs_model' ], 'cache_directory': None, ### TODO: Set this cache_directory to something useful. 'creating_baseyear_cache_configuration': CreatingBaseyearCacheConfiguration( cache_directory_root="/urbansim_cache/washtenaw", cache_from_database=True, baseyear_cache=BaseyearCacheConfiguration( existing_cache_to_copy= "/urbansim_cache/washtenaw/cache_source", ), cache_scenario_database= 'urbansim.model_coordinators.cache_scenario_database', tables_to_cache=self.tables_to_cache, tables_to_cache_nchunks={'gridcells': 1}, tables_to_copy_to_previous_years=self. tables_to_copy_to_previous_years, ), 'datasets_to_preload': { 'development_constraint': {}, 'development_event_history': {}, 'development_type': {}, 'gridcell': { 'nchunks': 2 }, 'household': {}, 'job': {}, 'job_building_type': {}, 'target_vacancy': {}, 'zone': {}, 'jobs_event': {}, #'households_event': {}, }, 'dataset_pool_configuration': DatasetPoolConfiguration( package_order=['washtenaw', 'urbansim', 'opus_core'], ), 'base_year': 2005, 'years': (2006, 2010), } config.merge(config_changes) self.merge(config) self.merge_with_controller() try: exec('from %s_local_config import my_configuration' % getuser()) local_config = True except: logger.log_note( "No user's settings found or error occured when loading.") local_config = False if local_config: self.merge(my_configuration)
parser.print_help() sys.exit(1) config = XMLConfiguration( options.xml_configuration).get_run_configuration( options.scenario_name) else: parser.print_help() sys.exit(1) if options.cache_directory is not None: config['cache_directory'] = options.cache_directory if options.database_name is not None or options.database_configuration is not None: if not config.has_key('scenario_database_configuration'): config[ 'scenario_database_configuration'] = ScenarioDatabaseConfiguration( database_name=options.database_name, database_configuration=options.database_configuration) else: if options.database_configuration is not None: config[ 'scenario_database_configuration'] = ScenarioDatabaseConfiguration( database_configuration=options.database_configuration) if options.database_name is not None: config[ 'scenario_database_configuration'].database = options.database_name SessionConfiguration( new_instance=True, package_order=config['dataset_pool_configuration'].package_order, in_storage=AttributeCache()) cacher = CreateBaseyearCache()
try: import wingdbstub except: pass hostname = sys.argv[1] proportion = float(sys.argv[2]) input_db_name = "PSRC_2000_baseyear" output_db_name = input_db_name + '_sampled_' + str( int(100 * proportion)) + '_percent' from opus_core.database_management.configurations.scenario_database_configuration import ScenarioDatabaseConfiguration from opus_core.database_management.flatten_scenario_database_chain import FlattenScenarioDatabaseChain from opus_core.database_management.database_server import DatabaseServer from_database_configuration = ScenarioDatabaseConfiguration( database_name=input_db_name, host_name=hostname, ) to_database_configuration = ScenarioDatabaseConfiguration( database_name='temporary_flattened_scenario_database', host_name=hostname, ) FlattenScenarioDatabaseChain().copy_scenario_database( from_database_configuration=from_database_configuration, to_database_configuration=to_database_configuration, tables_to_copy=[]) db_server = DatabaseServer(to_database_configuration) db = db_server.get_database('temporary_flattened_scenario_database')