Page MenuHomec4science

Process.py
No OneTemporary

File Metadata

Created
Wed, Dec 11, 23:58

Process.py

from comptage import comptage
import os
from functions import *
from Copy_Vehicules import access_server
import datetime
categories_less_than_length = {"Velo": 1.17, "Moto":1.70, "Auto":3.00, "Camionette": 4.00} #in m
input_path = open_input_path("scripts/input_path.yaml", notebook=False)
data_path = input_path["local_input"]
data_path = "data/Brute/"
folders = os.listdir(data_path)
#Take only folders that contain "Site"
folders = [folder for folder in folders if "Site" in folder]
#Append folders to data_path
folders = [data_path+folder+"/" for folder in folders]
compt = comptage(vehicle_type="Vehicules")
compt.read_data(folders=folders, processing="update")
compt.read_concat(path="data/Resultats/L0_cars.csv")
compt.localize(path=input_path["station_info"])
compt.to_L2(categories=categories_less_than_length, output_path="data/Resultats/L2_cars.csv")
compt.convert_to_hyper_tb(output_name="data/Resultats/L2_vehicules.hyper", tablename="L2_vehicules")
compt = comptage(vehicle_type="Pietons-velos")
compt.read_data(folders=folders,processing="update")
compt.read_concat(path="data/Resultats/L0_pietons_velos.csv")
compt.localize(path = input_path["station_info"])
compt.to_L2(output_path="data/Resultats/L2_pietons_velos.csv")
compt.convert_to_hyper_tb(output_name="data/Resultats/L2_pietons_velos.hyper", tablename="L2_pietons_velos")
#If don't exist create a log.txt and append information about the date
with open("log.txt", "w") as f:
f.write("Date: "+str(datetime.datetime.now())+"\n")
f.write("Folders: "+str(folders)+"\n")

Event Timeline