From 83f89c254dae9c4d7041b09ae539097bf9c72c90 Mon Sep 17 00:00:00 2001 From: tinoheimhuber Date: Tue, 21 Aug 2018 10:52:06 +1000 Subject: [PATCH] #made some changes to accomodate the new structure of the MESH_v2. Catchment 25-31 were merged into one single catchment (25). The rain and ET data is untouched but are cropped down to 25 catchments in the preprocessing code. --- .../BCGeneration/hunter_rma_preprocessing.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/07_Modelling/01_Input/BCGeneration/hunter_rma_preprocessing.py b/07_Modelling/01_Input/BCGeneration/hunter_rma_preprocessing.py index ec3a091..b5ca94d 100644 --- a/07_Modelling/01_Input/BCGeneration/hunter_rma_preprocessing.py +++ b/07_Modelling/01_Input/BCGeneration/hunter_rma_preprocessing.py @@ -147,7 +147,7 @@ if S['include_boundary_flows'].lower() == 'yes': df = df.drop(['Q[ML/d]', key], axis = 1) #increase river temperature by Delta if S['Increase_riv_temp'] == 'yes': - df['Temperature'] = df['Temperature'] + S['Riv_temp_increase'] + df['Temperature'] = df['Temperature'] + float(S['Riv_temp_increase']) wq_timeseries[key] = df @@ -174,7 +174,7 @@ if S['include_CC_wq'].lower() == 'yes': df.index = df.index + (start_date - pres_start_date) #increase temperature by Delta if S['Increase_SST_temp'] == 'yes': - df['Temperature'] = df['Temperature'] + S['SST_increase'] + df['Temperature'] = df['Temperature'] + float(S['SST_increase']) CC_timeseries[key] = df.copy() # Read WWTP data from setup file @@ -209,9 +209,13 @@ if S['include_wwtp_flows'].lower() == 'yes': # Convert from ML/day to m3/s df[key] = df[['Q[ML/d]']] * 1000 / 24 / 3600 + + #Shift the water quality time series data frame by + df.index = df.index + (start_date - pres_start_date) # Add to inflow time series dataframes inflow_timeseries = inflow_timeseries.join(df[[key]]) + # Add to water quality timeseries wq_timeseries[key] = df.drop(['Q[ML/d]', key], axis = 1) @@ -224,7 +228,10 @@ rain_master = pd.read_csv( # Trim climate data to current date range eto_master = eto_master[start_date:end_date] +eto_master = eto_master.iloc[:,0:25] rain_master = rain_master[start_date:end_date] +rain_master = rain_master.iloc[:,0:25] + #inflow_timeseries.index.difference(rain_master.index) @@ -593,7 +600,7 @@ if S['include_WQ'].lower() == 'yes': wq.index = np.tile(i, wq.shape[0]) wq_df = wq_df.append(wq) #Shift the water quality time series data frame by - wq_df.index = wq_df.index + (start_date - pres_start_date) + #wq_df.index = wq_df.index + (start_date - pres_start_date) # Write element inflows for RMA # Consolidate inflow elements in RMA mesh (only include those with inflows) @@ -644,9 +651,8 @@ for current_year in range(start_date.year, end_date.year + 1): if S['include_WQ'].lower() == 'yes': # Get water quality values for current day - #wq = wq_df.loc[index, :].set_index('constituent') - index + 100 - wq = wq_df[wq_df.index == index].set_index('constituent') #TH I changed this since the constituent part did not work here. + wq = wq_df.loc[index, :].set_index('constituent') + #wq = wq_df[wq_df.index == index].set_index('constituent') #TH I changed this since the constituent part did not work here. # Get names of WWTP, catchment, and boundaries at current element try: w_names = [x for x in q_names if x in wwtp_data.keys()]