def __init__(self): """ Examples: python create_flattened_database.py -c psrc_parcel.configs.baseline --flattened_database=psrc_parcel_baseyear_flattened python create_flattened_database.py -x ../project_configs/seattle_parcel.xml -s Seattle_baseline python create_flattened_database.py --scenario_database_name=sanfrancisco_baseyear_start --flattened_database=sanfrancisco_baseyear_flattened """ GenericOptionGroup.__init__(self, usage="python %prog [options]", description=""" Create flattened database from a scenario database chain. The scenario_database_configuration containing database_name of the scenario database and tables_to_cache is read either from a Python module configuration passed with '-c' option or an xml configuration with '-x' option, or specified with --database_server and --scenario_database_name options: """) self.parser.remove_option('--services_database') self.parser.remove_option('--database_configuration') self.parser.add_option("-c", "--configuration-path", dest="configuration_path", default=None, help="Opus path to Python module defining run_configuration.") self.parser.add_option("-x", "--xml-configuration", dest="xml_configuration", default=None, help="File name of xml configuration (must also provide a scenario name using -s). Only used if only a specific set of tables should be flattened.") self.parser.add_option("-s", "--scenario_name", dest="scenario_name", default=None, help="Name of the scenario to run. Only used if only a specific set of tables should be flattened.") self.parser.add_option("--scenario_database_configuration", dest="scenario_database_configuration", default = "scenario_database_server", action="store", help="Name of the database server configuration in database_server_configurations.xml that is to be used to connect to the database. Defaults to 'scenario_database_server'.") self.parser.add_option("--scenario_database_name", dest="scenario_database_name", default = None, action="store", help="Name of the scenario database on the scenario database server.") self.parser.add_option("--flattened_database", dest="flattened_database_name", default=None, action="store", help="Name of flattened database.")
def __init__(self): GenericOptionGroup.__init__( self, usage="python %prog [options]", description= "Update run_activity table in services database with the specified options." ) self.parser.add_option( "-c", "--configuration-path", dest="configuration_path", default=None, help="Opus path to Python module defining run_configuration.") self.parser.add_option("--cache-directory", dest="cache_directory", default=None, help="cache directory") self.parser.add_option("--run-id", dest="run_id", default=None, help="which run_id to update") self.parser.add_option("--force", dest="force", default=False, action="store_true", help="force to overwrite pre-existing run_id")
def __init__(self): """ Examples: python create_flattened_database.py -c psrc_parcel.configs.baseline --flattened_database=psrc_parcel_baseyear_flattened python create_flattened_database.py -x ../project_configs/seattle_parcel.xml -s Seattle_baseline python create_flattened_database.py --scenario_database_name=sanfrancisco_baseyear_start --flattened_database=sanfrancisco_baseyear_flattened """ GenericOptionGroup.__init__(self, usage="python %prog [options]", description=""" Create flattened database from a scenario database chain. The scenario_database_configuration containing database_name of the scenario database and tables_to_cache is read either from a Python module configuration passed with '-c' option or an xml configuration with '-x' option, or specified with --database_server and --scenario_database_name options: """) self.parser.remove_option('--services_database') self.parser.remove_option('--database_configuration') self.parser.add_option( "-c", "--configuration-path", dest="configuration_path", default=None, help="Opus path to Python module defining run_configuration.") self.parser.add_option( "-x", "--xml-configuration", dest="xml_configuration", default=None, help= "File name of xml configuration (must also provide a scenario name using -s). Only used if only a specific set of tables should be flattened." ) self.parser.add_option( "-s", "--scenario_name", dest="scenario_name", default=None, help= "Name of the scenario to run. Only used if only a specific set of tables should be flattened." ) self.parser.add_option( "--scenario_database_configuration", dest="scenario_database_configuration", default="scenario_database_server", action="store", help= "Name of the database server configuration in database_server_configurations.xml that is to be used to connect to the database. Defaults to 'scenario_database_server'." ) self.parser.add_option( "--scenario_database_name", dest="scenario_database_name", default=None, action="store", help= "Name of the scenario database on the scenario database server.") self.parser.add_option("--flattened_database", dest="flattened_database_name", default=None, action="store", help="Name of flattened database.")
def __init__(self): GenericOptionGroup.__init__(self, usage="python %prog [options]", description="Dump urbansim results to urbanvision db") self.parser.add_option("-r", "--run-id", dest="run_id", default=None, help="run ID on which to run the report. If this option is specified, -c is ignored.") self.parser.add_option("-c", "--cache_directory", dest="cache_directory", default=None, help="cache directory containing run data to dump.")
def __init__(self): GenericOptionGroup.__init__(self, usage="python %prog [options] configuration", description="Delete results of a simulation run.") self.parser.add_option("--run-id", dest="run_id", default=None, action="store", help="The simulation run to delete.") self.parser.add_option("--years-to-delete", dest="years_to_delete", default=None, action="store", help="Python expression specifying list of years to delete from the simulation's cache.")
def __init__(self): GenericOptionGroup.__init__( self, usage="python %prog [options]", description="Starts running the specified configuration.") self.parser.add_option("-r", "--pickled-resource-file", dest="pickled_resource_file", default=None, help="Opus path to pickled configuration file.") self.parser.add_option( "-c", "--configuration-path", dest="configuration_path", default=None, help="Opus path to Python module defining run_configuration.") self.parser.add_option( "-x", "--xml-configuration", dest="xml_configuration", default=None, help= "file name of xml configuration (must also provide a scenario name using -s)" ) self.parser.add_option("-s", "--scenario_name", dest="scenario_name", default=None, help="name of the scenario to run") self.parser.add_option( "--directory-to-cache", dest="existing_cache_to_copy", default=None, help="Directory containing data to put in new cache.") self.parser.add_option( "--years-to-cache", dest="years_to_cache", default=None, help= "List of years of data to take from the directory-to-cache (default is all years)." ) self.parser.add_option( "--run-as-single-process", dest="run_as_single_process", default=False, action="store_true", help="Determines if multiple processes may be used.") self.parser.add_option( "-p", "--profile", dest="profile_filename", default=None, help= "Turn on code profiling. Output data are in python hotshot format." )
def __init__(self): GenericOptionGroup.__init__( self, usage="python %prog [options]", description= "Control urbansim and travle model to run on different computers") self.parser.add_option( "-c", "--configuration-path", dest="configuration_path", default=None, help="Opus path to Python module defining run_configuration.") self.parser.add_option( "--run-id", dest="run_id", default=None, type='int', help="which run_id to run, None to start a new run") self.parser.add_option("--urbansim-server", dest="urbansim_server", default=None, help="the server runs UrbanSim") self.parser.add_option( "--travelmodel-server", dest="travelmodel_server", default=None, help="the server runs travel model, default on localhost") self.parser.add_option( "-u", "--runserver-username", dest="runserver_username", default=None, help= "Which user name to use for logging into the urbansim and/or travelmodel server(s)" ) ## mostly for debugging purpose self.parser.add_option("--start-year", dest="start_year", default=None, type='int', help="start year (inclusive)") self.parser.add_option("--end-year", dest="end_year", default=None, type='int', help="end year (inclusive)") self.parser.add_option( "-p", "--plink", dest="plink", default=False, action="store_true", help= "use plink.exe instead of paramiko module to invoke remote run; Need to call start_remote_run.py in Windows only and plink.exe in PATH environment" )
def __init__(self): GenericOptionGroup.__init__( self, usage="python %prog [options] run_id [pickle_file]", description= "dump resources.pickle from services db for the given run_id") self.parser.add_option("-p", "--project-name", dest="project_name", default='', help="The project name")
def __init__(self): GenericOptionGroup.__init__(self, usage="python %prog [options]", description="Update run_activity table in services database with the specified options.") self.parser.add_option("-c", "--configuration-path", dest="configuration_path", default=None, help="Opus path to Python module defining run_configuration.") self.parser.add_option("--cache-directory", dest="cache_directory", default=None, help="cache directory") self.parser.add_option("--run-id", dest="run_id", default=None, help="which run_id to update") self.parser.add_option("--force", dest="force", default=False, action="store_true", help="force to overwrite pre-existing run_id")
def __init__(self): GenericOptionGroup.__init__(self, usage="python %prog [options]", description="Control urbansim and travle model to run on different computers, tailored for PSRC runs ") self.parser.add_option("--config", "--configuration-path", dest="configuration_path", default=None, help="Opus path to Python module defining run_configuration.") self.parser.add_option("--start-year", dest="start_year", default=2001, type="int", help="start year (inclusive)") self.parser.add_option("--end-year", dest="end_year", default=2030, type="int", help="end year (inclusive)") self.parser.add_option("--run-id", dest="run_id", default=None, help="which run_id to run, None to start a new run") self.parser.add_option("--server", dest="server", default='aalborg', help="which server to use to run UrbanSim, aalborg or pw")
def __init__(self): GenericOptionGroup.__init__(self, usage="python %prog [-p project_name -r run_id] [-d run_directory] year", description="explore cache. See examples at the end of this script") self.parser.add_option("-p", "--project-name", dest="project_name", default='',help="The project name") self.parser.add_option("-r", "--run-id", dest="run_id", default='',help="run id") self.parser.add_option("-o", "--package-order", dest="package_order", default="['bayarea', 'urbansim_parcel', 'urbansim', 'opus_core']", help="package order") self.parser.add_option("-d", "--run-directory", dest="run_directory", default='',help="run directory, e.g. opus/data/bay_area_parcel/runs/run_xxx.xxxx") self.parser.add_option("-y", "--year", dest="year", default=None, help="year")
def __init__(self): GenericOptionGroup.__init__(self, usage="python %prog [options]", description="Run hudson's reporting capability") self.parser.add_option("-x", "--xml-configuration", dest="xml_configuration", default=None, help="File name of xml configuration") self.parser.add_option("-y", "--years", dest="years", help="List of years to make indicators for (e.g., range(2010,2012)).") self.parser.add_option("-o", "--output-directory", dest="output", help="Output directory for results") self.parser.add_option("-c", "--cache-directory", dest="cache_directory", default=None, help="Directory of UrbanSim cache to make indicators from (Defaults to most recent successful run)") self.parser.add_option("-r", "--run-id", dest="run_id", default=None, help="run ID on which to run the report. If this option is specified, -c and -s are ignored.")
def __init__(self): GenericOptionGroup.__init__(self, usage="python %prog [options] run_id start_year", description="Restart run request with given run_id, starting with given start_year") self.parser.add_option("-p", "--project-name", dest="project_name", default='',help="The name project name") self.parser.add_option("--skip-urbansim", dest="skip_urbansim", default=False, action="store_true", help="Skip running UrbanSim for the restart year.") self.parser.add_option("--create-baseyear-cache-if-not-exists", dest="create_baseyear_cache_if_not_exists", default=False, action="store_true", help="Create baseyear cache if not already exists") self.parser.add_option("--skip-cache-cleanup", dest="skip_cache_cleanup", default=False, action="store_true", help="Skip removing year caches for this and future years.")
def __init__(self): GenericOptionGroup.__init__(self, usage="python %prog [options] run_id start_year", description="Restart run request with given run_id, starting with given start_year") self.parser.add_option("--skip-urbansim", dest="skip_urbansim", default=False, action="store_true", help="Skip running UrbanSim for the restart year.") self.parser.add_option("--skip-travel-model", dest="skip_travel_model", default=False, action="store_true", help="Skip running travel model for the any year.") self.parser.add_option("--skip-cache-cleanup", dest="skip_cache_cleanup", default=False, action="store_true", help="Skip removing year caches for this and future years.") self.parser.add_option("--project-name", dest="project_name", default='misc', action="store", help="The name of the project that the restarted run is part of (e.g. eugene_gridcell)")
def __init__(self): GenericOptionGroup.__init__(self, usage="python %prog [options]", description="Starts running a set of runs.") self.parser.add_option("-r", "--pickled-resource-file", dest="pickled_resource_file", default=None, help="Opus path to pickled configuration file.") self.parser.add_option("-c", "--configuration-path", dest="configuration_path", default=None, help="Opus path to Python module defining run_configuration.") self.parser.add_option("-x", "--xml-configuration", dest="xml_configuration", default=None, help="file name of xml configuration (must also provide a scenario name using -s)") self.parser.add_option("-s", "--scenario_name", dest="scenario_name", default=None, help="name of the scenario to run") self.parser.add_option("--directory-to-cache", dest="existing_cache_to_copy", default=None, action="store", help="Directory containing data to put in new cache.") self.parser.add_option("--years-to-cache", dest="years_to_cache", default=None, action="store", help="List of years of data to take from the directory-to-cache (default is all years).")
def __init__(self): GenericOptionGroup.__init__( self, usage="python %prog [options] configuration", description="Delete results of a simulation run.") self.parser.add_option("--run-id", dest="run_id", default=None, action="store", help="The simulation run to delete.") self.parser.add_option( "--years-to-delete", dest="years_to_delete", default=None, action="store", help= "Python expression specifying list of years to delete from the simulation's cache." )
def __init__(self): GenericOptionGroup.__init__(self, usage="python %prog [options]", description="Starts running the specified configuration.") self.parser.add_option("-r", "--pickled-resource-file", dest="pickled_resource_file", default=None, help="Opus path to pickled configuration file.") self.parser.add_option("-c", "--configuration-path", dest="configuration_path", default=None, help="Opus path to Python module defining run_configuration.") self.parser.add_option("-x", "--xml-configuration", dest="xml_configuration", default=None, help="file name of xml configuration (must also provide a scenario name using -s)") self.parser.add_option("-s", "--scenario_name", dest="scenario_name", default=None, help="name of the scenario to run") self.parser.add_option("--directory-to-cache", dest="existing_cache_to_copy", default=None, help="Directory containing data to put in new cache.") self.parser.add_option("--years-to-cache", dest="years_to_cache", default=None, help="List of years of data to take from the directory-to-cache (default is all years).") self.parser.add_option("--run-as-single-process", dest="run_as_single_process", default=False, action="store_true", help="Determines if multiple processes may be used.") self.parser.add_option("-p", "--profile", dest="profile_filename", default=None, help="Turn on code profiling. Output data are in python hotshot format.")
def __init__(self): GenericOptionGroup.__init__( self, usage="python %prog [options]", description="Starts running a set of runs.") self.parser.add_option("-r", "--pickled-resource-file", dest="pickled_resource_file", default=None, help="Opus path to pickled configuration file.") self.parser.add_option( "-c", "--configuration-path", dest="configuration_path", default=None, help="Opus path to Python module defining run_configuration.") self.parser.add_option( "-x", "--xml-configuration", dest="xml_configuration", default=None, help= "file name of xml configuration (must also provide a scenario name using -s)" ) self.parser.add_option("-s", "--scenario_name", dest="scenario_name", default=None, help="name of the scenario to run") self.parser.add_option( "--directory-to-cache", dest="existing_cache_to_copy", default=None, action="store", help="Directory containing data to put in new cache.") self.parser.add_option( "--years-to-cache", dest="years_to_cache", default=None, action="store", help= "List of years of data to take from the directory-to-cache (default is all years)." )
def __init__(self, **kwargs): GenericOptionGroup.__init__(self, usage="python %prog [options]", description="Control urbansim and travel model to run on different computers, tailored for PSRC runs ") self.parser.add_option("-c", "--configuration-path", dest="configuration_path", default=None, help="Opus path to Python module defining run_configuration.") self.parser.add_option("--start-year", dest="start_year", default=None, type="int", help="start year (inclusive)") self.parser.add_option("--end-year", dest="end_year", default=None, type="int", help="end year (inclusive)") self.parser.add_option("--run-id", dest="run_id", default=None, type="int", help="which run_id to run, None to start a new run") self.parser.add_option("--server", dest="server", default=None, help="which server to use to run UrbanSim") self.parser.add_option("-u", "--user", dest="user", default=None, help="Which user to use for logging into the remote server") self.parser.add_option("--skip-travel-model", dest="skip_travel_model", default=False, action="store_true", help="Travel model will not be run.") self.parser.add_option("--skip-urbansim", dest="skip_urbansim", default=False, action="store_true", help="Urbansim will not be run.")
def __init__(self): GenericOptionGroup.__init__(self, usage="python %prog [options]", description="Control urbansim and travle model to run on different computers") self.parser.add_option("-c", "--configuration-path", dest="configuration_path", default=None, help="Opus path to Python module defining run_configuration.") self.parser.add_option("--run-id", dest="run_id", default=None, type='int', help="which run_id to run, None to start a new run") self.parser.add_option("--urbansim-server", dest="urbansim_server", default=None, help="the server runs UrbanSim") self.parser.add_option("--travelmodel-server", dest="travelmodel_server", default=None, help="the server runs travel model, default on localhost") self.parser.add_option("-u", "--runserver-username", dest="runserver_username", default=None, help="Which user name to use for logging into the urbansim and/or travelmodel server(s)") ## mostly for debugging purpose self.parser.add_option("--start-year", dest="start_year", default=None, type='int', help="start year (inclusive)") self.parser.add_option("--end-year", dest="end_year", default=None, type='int', help="end year (inclusive)") self.parser.add_option("-p", "--plink", dest="plink", default=False, action="store_true", help="use plink.exe instead of paramiko module to invoke remote run; Need to call start_remote_run.py in Windows only and plink.exe in PATH environment")
def __init__(self): GenericOptionGroup.__init__(self, usage="python %prog [options]", description="""Make indicators by processing indicator_batch in the specified configuration. Example: python urbansim/tools/make_indicators.py -x ../project_configs/seattle_parcel_default.xml -i untitled_indicator_batch -y "(2000,)" -c /workspace/urbansim_cache/seattle_parcel/base_year_data/ python urbansim/tools/make_indicators.py -x ../project_configs/seattle_parcel_default.xml -i untitled_indicator_batch -y "(2000,)" -r base_year_data python urbansim/tools/make_indicators.py -x ../project_configs/seattle_parcel_default.xml -i untitled_indicator_batch -y "arange(2000,2030,1)" -r baseline_run """) self.parser.remove_option('--services_database') self.parser.remove_option('--database_configuration') self.parser.add_option("-x", "--xml-configuration", dest="xml_configuration", default=None, help="File name of xml configuration") self.parser.add_option("-i", "--indicator-batch", dest="indicator_batch", default=None, help="Name of the indicator_batch in the specified xml configuration") self.parser.add_option("-c", "--cache-directory", dest="cache_directory", default=None, help="Directory of UrbanSim cache to make indicators from") self.parser.add_option("-r", "--run-name", dest="run_name", default=None, help="") self.parser.add_option("-y", "--years", dest="years", help="List of years to make indicators for.")
# Opus/UrbanSim urban simulation software. # Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington # See opus_core/LICENSE import sys from opus_core.services.run_server.generic_option_group import GenericOptionGroup from opus_core.resources import Resources from opus_core.file_utilities import get_resources_from_file from opus_core.services.run_server.run_manager import RunManager if __name__ == "__main__": """Written for creating the cache as a process""" option_group = GenericOptionGroup() parser = option_group.parser parser.add_option("-r", "--resources", dest="resources_file_name", action="store", type="string", help="Name of file containing resources") (options, args) = parser.parse_args() resources = Resources(get_resources_from_file(options.resources_file_name)) RunManager(option_group.get_services_database_configuration(options)).create_baseyear_cache(resources)
def __init__(self): GenericOptionGroup.__init__(self, usage="python %prog [options] run_id [pickle_file]", description="dump resources.pickle from services db for the given run_id") self.parser.add_option("-p", "--project-name", dest="project_name", default='',help="The project name")
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE from opus_core.services.run_server.generic_option_group import GenericOptionGroup import os from numpy import array from opus_core.misc import write_to_text_file if __name__ == "__main__": option_group = GenericOptionGroup() parser = option_group.parser parser.add_option("-d", "--cache-directory", dest="cache_directory", action="store", type="string", help="Cache directory") parser.add_option("-o", "--output-file", dest="output_file", action="store", type="string", help="Output file") (options, args) = parser.parse_args() files = os.listdir(options.cache_directory) years = [] for file in files: try: year = int(file)
def __init__(self): GenericOptionGroup.__init__(self, usage="Navigate in the console to your OPUS_HOME folder. Type: \ python %prog [options] base_year_bath run_path", description="Run the indicator module on a given base year and a given run.")