Help regarding "grdclip" of pygmt

I am very new to pygmt. I was trying to run one code ( grid = pygmt.grdclip(grid, below=[0, -2000]) ) but getting this error, AttributeError: module ‘pygmt’ has no attribute ‘grdclip’. Any suggestions will be highly appreciated.

What output do you receive from running pygmt.show_versions?

Hi Meghan,

Thank you very much for your reply. Here are the pygmt version details.

PyGMT information:
version: v0.2.0
System information:
python: 3.8.3 | packaged by conda-forge | (default, Jun 1 2020, 17:43:00) [GCC 7.5.0]
executable: /home/anaconda3/envs/cdat8/bin/python
machine: Linux-5.8.0-63-generic-x86_64-with-glibc2.10
Dependency information:
numpy: 1.19.2
pandas: 1.2.3
xarray: 0.16.2
packaging: 20.9
ghostscript: 9.53.3
gmt: 6.1.1
GMT library information:
binary dir: /home/anaconda3/envs/cdat8/bin
cores: 16
grid layout: rows
library path: /home/anaconda3/envs/cdat8/lib/
padding: 2
plugin dir: /home/anaconda3/envs/cdat8/lib/gmt/plugins
share dir: /home/anaconda3/envs/cdat8/share/gmt
version: 6.1.1

The command is not working because your environment has PyGMT v0.2.0 installed and the grdclip function was added in v0.4.0. You can see the changes associated with each release here: You could update your conda environment or create a new environment with the latest versions in order to use grdclip.