Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94990987
Process.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Dec 11, 23:58
Size
1 KB
Mime Type
text/x-python
Expires
Fri, Dec 13, 23:58 (2 d)
Engine
blob
Format
Raw Data
Handle
22911686
Attached To
R13222 Compteurs_radars_epfl
Process.py
View Options
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
Log In to Comment