| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import os | |
| file_path = "ERA5_data/weight_matrix.npy" | |
| def main(): | |
| weight_matrix = np.load(file_path) | |
| print(f"Loaded weight_matrix.npy with shape: {weight_matrix.shape}") | |
| plt.figure(figsize=(8, 6)) | |
| im = plt.imshow(weight_matrix.T, cmap='viridis', origin='lower', aspect='auto') | |
| plt.colorbar(im, label='Weight') | |
| plt.title('Weight Matrix Heatmap') | |
| plt.xlabel('X Grid Index (64)') | |
| plt.ylabel('Y Grid Index (32)') | |
| output_path = "weight_matrix_heatmap.png" | |
| plt.tight_layout() | |
| plt.savefig(output_path) | |
| print(f"Heatmap saved to {output_path}") | |
| if __name__ == "__main__": | |
| main() | |