<jupyter_start><jupyter_text>Destination's Land Use Polygons analysis This code allows you to estimate the proportion of each category of land use within the 600m buffer associated to the destination. All the polygons related to each origin are assumed to be previously estimated.    Importing libraries<jupyter_code>%matplotlib inline
import numpy as np
import pandas as pd
import geopandas as gpd
import matplotlib.pyplot as plt
import matplotlib as mpl
import csv
import math

print ("it works")<jupyter_output>it works<jupyter_text>Example for only one route<jupyter_code>route = 1128
db = gpd.read_file('../Shapes/end_LU600/R' +"%s" % (route) +'_end_LU600.shp')
print (db.crs)
db.head()
db.info()
db.plot()
LU_Ep = (db['A_Epub']).sum()
LU_Eqpto = (db['A_Eqpto']).sum()
LU_Hmix = (db['A_Hmix']).sum()
LU_Mmix = (db['A_Mmix']).sum()
LU_Lmix = (db['A_Lmix']).sum()
ALU = LU_Ep + LU_Eqpto + LU_Hmix + LU_Mmix + LU_Lmix
print (LU_Ep)
print (LU_Eqpto)
print (LU_Hmix)
print (LU_Mmix)
print (LU_Lmix)
print (ALU)
pLU_Ep = LU_Ep / ALU
pLU_Eqpto = LU_Eqpto / ALU
pLU_Hmix = LU_Hmix / ALU
pLU_Mmix = LU_Mmix / ALU
pLU_Lmix = LU_Lmix / ALU
print (pLU_Ep) 
print (pLU_Eqpto)
print (pLU_Hmix) 
print (pLU_Mmix)
print (pLU_Lmix)
results = pd.DataFrame ({
        "route": [str(route)],
        "pLU_Ep" : [str(pLU_Ep)],
        "pLU_Eqpto" : [str(pLU_Eqpto)],
        "pLU_Hmix" : [str(pLU_Hmix)],
        "pLU_Mmix" : [str(pLU_Mmix)],
        "pLU_Lmix" : [str(pLU_Lmix)]})
print (results)<jupyter_output>route               pLU_Ep            pLU_Eqpto            pLU_Hmix  \
0  1128  0.14099647404126675  0.11037991806248447  0.7486236078962487   

  pLU_Mmix pLU_Lmix  
0      0.0      0.0<jupyter_text>Destination's Land Use Polygons analysis for All routes  The code requires the list of the destination points associated to all the routes. This list is located in the Tables folder. If you move this file out of this folder, please modify the code.<jupyter_code>routes = np.loadtxt('../Tables/Routes.txt',dtype='str')
for i in routes:
    
    db = gpd.read_file('../Shapes/end_LU600/R' +"%s" % (i) +'_end_LU600.shp')
    LU_Ep = (db['A_Epub']).sum()
    LU_Eqpto = (db['A_Eqpto']).sum()
    LU_Hmix = (db['A_Hmix']).sum()
    LU_Mmix = (db['A_Mmix']).sum()
    LU_Lmix = (db['A_Lmix']).sum()
    ALU = LU_Ep + LU_Eqpto + LU_Hmix + LU_Mmix + LU_Lmix
    pLU_Ep = LU_Ep / ALU
    pLU_Eqpto = LU_Eqpto / ALU
    pLU_Hmix = LU_Hmix / ALU
    pLU_Mmix = LU_Mmix / ALU
    pLU_Lmix = LU_Lmix / ALU
    results = pd.DataFrame ({
        "route": [str(i)],
        "pLU_Ep" : [str(pLU_Ep)],
        "pLU_Eqpto" : [str(pLU_Eqpto)],
        "pLU_Hmix" : [str(pLU_Hmix)],
        "pLU_Mmix" : [str(pLU_Mmix)],
        "pLU_Lmix" : [str(pLU_Lmix)],
        "D_entropy": [O_entropy]})
    results.to_csv('../Tables/OUT/R' +"%s" %(i)+'_end_LU600_index.txt',index=False, header=True)<jupyter_output><empty_output><jupyter_text>This part of the code summarizes the Origin's arcs infrastructure in only one table. Please copy it to a text file and save.<jupyter_code>print ('route,D_pLU_Ep,D_pLU_Eqpto,D_pLU_Hmix,D_pLU_Mmix,D_pLU_Lmix')
for i in routes:
    df=np.loadtxt('../datos/tables/OUT/end_LU600_index/R' +"%s" %(i)+'_end_LU600_index.txt', delimiter=',',skiprows=1)
    print ((str(i)),(df[1]),(df[2]),(df[3]),(df[4]),(df[5]))<jupyter_output>ruta,D_pLU_Ep,D_pLU_Eqpto,D_pLU_Hmix,D_pLU_Mmix,D_pLU_Lmix,D_entropy
('1002', 0.203942674001, 0.291537217869, 0.12909209409700001, 0.36188135481299999, 0.0135466592196, 0.85370230092400001)
('1006', 0.18718614496399999, 0.077280278566199997, 0.73553357646999995, 0.0, 0.0, 0.67125280630600004)
('1009', 0.17399415940900001, 0.024731498770399998, 0.74884349794500005, 0.036851852937200003, 0.015578990938199999, 0.49634223698399998)
('10291', 0.13792062754500001, 0.076318443430300004, 0.78576092902500005, 0.0, 0.0, 0.59988009383499996)
('10292', 0.163217717106, 0.14226084882000001, 0.35061732521799999, 0.24884635369700001, 0.095057755159299998, 0.93857093018399995)
('1050', 0.15984634348999999, 0.067199849601499995, 0.109437185169, 0.045291269438900002, 0.61822535229999998, 0.71709245731299998)
('1052', 0.098150941531600006, 0.12865478841200001, 0.77319427005600005, 0.0, 0.0, 0.62855660456899998)
('1079', 0.064810759230299997, 0.074299926887599996, 0.155779725698, 0.21043590854999999, 0.494[...]
{'fraction_non_alphanumeric': 0.14371395617070357, 'fraction_numerical': 0.1958477508650519, 'mean_word_length': 4.523566878980891, 'pattern_counts': {'":': 3, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '124579', 'license': 'MIT', 'n_tokens_mistral': 2533, 'n_tokens_neox': 1893, 'n_words': 359, 'path': 'Code/114_D_end _LU polygons_analysis.ipynb', 'repo_name': 'Rise-group/database_cyclists_medellin', 'size': '4335'}