def result_to_csv(self): column_header = ['Class', 'Gauge', 'SP_Tim_10', 'SP_Dur_10', 'SP_Mag_10', 'SP_ROC_10', 'SP_Tim_50', 'SP_Dur_50', 'SP_Mag_50', 'SP_ROC_50', 'SP_Tim_90', 'SP_Dur_90', 'SP_Mag_90', 'SP_ROC_90'] result_matrix = [] result_matrix.append(self.gauge_class_array) result_matrix.append(self.gauge_number_array) for percent in self.percentilles: result_matrix.append(self.spring_timings[percent]) result_matrix.append(self.spring_durations[percent]) result_matrix.append(self.spring_magnitudes[percent]) result_matrix.append(self.spring_rocs[percent]) result_matrix = sort_matrix(result_matrix, 0) result_matrix = insert_column_header(result_matrix, column_header) np.savetxt("post_processedFiles/spring_transition_result_matrix.csv", result_matrix, delimiter=",", fmt="%s") if self.plot: smart_plot(result_matrix) """nonP plots""" SP_Tim = [] SP_Mag = [] SP_Dur = [] SP_ROC = [] for class_id in range(1,10): SP_Tim.append(self.metrics['SP_Tim'][class_id]) SP_Mag.append(self.metrics['SP_Mag'][class_id]) SP_Dur.append(self.metrics['SP_Dur'][class_id]) SP_ROC.append(self.metrics['SP_ROC'][class_id]) combined = {'SP_Tim': SP_Tim, 'SP_Mag': SP_Mag, 'SP_Dur': SP_Dur, 'SP_ROC': SP_ROC} if self.plot: nonP_box_plot(combined)
def result_to_csv(self): column_header = [ 'Class', 'Gauge', 'SU_Tim_10', 'SU_BFL_Mag_10_10', 'SU_BFL_Mag_50_10', 'SU_BFL_Dur_Flush_10', 'SU_BFL_Dur_Wet_10', 'SU_BFL_NoFlow_10', 'SU_Tim_50', 'SU_BFL_Mag_10_50', 'SU_BFL_Mag_50_50', 'SU_BFL_Dur_Flush_50', 'SU_BFL_Dur_Wet_50', 'SU_BFL_NoFlow_50', 'SU_Tim_90', 'SU_BFL_Mag_10_90', 'SU_BFL_Mag_50_90', 'SU_BFL_Dur_Flush_90', 'SU_BFL_Dur_Wet_90', 'SU_BFL_NoFlow_90' ] result_matrix = [] result_matrix.append(self.gauge_class_array) result_matrix.append(self.gauge_number_array) for percentile in self.percentilles: result_matrix.append(self.summer_timings[percentile]) result_matrix.append(self.summer_10_magnitudes[percentile]) result_matrix.append(self.summer_50_magnitudes[percentile]) result_matrix.append(self.summer_flush_durations[percentile]) result_matrix.append(self.summer_wet_durations[percentile]) result_matrix.append(self.summer_no_flow_counts[percentile]) result_matrix = sort_matrix(result_matrix, 0) result_matrix = insert_column_header(result_matrix, column_header) np.savetxt("post_processedFiles/summer_baseflow_result_matrix.csv", result_matrix, delimiter=",", fmt="%s") if self.plot: smart_plot(result_matrix) """nonP plots""" SU_BFL_Tim = [] SU_BFL_Mag_10 = [] SU_BFL_Mag_50 = [] SU_BFL_Dur_Fl = [] SU_BFL_Dur_Wet = [] SU_BFL_No_Flow = [] for class_id in range(1, 10): SU_BFL_Tim.append(self.metrics['SU_BFL_Tim'][class_id]) SU_BFL_Mag_10.append(self.metrics['SU_BFL_Mag_10'][class_id]) SU_BFL_Mag_50.append(self.metrics['SU_BFL_Mag_50'][class_id]) SU_BFL_Dur_Fl.append(self.metrics['SU_BFL_Dur_Fl'][class_id]) SU_BFL_Dur_Wet.append(self.metrics['SU_BFL_Dur_Wet'][class_id]) SU_BFL_No_Flow.append(self.metrics['SU_BFL_No_Flow'][class_id]) combined = { 'SU_BFL_Tim': SU_BFL_Tim, 'SU_BFL_Mag_10': SU_BFL_Mag_10, 'SU_BFL_Mag_50': SU_BFL_Mag_50, 'SU_BFL_Dur_Fl, ': SU_BFL_Dur_Fl, 'SU_BFL_Dur_Wet': SU_BFL_Dur_Wet, 'SU_BFL_No_Flow': SU_BFL_No_Flow } if self.plot: nonP_box_plot(combined)
def result_to_csv(self): column_header = [ 'Class', 'Gauge', 'FAFL_Tim_10%', 'FAFL_Mag_10%', 'FAFL_Dur_10%', 'FA_Tim_Wet_10%', 'FAFL_Tim_50%', 'FAFL_Mag_50%', 'FAFL_Dur_50%', 'FA_Tim_Wet_50%', 'FAFL_Tim_90%', 'FAFL_Mag_90%', 'FAFL_Dur_90%', 'FA_Tim_Wet_90%' ] result_matrix = [] result_matrix.append(self.gauge_class_array) result_matrix.append(self.gauge_number_array) for percent in self.percentilles: result_matrix.append(self.fall_timings[percent]) result_matrix.append(self.fall_magnitudes[percent]) result_matrix.append(self.fall_durations[percent]) result_matrix.append(self.fall_wet_timings[percent]) result_matrix = sort_matrix(result_matrix, 0) result_matrix = insert_column_header(result_matrix, column_header) np.savetxt("post_processedFiles/fall_flush_result_matrix.csv", result_matrix, delimiter=",", fmt="%s") if self.plot: smart_plot(result_matrix) """nonP plots""" FAFL_Tim = [] FAFL_Mag = [] FAFL_Tim_Wet = [] FAFL_Dur = [] for class_id in range(1, 10): FAFL_Tim.append(self.metrics['FAFL_Tim'][class_id]) FAFL_Mag.append(self.metrics['FAFL_Mag'][class_id]) FAFL_Tim_Wet.append(self.metrics['FAFL_Tim_Wet'][class_id]) FAFL_Dur.append(self.metrics['FAFL_Dur'][class_id]) combined = { 'FAFL_Tim': FAFL_Tim, 'FAFL_Mag': FAFL_Mag, 'FAFL_Tim_Wet': FAFL_Tim_Wet, 'FAFL_Dur': FAFL_Dur } if self.plot: nonP_box_plot(combined)
def result_to_csv(self): column_header = [ 'Class', 'Gauge', 'Avg_10%', 'Std_10%', 'CV_10%', 'Avg_50%', 'Std_50%', 'CV_50%', 'Avg_90%', 'Std_90%', 'CV_90%' ] result_matrix = [] result_matrix.append(self.gauge_class_array) result_matrix.append(self.gauge_number_array) for percent in self.percentilles: result_matrix.append(self.average_annual_flows[percent]) result_matrix.append(self.standard_deviations[percent]) result_matrix.append(self.coefficient_variations[percent]) result_matrix = sort_matrix(result_matrix, 0) result_matrix = insert_column_header(result_matrix, column_header) np.savetxt("post_processedFiles/all_year_result_matrix.csv", result_matrix, delimiter=",", fmt="%s") if self.plot: smart_plot(result_matrix) """nonP plots""" Avg = [] Std = [] CV = [] for class_id in range(1, 10): Avg.append(self.metrics['Avg'][class_id]) Std.append(self.metrics['Std'][class_id]) CV.append(self.metrics['CV'][class_id]) combined = {'Avg': Avg, 'Std': Std, 'CV': CV} if self.plot: nonP_box_plot(combined)
def result_to_csv(self): column_header = ['Class', 'Gauge #'] result_matrix = [] result_matrix.append(self.gauge_class_array) result_matrix.append(self.gauge_number_array) # only output percentiles 10, 20, 50 for percent in [50, 20, 10]: for percentille in self.percentilles: # Exceedance percentiles translated to recurrence intervals for output: exc_50 -> peak_2, exc_20 -> peak_5, exc_10 -> peak_10 if percent == 50: name = 2 if percent == 20: name = 5 if percent == 10: name = 10 # column_header.append('Peak_Tim_{}_{}'.format(name, percentille)) column_header.append('Peak_Dur_{}_{}'.format( name, percentille)) column_header.append('Peak_Fre_{}_{}'.format( name, percentille)) column_header.append('Peak{}_{}'.format(name, percentille)) # result_matrix.append(self.timing[percent][percentille]) result_matrix.append(self.duration[percent][percentille]) result_matrix.append(self.freq[percent][percentille]) result_matrix.append(self.mag[percent][percentille]) result_matrix = sort_matrix(result_matrix, 0) result_matrix = insert_column_header(result_matrix, column_header) np.savetxt("post_processedFiles/winter_highflow_result_matrix.csv", result_matrix, delimiter=",", fmt="%s") if self.plot: smart_plot(result_matrix) """nonP plots""" WIN_Tim_2 = [] WIN_Dur_2 = [] WIN_Fre_2 = [] WIN_Mag_2 = [] WIN_Tim_5 = [] WIN_Dur_5 = [] WIN_Fre_5 = [] WIN_Mag_5 = [] WIN_Tim_10 = [] WIN_Dur_10 = [] WIN_Fre_10 = [] WIN_Mag_10 = [] WIN_Tim_20 = [] WIN_Dur_20 = [] WIN_Fre_20 = [] WIN_Mag_20 = [] WIN_Tim_50 = [] WIN_Dur_50 = [] WIN_Fre_50 = [] WIN_Mag_50 = [] for class_id in range(1, 10): WIN_Tim_2.append(self.metrics['WIN_Tim_2'][class_id]) WIN_Dur_2.append(self.metrics['WIN_Dur_2'][class_id]) WIN_Fre_2.append(self.metrics['WIN_Fre_2'][class_id]) WIN_Fre_2.append(self.metrics['WIN_Mag_2'][class_id]) WIN_Tim_5.append(self.metrics['WIN_Tim_5'][class_id]) WIN_Dur_5.append(self.metrics['WIN_Dur_5'][class_id]) WIN_Fre_5.append(self.metrics['WIN_Fre_5'][class_id]) WIN_Fre_5.append(self.metrics['WIN_Mag_5'][class_id]) WIN_Tim_10.append(self.metrics['WIN_Tim_10'][class_id]) WIN_Dur_10.append(self.metrics['WIN_Dur_10'][class_id]) WIN_Fre_10.append(self.metrics['WIN_Fre_10'][class_id]) WIN_Fre_10.append(self.metrics['WIN_Mag_10'][class_id]) WIN_Tim_20.append(self.metrics['WIN_Tim_20'][class_id]) WIN_Dur_20.append(self.metrics['WIN_Dur_20'][class_id]) WIN_Fre_20.append(self.metrics['WIN_Fre_20'][class_id]) WIN_Fre_20.append(self.metrics['WIN_Mag_20'][class_id]) WIN_Tim_50.append(self.metrics['WIN_Tim_50'][class_id]) WIN_Dur_50.append(self.metrics['WIN_Dur_50'][class_id]) WIN_Fre_50.append(self.metrics['WIN_Fre_50'][class_id]) WIN_Fre_50.append(self.metrics['WIN_Mag_50'][class_id]) combined = { 'WIN_Tim_2': WIN_Tim_2, 'WIN_Dur_2': WIN_Dur_2, 'WIN_Fre_2': WIN_Fre_2, 'WIN_Mag_2': WIN_Mag_2, 'WIN_Tim_5': WIN_Tim_5, 'WIN_Dur_5': WIN_Dur_5, 'WIN_Fre_5': WIN_Fre_5, 'WIN_Mag_5': WIN_Mag_5, 'WIN_Tim_10': WIN_Tim_10, 'WIN_Dur_10': WIN_Dur_10, 'WIN_Fre_10': WIN_Fre_10, 'WIN_Mag_10': WIN_Mag_10, 'WIN_Tim_20': WIN_Tim_20, 'WIN_Dur_20': WIN_Dur_20, 'WIN_Fre_20': WIN_Fre_20, 'WIN_Mag_20': WIN_Mag_20, 'WIN_Tim_50': WIN_Tim_50, 'WIN_Dur_50': WIN_Dur_50, 'WIN_Fre_50': WIN_Fre_50, 'WIN_Mag_50': WIN_Mag_50 } if self.plot: nonP_box_plot(combined)
def result_to_csv(self): column_header = ['Class', 'Gauge #'] result_matrix = [] result_matrix.append(self.gauge_class_array) result_matrix.append(self.gauge_number_array) for percent in self.exceedance_percent: for percentille in self.percentilles: column_header.append('WIN_Tim_{}_{}'.format( percent, percentille)) column_header.append('WIN_Dur_{}_{}'.format( percent, percentille)) column_header.append('WIN_Fre_{}_{}'.format( percent, percentille)) column_header.append('WIN_Mag_{}_{}'.format( percent, percentille)) result_matrix.append(self.timing[percent][percentille]) result_matrix.append(self.duration[percent][percentille]) result_matrix.append(self.freq[percent][percentille]) result_matrix.append(self.mag[percent][percentille]) result_matrix = sort_matrix(result_matrix, 0) result_matrix = insert_column_header(result_matrix, column_header) np.savetxt("post_processedFiles/winter_highflow_result_matrix.csv", result_matrix, delimiter=",", fmt="%s") if self.plot: smart_plot(result_matrix) """nonP plots""" WIN_Tim_2 = [] WIN_Dur_2 = [] WIN_Fre_2 = [] WIN_Mag_2 = [] WIN_Tim_5 = [] WIN_Dur_5 = [] WIN_Fre_5 = [] WIN_Mag_5 = [] WIN_Tim_10 = [] WIN_Dur_10 = [] WIN_Fre_10 = [] WIN_Mag_10 = [] WIN_Tim_20 = [] WIN_Dur_20 = [] WIN_Fre_20 = [] WIN_Mag_20 = [] WIN_Tim_50 = [] WIN_Dur_50 = [] WIN_Fre_50 = [] WIN_Mag_50 = [] for class_id in range(1, 10): WIN_Tim_2.append(self.metrics['WIN_Tim_2'][class_id]) WIN_Dur_2.append(self.metrics['WIN_Dur_2'][class_id]) WIN_Fre_2.append(self.metrics['WIN_Fre_2'][class_id]) WIN_Fre_2.append(self.metrics['WIN_Mag_2'][class_id]) WIN_Tim_5.append(self.metrics['WIN_Tim_5'][class_id]) WIN_Dur_5.append(self.metrics['WIN_Dur_5'][class_id]) WIN_Fre_5.append(self.metrics['WIN_Fre_5'][class_id]) WIN_Fre_5.append(self.metrics['WIN_Mag_5'][class_id]) WIN_Tim_10.append(self.metrics['WIN_Tim_10'][class_id]) WIN_Dur_10.append(self.metrics['WIN_Dur_10'][class_id]) WIN_Fre_10.append(self.metrics['WIN_Fre_10'][class_id]) WIN_Fre_10.append(self.metrics['WIN_Mag_10'][class_id]) WIN_Tim_20.append(self.metrics['WIN_Tim_20'][class_id]) WIN_Dur_20.append(self.metrics['WIN_Dur_20'][class_id]) WIN_Fre_20.append(self.metrics['WIN_Fre_20'][class_id]) WIN_Fre_20.append(self.metrics['WIN_Mag_20'][class_id]) WIN_Tim_50.append(self.metrics['WIN_Tim_50'][class_id]) WIN_Dur_50.append(self.metrics['WIN_Dur_50'][class_id]) WIN_Fre_50.append(self.metrics['WIN_Fre_50'][class_id]) WIN_Fre_50.append(self.metrics['WIN_Mag_50'][class_id]) combined = { 'WIN_Tim_2': WIN_Tim_2, 'WIN_Dur_2': WIN_Dur_2, 'WIN_Fre_2': WIN_Fre_2, 'WIN_Mag_2': WIN_Mag_2, 'WIN_Tim_5': WIN_Tim_5, 'WIN_Dur_5': WIN_Dur_5, 'WIN_Fre_5': WIN_Fre_5, 'WIN_Mag_5': WIN_Mag_5, 'WIN_Tim_10': WIN_Tim_10, 'WIN_Dur_10': WIN_Dur_10, 'WIN_Fre_10': WIN_Fre_10, 'WIN_Mag_10': WIN_Mag_10, 'WIN_Tim_20': WIN_Tim_20, 'WIN_Dur_20': WIN_Dur_20, 'WIN_Fre_20': WIN_Fre_20, 'WIN_Mag_20': WIN_Mag_20, 'WIN_Tim_50': WIN_Tim_50, 'WIN_Dur_50': WIN_Dur_50, 'WIN_Fre_50': WIN_Fre_50, 'WIN_Mag_50': WIN_Mag_50 } if self.plot: nonP_box_plot(combined)