Hello, I have to plot the map of the TMI and the TMI with RTP, but I’m having some issues with that. I simulated the survey and get the dpred (tmi_data) and the data with RTP (tmi_rtp).
Im using this code to try to plot the maps:
import pygmt
import numpy as np
# Definir las coordenadas x e y
x = np.linspace(-80.0, 80.0, 17)
y = np.linspace(-80.0, 80.0, 17)
# Crear un objeto Grid a partir de los datos magnéticos
grid_data = pygmt.datasets.Grid.from_array(x=x, y=y, data=tmi_data)
fig = pygmt.Figure()
with fig.subplot(nrows=1, ncols=2, figsize=("28c", "15c"), sharey="l"):
# Make colormap for both plots (saturate it a little bit)
scale = 0.5 * vd.maxabs(tmi_data, tmi_rtp)
pygmt.makecpt(cmap="polar+h", series=[-scale, scale], background=True)
with fig.set_panel(panel=0):
# Plot magnetic anomaly grid
fig.grdimage(
grid=grid_data,
cmap=True,
)
# Add colorbar
fig.colorbar(
frame='af+l"Magnetic anomaly [nT]"',
position="JBC+h+o0/1c+e",
)
with fig.set_panel(panel=1):
# Plot upward reduced to the pole grid
fig.grdimage(grid=tmi_rtp, cmap=True)
# Add colorbar
fig.colorbar(
frame='af+l"Reduced to the pole [nT]"',
position="JBC+h+o0/1c+e",
)
fig.show()
But it is showing me: "AttributeError: module ‘pygmt.datasets’ has no attribute ‘Grid’.
Thanks in advance.