Problem in plot

Hello everyone, my problem is that countering is not smooth, I want to eliminate point shapes as indicated by A2, A3, A5, A6, and A7 in the SECTION.png.
Using grdimage, I tried many options of interpolation, but no way.
I am deeply hoping to get a solution.

I appreciate any help you can provide.
my code and data are attached below.


x-y-z.TXT (632.0 KB)

import pygmt
with open("x-y-z.TXT", "r") as file2:
    xyz_coords = [list(map(float, line.split())) for line in file2]
x_coords2 = [point[0] for point in xyz_coords]
y_coords2 = [point[1] for point in xyz_coords]
z_coords2 = [point[2] for point in xyz_coords]

regions = [0.0, 20000, 0, 4000]
frames = "af"
dpis = '50'
bitcolors = '255'
projections = "X10i/-3i"

fig = pygmt.Figure()

data = pygmt.blockmean(x=x_coords2, y=y_coords2, z=z_coords2, spacing=(10, 10), region=regions)
grid = pygmt.surface(data=data, spacing=(10, 10), lower='30', upper='3900', region=regions)

with pygmt.config(FONT_LABEL='9', FONT_ANNOT_PRIMARY='6', MAP_LABEL_OFFSET='0.1', MAP_ANNOT_OFFSET_PRIMARY='0.001',
                  MAP_FRAME_PEN='0.7',FONT_ANNOT_SECONDARY='9'):
    fig.grdimage(grid=grid, projection=projections, interpolation="b", cmap="no_green", dpi=dpis, bitcolor=bitcolors)
    fig.colorbar(frame=["a1000", "y+lz"], truncate=[30, 3900], position = "x0.0/-0.6+w7c/0.3c+h")
    fig.basemap(region=regions, projection=projections, frame=["WsNe","xaf+lx","ya1000f500+ly"])

fig.savefig("SECTION.png")
fig.show()

your profile data look not good for what you are doing, many identical values with abrupt stepwise changes. plot and check the individual profiles or just scroll through your text file.

in other words, you should do something with your data and/or adjust interpolation method (surface) and probably test interpolation methods other than surface. This is nothing grdimage can help you with.

see example 16 maybe also example 12 and 14 in the gmt illustration gallery. The example data is nothing like yours (example data are arbitrarily spaced while your are not) but you can get some idea of how you can choose and adjust interpolation method.