Pygmt.makecpt error (Module 'grdinfo' failed with status code 72:)

Hi
I have a problem at pygmt.makecpt
because of this error
I can’t do anything
please help me

  1. error message
-------------------------------------------------------------------------
GMTCLibError: Module 'grdinfo' failed with status code 72:
grdinfo [ERROR]: File /Users/prince_ha/Desktop/pyhton was not found
grdinfo [ERROR]: Cannot find file /Users/prince_ha/Desktop/pyhton
grdinfo [ERROR]: Cannot find file practice/fatiando
grdinfo [ERROR]: Cannot find file processing2/gebco_2022_n40.0_s20.0_w120.0_e135.0.nc
grdinfo [ERROR]: Must specify one or more input files
-------------------------------------------------------------------------
  1. my topography data
    data’s name is topography

  1. pygmt.makecpt code
    fig = pygmt.Figure()
    pygmt.makecpt(cmap=“earth”, series=[topography.values.min(), topography.values.max()])
    fig.grdimage(topography, shading=True, projection=“M12c”, frame=True)
    fig.colorbar(frame=‘af+l"topography [m]"’)
    fig.show()

this code make a error

thanks happy new year

Hello @prince-Ha,
welcome to the GMT forum and also a happy new year!

Thanks for providing your code. I feel it would be helpful, if you please can also provide your data as a file not only as a screenshot :slightly_smiling_face:. Currently, it is difficult to infer what is going wrong in detail.

You are writing you have problems with pygmt.makecpt, but the posted error message is more related to pygmt.grdinfo (, which is not explicitly used in your code below). Looking at the file paths, I am wondering whether they contain a typo:

grdinfo [ERROR]: File /Users/prince_ha/Desktop/pyhton  was not found 
# <- maybe a typo in "pyhton"  and it should be "python"?

Your code looks good to me so far. I complete your example using a remote dataset provided by GMT or PyGMT:

import pygmt

# Use the Earth relief grid provided by GMT or PyGMT as input data
# Load the default grid (gridline-registered 1 arc-degree grid) 
# in a xarray.DataArray
# For details please see the documentation at
# https://www.pygmt.org/latest/api/generated/pygmt.datasets.load_earth_relief.html#pygmt.datasets.load_earth_relief
topography = pygmt.datasets.load_earth_relief()


# Create new Figure object
fig = pygmt.Figure()

# Set up colormap for the elevation
pygmt.makecpt(cmap="earth",
              series=[topography.values.min(), topography.values.max()],
)

# Plot the elevation grid with color-coding
fig.grdimage(
    grid=topography,
    projection="W12c",  # Mollweide projection
    frame=True,
    # cmap=True,
)

# Add a colorbar for elevation grid
fig.colorbar(frame="+lelevation / m")

fig.show()

# fig.savefig(fname="makecpt_problem_GMTforum.png")

Output figure:

I’m sorry for the late reply because I didn’t know there was an answer. This problem was solved by using data from a uniform grid of gmt remote. Thank you. Happy new year.