<jupyter_start><jupyter_text>Script for summing road lengths in multiple buffers ** Author: <NAME> ** Developed for <NAME>, Oregon State University ** Date created: ** September 20, 2018 Summary This script takes multiple road exposure measures at multiple buffer sizes, and calculates the sum of road measures for each buffer size  Setup Load libraries, define filepaths and constants<jupyter_code>import pandas as ps
import os
import math
workFolder = "C:/Users/larkinan/Documents/Canada_NO2_LUR_14_16/Datasets/"
inputEnvCSV = workFolder + "Canada_LUR_preprocessed_Sep17_18.csv"
outputEnvCSV = workFolder + "Canada_LUR_preprocessed_Sep17_18_v2.csv"
varsToSum = ["bR","cR","dR","eR"]
bufferDists = [50,100,250,500,750,1000,2000,3000,4000,5000,10000,15000,20000]
newVarName = "alRds"<jupyter_output><empty_output><jupyter_text>Helper functions<jupyter_code># sum averages for a single buffer size
def sumOneBufferDist(inData,varNames,bufferDist,newVarName):
    newVarName = newVarName +str(bufferDist) + "m"
    inData[newVarName] = 0
    for name in varNames:
        tempVar = name + str(bufferDist) + "m"
        if(tempVar in inData):
            inData[newVarName] += inData[tempVar]
def sumAllBufferDists(inData,varNames,bufferDists,newVarName):
    for bufferDist in bufferDists:
        sumOneBufferDist(inData,varNames,bufferDist,newVarName)<jupyter_output><empty_output><jupyter_text>Main function<jupyter_code>def main():
    dataset = ps.read_csv(inputEnvCSV)
    sumAllBufferDists(dataset,varsToSum,bufferDists,newVarName)
    dataset.to_csv(outputEnvCSV)<jupyter_output><empty_output><jupyter_text>Call main function<jupyter_code>main()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09934562760261749, 'fraction_numerical': 0.04164187983343248, 'mean_word_length': 6.971563981042654, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '23314', 'license': 'MIT', 'n_tokens_mistral': 620, 'n_tokens_neox': 560, 'n_words': 116, 'path': 'Processing Scripts/.ipynb_checkpoints/sumRoadBuffers_Canada_LUR-checkpoint.ipynb', 'repo_name': 'larkinandy/Canada_NO2_LUR_14_16', 'size': '1694'}