Created
February 24, 2022 16:22
-
-
Save p-acDev/eb458aff234b2fd2a99ff8e6de59c0e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| from scipy.interpolate import griddata | |
| import pandas as pd | |
| import sys | |
| raw_filename = sys.argv[1] | |
| dx = int(sys.argv[2]) | |
| dy = int(sys.argv[3]) | |
| df_raw = pd.read_csv(raw_filename, sep=";") | |
| x = df_raw['X'] | |
| y = df_raw['Y'] | |
| z = df_raw['Z'] | |
| xi = np.arange(x.min(), x.max(), dx) | |
| yi = np.arange(y.min(), y.max(), dy) | |
| X, Y = np.meshgrid(xi, yi) | |
| print("\n[*] Building new mesh. please wait ...") | |
| Z = griddata((x, y), z, (X, Y), method='linear') | |
| df_new = pd.DataFrame({"x": X.flatten(), "y": Y.flatten(), "z": Z.flatten()}).dropna() | |
| df_new.to_csv("new_mesh.csv", sep=";") | |
| print("\n[+] New mesh generated") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment