def load_dbc_files(dbc_paths): """Given a list of DBC file paths, create a list of conversion rule databases""" import can_decoder from pathlib import Path db_list = [] for dbc in dbc_paths: db = can_decoder.load_dbc(Path(__file__).parent / dbc) db_list.append(db) return db_list
from utils import setup_fs, setup_fs_s3 # specify which devices to process (from local folder or S3 bucket) devices = ["LOG/958D2219"] # specify which time period to fetch log files for start = datetime(year=2020, month=1, day=13, hour=0, minute=0, tzinfo=timezone.utc) stop = datetime(year=2099, month=1, day=1, tzinfo=timezone.utc) # specify DBC path dbc_path = r"CSS-Electronics-SAE-J1939-DEMO.dbc" # --------------------------------------------------- # initialize DBC converter and file loader db = can_decoder.load_dbc(dbc_path) df_decoder = can_decoder.DataFrameDecoder(db) # fs = setup_fs_s3() fs = setup_fs() # List log files based on inputs log_files = canedge_browser.get_log_files(fs, devices, start_date=start, stop_date=stop) print(f"Found a total of {len(log_files)} log files") df_concat = [] for log_file in log_files: # open log file, get device id and extract dataframe with raw CAN data print(f"\nProcessing log file: {log_file}") with fs.open(log_file, "rb") as handle: