feat(script): Add zero-padding to converted CSV filenames for standardize processing pipeline
This commit is contained in:
@@ -15,10 +15,12 @@ def create_damage_files(base_path, output_base):
|
||||
# Define the damage scenarios and the corresponding original file indices
|
||||
damage_scenarios = {
|
||||
1: range(6, 11), # Damage 1 files from zzzAD6.csv to zzzAD10.csv
|
||||
2: range(11, 16), # Damage 2 files from zzzAD11.csv to zzzAD15.csv
|
||||
2: range(11, 16), # Damage 2 files from zzzAD11.csv to zzzAD15.csvs
|
||||
3: range(16, 21), # Damage 3 files from zzzAD16.csv to zzzAD20.csv
|
||||
4: range(21, 26) # Damage 4 files from zzzAD21.csv to zzzAD25.csv
|
||||
}
|
||||
damage_pad = len(str(len(damage_scenarios)))
|
||||
test_pad = len(str(len(damage_scenarios[-1])))
|
||||
|
||||
for damage, files in damage_scenarios.items():
|
||||
for i, file_index in enumerate(files, start=1):
|
||||
@@ -28,7 +30,7 @@ def create_damage_files(base_path, output_base):
|
||||
|
||||
top_sensor = columns[damage-1]
|
||||
print(top_sensor, type(top_sensor))
|
||||
output_file_1 = os.path.join(output_base, f'DAMAGE_{damage}', f'D{damage}_TEST{i}_01.csv')
|
||||
output_file_1 = os.path.join(output_base, f'DAMAGE_{damage}', f'D{damage:0{damage_pad}}_TEST{i:0{test_pad}}_01.csv')
|
||||
print(f"Creating {output_file_1} from taking zzzAD{file_index}.TXT")
|
||||
print("Taking datetime column on index 0...")
|
||||
print(f"Taking `{top_sensor}`...")
|
||||
|
||||
Reference in New Issue
Block a user