Utilities

Global configuration settings can be changed using the settings object.

urbanaccess.config.settings

A set of configuration variables to initiate the configuration settings for UrbanAccess.

Parameters
data_folderstr

location to save and load data files

logs_folderstr

location to write log files

log_filebool

if True, save log output to a log file in logs_folder

log_consolebool

if True, print log output to the console

log_namestr

name of the logger

log_filenamestr

name of the log file

txt_encodingstr

default text encoding used by the GTFS files, to be passed to Python’s open() function. Must be a valid encoding recognized by Python codecs.

gtfs_apidict

dictionary of the name of the GTFS API service as the key and the GTFS API server root URL as the value to pass to the GTFS loader

By default the global configuration settings are already set, however they can be changed by using the functions in the urbanaccess_config class:

class urbanaccess.config.urbanaccess_config(data_folder='data', logs_folder='logs', log_file=True, log_console=False, log_name='urbanaccess', log_filename='urbanaccess', txt_encoding='utf-8', gtfs_api={'gtfsdataexch': 'http://www.gtfs-data-exchange.com/api/agencies?format=csv'})

A set of configuration variables to initiate the configuration settings for UrbanAccess.

Parameters
data_folderstr

location to save and load data files

logs_folderstr

location to write log files

log_filebool

if True, save log output to a log file in logs_folder

log_consolebool

if True, print log output to the console

log_namestr

name of the logger

log_filenamestr

name of the log file

txt_encodingstr

default text encoding used by the GTFS files, to be passed to Python’s open() function. Must be a valid encoding recognized by Python codecs.

gtfs_apidict

dictionary of the name of the GTFS API service as the key and the GTFS API server root URL as the value to pass to the GTFS loader

classmethod from_yaml(configdir='configs', yamlname='urbanaccess_config.yaml')

Create a urbanaccess_config instance from a saved YAML configuration.

Parameters
configdirstr, optional

Directory to load a YAML file.

yamlnamestr or file like, optional

File name from which to load a YAML file.

Returns
——-
urbanaccess_config
to_dict()

Return a dict representation of an urbanaccess_config instance.

to_yaml(configdir='configs', yamlname='urbanaccess_config.yaml', overwrite=False)

Save a urbanaccess_config representation to a YAML file.

Parameters
configdirstr, optional

Directory to save a YAML file.

yamlnamestr or file like, optional

File name to which to save a YAML file.

overwritebool, optional

if true, overwrite an existing same name YAML file in specified directory

Returns
——-
Nothing