chore: ⚙️ added option to delete processing files
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import polars as pd
|
||||
import os
|
||||
|
||||
|
||||
class CombineTimeseries:
|
||||
@@ -25,7 +26,12 @@ class CombineTimeseries:
|
||||
combined_df = df
|
||||
else:
|
||||
combined_df = combined_df.join(df, on='datetime')
|
||||
|
||||
if self.config.delete_csv_after_combining:
|
||||
os.remove(csv_to_load)
|
||||
|
||||
output_file = (
|
||||
f"{self.config.COMBINED_FOLDER}/zone_{group}_timeseries_data.csv"
|
||||
)
|
||||
combined_df.write_csv(output_file)
|
||||
sorted_df = combined_df.sort('datetime')
|
||||
sorted_df.write_csv(output_file)
|
||||
|
||||
@@ -116,7 +116,12 @@ class GenerateTimeseries:
|
||||
'date': parsed_date,
|
||||
'value': val
|
||||
})
|
||||
|
||||
if self.config.delete_asc_after_processing:
|
||||
os.remove(file_path)
|
||||
|
||||
return results
|
||||
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error processing file {file_name}: {e}")
|
||||
|
||||
@@ -444,7 +444,6 @@ class Nimrod:
|
||||
# (And as an example of how to invoke class methods from an importing module)
|
||||
# -------------------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Extract information and data from a NIMROD format file",
|
||||
|
||||
Reference in New Issue
Block a user