feat: ✨ working PoC
This commit is contained in:
+2
-1
@@ -1,3 +1,4 @@
|
||||
from .nimrod import Nimrod
|
||||
from .batch_nimrod import BatchNimrod
|
||||
from .generate_timeseries import GenerateTimeseries
|
||||
from .generate_timeseries import GenerateTimeseries
|
||||
from .combine_timeseries import CombineTimeseries
|
||||
@@ -0,0 +1,34 @@
|
||||
import pandas as pd
|
||||
|
||||
class CombineTimeseries:
|
||||
def __init__(self, config, locations):
|
||||
self.config = config
|
||||
self.locations = locations
|
||||
self.grouped_locations = {}
|
||||
self.build_location_groups()
|
||||
|
||||
|
||||
def build_location_groups(self):
|
||||
for location in self.locations:
|
||||
group = location[4] # output group is at index 4
|
||||
if group not in self.grouped_locations:
|
||||
self.grouped_locations[group] = []
|
||||
self.grouped_locations[group].append(location)
|
||||
|
||||
|
||||
|
||||
def combine_csv_files(self):
|
||||
for group, loc_list in self.grouped_locations.items():
|
||||
print(f"Group {group}:")
|
||||
combined_df = None
|
||||
for loc in loc_list:
|
||||
csv_to_load = f'./csv_files/{loc[0]}_timeseries_data.csv'
|
||||
df = pd.read_csv(csv_to_load, index_col=0)
|
||||
if combined_df is None:
|
||||
combined_df = df
|
||||
else:
|
||||
combined_df = combined_df.join(df, how='inner')
|
||||
output_file = f'{self.config.COMBINED_FOLDER}/group_{group}_timeseries_data.csv'
|
||||
combined_df.to_csv(output_file)
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class GenerateTimeseries:
|
||||
ncols_basin = 2 # hardcoded, likely to change?
|
||||
|
||||
cellres_radar = radar_header[4]
|
||||
cellres_basin = basin_header[4]
|
||||
cellres_basin = 1000 # 1km
|
||||
|
||||
xp = x0_basin - x0_radar
|
||||
yp = y0_basin - y0_radar
|
||||
|
||||
Reference in New Issue
Block a user