def predict_freq_prcp_log(self, begin: int, end: int, guess: tuple) \ -> None: """Use logarithm module to predict wildfire frequency of the state till from the year of begin to the year of end,based on the prediction of precipitation.""" fa, fb = self.prcp_freq_logarithm() date = generate_date_list(begin, end) # obtain the precipitation data with the given parameters prcp_predict = self.predict_prcp(begin, end, guess) # obtain the wildfire frequency data with the given parameters freq_predict = [models.logarithm(x, fa, fb) for x in prcp_predict] # show the prediction in figures figure.figure_line( 'Prediction: wildfire frequency based on the precipitation', 'date', date, 'frequency', freq_predict)
def predict_prcp(self, begin: int, end: int, guess: tuple) -> list: """Prediction the precipitation of the state from the year of begin to the year of the end.""" g = guess date = generate_date_list(begin, end) time_lag = calculate_time_lag_list(self.begin, begin, end) # obtain the precipitation data with the given parameters prcp_predict = [ models.periodic(x, g[0], g[1], g[2], g[3], g[4], g[5], g[6], g[7]) for x in time_lag ] # show the prediction in figures figure.figure_line('Prediction: precipitation', 'date', date, 'precipitation(mm)', prcp_predict) return prcp_predict
def predict_freq_temp_qua(self, time_range: Tuple[int, int], max_guess: tuple, min_guess: tuple, mean_guess: tuple) -> None: """Use quadratic module to predict wildfire frequency of the state till from the year of begin to the year of end,based on the prediction of temperature.""" begin, end = time_range temp_predict = self.predict_temp((begin, end), max_guess, min_guess, mean_guess) f_max, f_min, f_mean = self.temp_freq_quadratic() date = generate_date_list(begin, end) # obtain the wildfire frequency data with the given parameters freq_predict1 = [ models.quadratic(x, f_max[0], f_max[1], f_max[2]) for x in temp_predict[0] ] freq_predict2 = [ models.quadratic(x, f_min[0], f_min[1], f_min[2]) for x in temp_predict[1] ] freq_predict3 = [ models.quadratic(x, f_mean[0], f_mean[1], f_mean[2]) for x in temp_predict[2] ] # show the prediction in figures figure.figure_line( 'Prediction: wildfire frequency based on the max temperature', 'date', date, 'frequency', freq_predict1) figure.figure_line( 'Prediction: wildfire frequency based on the min temperature', 'date', date, 'frequency', freq_predict2) figure.figure_line( 'Prediction: wildfire frequency based on the mean temperature', 'date', date, 'frequency', freq_predict3)
def predict_temp(self, time_range: Tuple[int, int], max_guess: tuple, min_guess: tuple, mean_guess: tuple) -> tuple: """Prediction the temperature of the state from the year of begin to the year of the end.""" g1 = max_guess g2 = min_guess g3 = mean_guess date = generate_date_list(time_range[0], time_range[1]) time_lag = calculate_time_lag_list(self.begin, time_range[0], time_range[1]) # obtain the temperature data with the given parameters temp_predict1 = [ models.periodic(x, g1[0], g1[1], g1[2], g1[3], g1[4], g1[5], g1[6], g1[7]) for x in time_lag ] temp_predict2 = [ models.periodic(x, g2[0], g2[1], g2[2], g2[3], g2[4], g2[5], g2[6], g2[7]) for x in time_lag ] temp_predict3 = [ models.periodic(x, g3[0], g3[1], g3[2], g3[3], g3[4], g3[5], g3[6], g3[7]) for x in time_lag ] # show the prediction in figures figure.figure_line('Prediction: temperature (max mean min)', 'date', date, 'temp(Fahrenheit)', temp_predict1) figure.figure_line('Prediction: temperature (max mean min)', 'date', date, 'temp(Fahrenheit)', temp_predict2) figure.figure_line('Prediction: temperature (max mean min)', 'date', date, 'temp(Fahrenheit)', temp_predict3) return (temp_predict1, temp_predict2, temp_predict3)