-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrip_count.py
More file actions
55 lines (44 loc) · 1.64 KB
/
Copy pathtrip_count.py
File metadata and controls
55 lines (44 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 16 10:26:23 2022
@author: antho
"""
import os
import random
import numpy as np
import pandas as pd
# Set Directories
source = "Summit"
from set_paths import set_paths
[home_dir, data_dir, output_dir] = set_paths(source)
from data_gather import data_gather
from tract_distance_tc import tract_distance_tc
tr1 = 0 #int(sys.argv[3])
tr2 = 5265 #int(sys.argv[4])
tc_only = True
# Set seed for stochastics to maintain repeatability across results
random.seed(26)
# Gather DataFrames and Load List
[og_load_list, ACS_df, BTS_df, links_df, tract_by_county_df, geo_df] = data_gather(data_dir)
# Generate List of Tracts
#tot_tracts = tract_generation(og_load_list, geo_df, tract_by_county_df)
os.chdir(data_dir)
tr_df = pd.read_excel("Tx_tracts_all.xlsx")
tot_tracts = tr_df["Tx_Tracts_All"].values
no_room_exists = 0
hh_mem_not_int = 0
supplanted_tracts = 0
single_veh_double_rate = 0
checks = [no_room_exists, hh_mem_not_int, supplanted_tracts, single_veh_double_rate]
geo_distance = []
g_dist_sum = []
geo_trip_purp = pd.DataFrame(columns = ["Home", "Work", "School", "Med", "Shop", "Social", "Transport", "Meals", "Other"])
geo_dist_by_purp = pd.DataFrame(columns = ["Home", "Work", "School", "Med", "Shop", "Social", "Transport", "Meals", "Other"])
os.chdir(output_dir)
vtrips_by_tract = np.zeros(5265)
for g in range(tr1, tr2):
# Function for tract distance calculation
[checks, nan_check, tot_vtrips] = tract_distance_tc(g, tot_tracts, BTS_df, ACS_df, checks)
vtrips_by_tract[g] = tot_vtrips
print("Annual Total Trip Count (Millions): ", sum(vtrips_by_tract)*365/1000000)
print("Vacancy total: ", checks[2])