|
|
@ -464,15 +464,27 @@ def extract_records(input_dir, output_dir, clean_up=False):
|
|
|
|
# Get basin ID
|
|
|
|
# Get basin ID
|
|
|
|
basin_code = sites.loc[bore_id, 'Basin code']
|
|
|
|
basin_code = sites.loc[bore_id, 'Basin code']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Make copy of original dataframe
|
|
|
|
|
|
|
|
df_all = df.copy()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Get quality columns
|
|
|
|
|
|
|
|
q_idx = ['Quality' in col for col in df.columns]
|
|
|
|
|
|
|
|
|
|
|
|
# Resample if necessary
|
|
|
|
# Resample if necessary
|
|
|
|
for period in periods:
|
|
|
|
for period in periods:
|
|
|
|
if period == 'daily':
|
|
|
|
if period == 'daily':
|
|
|
|
# Resample to daily timestamps
|
|
|
|
# Resample to daily timestamps
|
|
|
|
df = df.resample('1d').mean()
|
|
|
|
df = df_all.resample('1d').mean()
|
|
|
|
|
|
|
|
# Get first quality code for each period, as mean doesn't work
|
|
|
|
|
|
|
|
q_val = df_all.loc[:, q_idx].resample('1d').first()
|
|
|
|
|
|
|
|
df.loc[:, q_idx] = q_val
|
|
|
|
|
|
|
|
|
|
|
|
elif period == 'weekly':
|
|
|
|
elif period == 'weekly':
|
|
|
|
# Resample to weekly timestamps
|
|
|
|
# Resample to weekly timestamps
|
|
|
|
df = df.resample('1w').mean()
|
|
|
|
df = df_all.resample('1w').mean()
|
|
|
|
|
|
|
|
# Get first quality code for each period, as mean doesn't work
|
|
|
|
|
|
|
|
q_val = df_all.loc[:, q_idx].resample('1w').first()
|
|
|
|
|
|
|
|
df.loc[:, q_idx] = q_val
|
|
|
|
|
|
|
|
|
|
|
|
# Add specific borehole details
|
|
|
|
# Add specific borehole details
|
|
|
|
df['Site'] = sites.loc[bore_id, 'Site']
|
|
|
|
df['Site'] = sites.loc[bore_id, 'Site']
|
|
|
|