def __get_plot_data(real, predict, *plt_row_col): plot_1_row, plot_1_col, plot_2_row, plot_2_col = plt_row_col plot_1 = { 'grid_id': int(real[0, 0, plot_1_row, plot_1_col, 0]), 'predict': [], 'real': [], 'time_str': [] } plot_2 = { 'grid_id': int(real[0, 0, plot_2_row, plot_2_col, 0]), 'predict': [], 'real': [], 'time_str': [] } for i in range(x_ragne): for j in range(real.shape[1]): plot_1['real'].append(real[i, j, plot_1_row, plot_1_col, 2, np.newaxis]) plot_1['predict'].append(predict[i, j, plot_1_row, plot_1_col]) # print('id:{},real:{},predict:{}'.format(plot_1['grid_id'],real[i,j,10,10,2],predict[i,j,10,10])) plot_2['real'].append(real[i, j, plot_2_row, plot_2_col, 2, np.newaxis]) plot_2['predict'].append(predict[i, j, plot_2_row, plot_2_col]) # print('id: {},real: {},predict: {}'.format(plot_2['grid_id'], real[i, j, plot_2_row, plot_2_col, 2], predict[i, j, plot_2_row, plot_2_col])) data_time = set_time_zone( int(real[i, j, plot_1_row, plot_1_col, 1])) plot_1['time_str'].append(date_time_covert_to_str(data_time)) data_time = set_time_zone( int(real[i, j, plot_2_row, plot_2_col, 1])) plot_2['time_str'].append(date_time_covert_to_str(data_time)) __plot(plot_1, plot_2)
def time_feature(X_array_date): for i in range(X_array_date.shape[0]): for j in range(X_array_date.shape[1]): for row in range(X_array_date.shape[2]): for col in range(X_array_date.shape[3]): date = set_time_zone(X_array_date[i, j, row, col]) # print(date_time_covert_to_str(date)[6:]) X_array_date[i, j, row, col, 0] = date_time_covert_to_str(date)[6:] return X_array_date
def get_xlabel(timestamps): xlabel_list = [] for timestamp in timestamps: datetime = utility.set_time_zone(timestamp) xlabel_list.append(utility.date_time_covert_to_str(datetime)) return xlabel_list