def run(self, resources, year): cache_directory = config['cache_directory'] simulation_state = SimulationState() simulation_state.set_cache_directory(cache_directory) simulation_state.set_current_time(year) attribute_cache = AttributeCache() SessionConfiguration(new_instance=True, in_storage=AttributeCache()) arguments = {'in_storage':attribute_cache} gc_set = DatasetFactory().get_dataset('gridcell', package='urbansim', arguments=arguments) runs = { #r'X:\urbansim_cache\run_1713.2007_01_03_11_16':r'(run 1713 - baseline)', #r'X:\urbansim_cache\run_1714.2007_01_03_11_20':r'(run 1714 - no ugb)', #r'X:\urbansim_cache\run_1731.2007_01_03_11_16':r'(run 1731 - no build)', r'X:\urbansim_cache\run_1847.2007_01_15_15_23':r'(run 1847 - no UGB 1/17/2007)', r'X:\urbansim_cache\run_1848.2007_01_15_15_40':r'(run 1848 - no UGB+1.5xhighway 1/17/2007)', # r'X:\urbansim_cache\run_1849.2007_01_15_16_09':r'(run 1849 - baseline 1/17/2007)', r'V:\psrc\run_1850.2007_01_15_17_03':r'(run 1850 - baseline 1/17/2007)', r'V:\psrc\run_1851.2007_01_15_17_07':r'(run 1851 - no build 1/17/2007)' } #baseline = r'X:\urbansim_cache\run_1713.2007_01_03_11_16' baseline = r'V:\psrc\run_1850.2007_01_15_17_03' comparison_variables = {'gridcell': ['urbansim.gridcell.population', 'urbansim.gridcell.number_of_jobs'], 'faz':['urbansim.faz.population', 'urbansim.faz.number_of_jobs'], } #datasets_to_preload = { # 'gridcell':{ 'nchunks':2}, # 'household':{}, # 'job':{}, # 'zone':{}, # 'faz':{}, # 'development_type':{}, # 'development_event_history':{}, # 'development_constraint':{}, # 'job_building_type':{}, # 'urbansim_constant':{}, # } year = 2025 simulation_state = SimulationState() simulation_state.set_current_time(year) SessionConfiguration(new_instance=True, package_order=['psrc','urbansim','opus_core'], in_storage=AttributeCache()) #cache_storage = AttributeCache().get_flt_storage_for_year(year_for_base_year_cache) #datasets = DatasetFactory().create_datasets_from_flt(datasets_to_preload, # "urbansim", # additional_arguments={'in_storage': AttributeCache()}) variable_augment = False if variable_augment == True: for dataset_name in comparison_variables.keys(): cache_directory = baseline simulation_state.set_cache_directory(cache_directory) dataset = DatasetFactory().get_dataset(dataset_name, package='urbansim', arguments={'in_storage': AttributeCache()}) variables = comparison_variables[dataset_name] dataset.compute_variables(variables, resources=Resources()) ids = dataset.get_id_attribute() for run in runs.keys(): cache_directory=run simulation_state.set_cache_directory(cache_directory) run_dataset = DatasetFactory().get_dataset(dataset_name, package='urbansim', arguments={'in_storage': AttributeCache()}) match_index = run_dataset.get_id_index(ids) for variable in variables: short_name = VariableName(variable).alias() attribute = dataset.get_attribute(short_name) run_dataset.add_attribute(attribute[match_index],'baseline_'+short_name,metadata=1) run_dataset.flush_attribute('baseline_'+short_name) SessionConfiguration().get_dataset_pool().remove_all_datasets() #indicators_module = args[0] #eval("from %s import config" % indicators_module) from make_indicators_openev import config from urbansim.indicators.indicator_configuration_handler_batch_mode import generate_indicators #from make_indicators_openev import config #from inprocess.travis.urbansim.indicators.indicator_configuration_handler_batch_mode import generate_indicators for run, descriptin in runs.iteritems(): config.request_years = [year] config.cache_directory = run config.run_description = descriptin generate_indicators(config)
variables = comparison_variables[dataset_name] dataset.compute_variables(variables, resources=Resources()) ids = dataset.get_id_attribute() for run in runs.keys(): cache_directory=run simulation_state.set_cache_directory(cache_directory) run_dataset = DatasetFactory().get_dataset(dataset_name, package='urbansim', arguments={'in_storage': AttributeCache()}) match_index = run_dataset.get_id_index(ids) for variable in variables: short_name = VariableName(variable).alias() attribute = dataset.get_attribute(short_name) run_dataset.add_attribute(attribute[match_index],'baseline_'+short_name,metadata=1) run_dataset.flush_attribute('baseline_'+short_name) SessionConfiguration().get_dataset_pool().remove_all_datasets() if options.indicator_config is not None: opus_path = options.indicator_config try: class_name = opus_path.split('.')[-1] class_name = convert_lower_case_with_underscores_into_camel_case(class_name) import_stmt = 'from %s import %s as config_class' % (opus_path, class_name) exec(import_stmt) is_class = True except ImportError: # TODO: Once all fully-specified configurations are stored as classes, # get rid of this use. import_stmt = 'from %s import config' % opus_path
variables = comparison_variables[dataset_name] dataset.compute_variables(variables, resources=Resources()) ids = dataset.get_id_attribute() for run in runs.keys(): cache_directory=run simulation_state.set_cache_directory(cache_directory) run_dataset = DatasetFactory().get_dataset(dataset_name, package='urbansim', arguments={'in_storage': AttributeCache()}) match_index = run_dataset.get_id_index(ids) for variable in variables: short_name = VariableName(variable).alias() attribute = dataset.get_attribute(short_name) run_dataset.add_attribute(attribute[match_index],'baseline_'+short_name,metadata=1) run_dataset.flush_attribute('baseline_'+short_name) SessionConfiguration().get_dataset_pool().remove_all_datasets() if options.indicator_config is not None: opus_path = options.indicator_config try: class_name = opus_path.split('.')[-1] class_name = convert_lower_case_with_underscores_into_camel_case(class_name) import_stmt = 'from %s import %s as config_class' % (opus_path, class_name) exec(import_stmt) is_class = True except ImportError: # TODO: Once all fully-specified configurations are stored as classes, # get rid of this use. import_stmt = 'from %s import config' % opus_path
def run(self, resources, year): cache_directory = config['cache_directory'] simulation_state = SimulationState() simulation_state.set_cache_directory(cache_directory) simulation_state.set_current_time(year) attribute_cache = AttributeCache() SessionConfiguration(new_instance=True, in_storage=AttributeCache()) arguments = {'in_storage': attribute_cache} gc_set = DatasetFactory().get_dataset('gridcell', package='urbansim', arguments=arguments) runs = { #r'X:\urbansim_cache\run_1713.2007_01_03_11_16':r'(run 1713 - baseline)', #r'X:\urbansim_cache\run_1714.2007_01_03_11_20':r'(run 1714 - no ugb)', #r'X:\urbansim_cache\run_1731.2007_01_03_11_16':r'(run 1731 - no build)', r'X:\urbansim_cache\run_1847.2007_01_15_15_23': r'(run 1847 - no UGB 1/17/2007)', r'X:\urbansim_cache\run_1848.2007_01_15_15_40': r'(run 1848 - no UGB+1.5xhighway 1/17/2007)', # r'X:\urbansim_cache\run_1849.2007_01_15_16_09':r'(run 1849 - baseline 1/17/2007)', r'V:\psrc\run_1850.2007_01_15_17_03': r'(run 1850 - baseline 1/17/2007)', r'V:\psrc\run_1851.2007_01_15_17_07': r'(run 1851 - no build 1/17/2007)' } #baseline = r'X:\urbansim_cache\run_1713.2007_01_03_11_16' baseline = r'V:\psrc\run_1850.2007_01_15_17_03' comparison_variables = { 'gridcell': [ 'urbansim.gridcell.population', 'urbansim.gridcell.number_of_jobs' ], 'faz': ['urbansim.faz.population', 'urbansim.faz.number_of_jobs'], } #datasets_to_preload = { # 'gridcell':{ 'nchunks':2}, # 'household':{}, # 'job':{}, # 'zone':{}, # 'faz':{}, # 'development_type':{}, # 'development_event_history':{}, # 'development_constraint':{}, # 'job_building_type':{}, # 'urbansim_constant':{}, # } year = 2025 simulation_state = SimulationState() simulation_state.set_current_time(year) SessionConfiguration(new_instance=True, package_order=['psrc', 'urbansim', 'opus_core'], in_storage=AttributeCache()) #cache_storage = AttributeCache().get_flt_storage_for_year(year_for_base_year_cache) #datasets = DatasetFactory().create_datasets_from_flt(datasets_to_preload, # "urbansim", # additional_arguments={'in_storage': AttributeCache()}) variable_augment = False if variable_augment == True: for dataset_name in comparison_variables.keys(): cache_directory = baseline simulation_state.set_cache_directory(cache_directory) dataset = DatasetFactory().get_dataset( dataset_name, package='urbansim', arguments={'in_storage': AttributeCache()}) variables = comparison_variables[dataset_name] dataset.compute_variables(variables, resources=Resources()) ids = dataset.get_id_attribute() for run in runs.keys(): cache_directory = run simulation_state.set_cache_directory(cache_directory) run_dataset = DatasetFactory().get_dataset( dataset_name, package='urbansim', arguments={'in_storage': AttributeCache()}) match_index = run_dataset.get_id_index(ids) for variable in variables: short_name = VariableName(variable).alias() attribute = dataset.get_attribute(short_name) run_dataset.add_attribute(attribute[match_index], 'baseline_' + short_name, metadata=1) run_dataset.flush_attribute('baseline_' + short_name) SessionConfiguration().get_dataset_pool( ).remove_all_datasets() #indicators_module = args[0] #eval("from %s import config" % indicators_module) from make_indicators_openev import config from urbansim.indicators.indicator_configuration_handler_batch_mode import generate_indicators #from make_indicators_openev import config #from inprocess.travis.urbansim.indicators.indicator_configuration_handler_batch_mode import generate_indicators for run, descriptin in runs.iteritems(): config.request_years = [year] config.cache_directory = run config.run_description = descriptin generate_indicators(config)