Plot Inversion Result from Another Software use Pygimli
tonapawilliam opened this issue · comments
Hello Sir,
I just want to know, when I ask ChatGpt about plotting inversion result Res2DInv in Python for get tomography resistivity, there is a example code that use a Pygimli. Is that really work? I had try that thing but there is no result. Is it really Pygimli can plot the inversion result and intepolate all the datum become tomography from XY Resistivity from Res2DInv?
I am just curious: What did Chat-GPT say, i.e. how is this example code?
To my knowledge, there is no importer for .xyz files but as it is a grid, it will probably a very easy code.
import pandas as pd
import numpy as np
import pygimli as pg
import pygimli.meshtools as mt
import matplotlib.pyplot as plt
data = pd.read_excel('D:/SKRIPSI/Code/Hasil/Model Fault/Wenner_XY Res2DInv.xlsx')
x = data['X'].values
y = data['Y'].values
resistivity = data['Res'].values
x_grid = np.linspace(x.min(), x.max(), 100)
y_grid = np.linspace(y.min(), y.max(), 100)
X_grid, Y_grid = np.meshgrid(x_grid, y_grid)
resistivity_grid = pg.meshtools.interpolate((x, y), resistivity, (X_grid, Y_grid), method='linear')
mesh = pg.meshtools.createMesh2D(X_grid.flatten(), Y_grid.flatten())
resistivity_map = pg.Vector(resistivity_grid.flatten())
# Plotting dengan pygimli
fig, ax = plt.subplots(figsize=(10, 6))
pg.show(mesh, data=resistivity_map, ax=ax, cMap="viridis", label="Resistivity (Ohm.m)", colorBar=True)
ax.set_xlabel("X")
ax.set_ylabel("Depth (Y)")
ax.invert_yaxis() # Membalik sumbu Y agar nilai negatif berada di bawah
plt.title('Tomography Plot')
plt.show()
Chat Gpt use pg.vector for grid the data resistivtiy. My format data it's not .xyz, but in excel which have values position xy and resistivity.