GeoDaCenter / GeoDaCenter/spatial_access

Include in notebooks

Open
#76 0 comments 0 reactions 1 assignee Claimed by @ifarah View on GitHub
Dominant language
Python
Stars
40
Forks
11
PR merge metrics
No merged PRs in 30d

Description

# Automated case
years=list(range(1990, 2011, 10))
years_string=list(map(str, years))
all_y=[x[2:] for x in years_string]

**Matrix**:

from spatial_access.p2p import TransitMatrix
from spatial_access.Configs import Configs
custom_config = Configs()
custom_config.disable_area_threshold=True

for i in all_y:
w_asym_mat = TransitMatrix(network_type='walk',
primary_input='ORIG/tracts_chi.csv',
primary_hints={'lon': 'lon', 'lat': 'lat', 'idx': 'ID'},
secondary_hints={'lon': 'lon', 'lat': 'lat', 'idx': 'ID'},
secondary_input='DEST/nets_ws/chi_nets'+str(i)+'.csv',
configs=custom_config)
w_asym_mat.process()
w_asym_mat.write_tmx('matrices/mat_chi'+str(i)+'.tmx')

**Models**:

from spatial_access.Models import *

dict = {
"groceries": [3,3,3,3,3,3,3,3,3,3],
"restaurants": [1,1,1,1,1, 1, .75, .75, .75, .75],
"shopping": [1,1,1, 1, 1,1, 1, 1, .5, .5],
"coffee": [1,1,1, 1,1,1,.75,.75,.75, .75],
"banks": [1,1,1,1,1,1,1,1,1,1],
"park": [1,1,1,1,1,1,1,1,1,1],
"school": [1,1,1,1,1,1,1,1,1,1],
"books": [1,1,1,1,1,1,1,1,1,1],
"entertainment": [1,1,1,1,1,1,1,1,1,1],
}

for i in all_y:
accesst = AccessModel(network_type='walk',
transit_matrix_filename='matrices/mat_chi'+str(i)+'.tmx',
sources_filename='ORIG/tracts_chi.csv',
source_column_names={'idx': 'ID', 'population': 'skip', 'lat': 'lat', 'lon': 'lon'},
dest_column_names={'idx': 'ID', 'category': 'cat', 'capacity': 'skip', 'lat': 'lat', 'lon': 'lon'},
destinations_filename='DEST/nets_ws/chi_nets'+str(i)+'.csv',
decay_function='logit')
accesst.calculate(upper_threshold=1800, category_weight_dict=dict, normalize=False)
accesst.write_results('access/access_chi'+str(i)+'.csv')

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.