Merging grd files

How would I merge two or more grid files in pyGMT? Would I use the grdcut and grdpaste commands like in GMT? I can’t find this in the documentation.

PyGMT has grdcut (see https://www.pygmt.org/v0.5.0/api/generated/pygmt.grdcut.html), but grdpaste is not wrapped yet. If you’re using Jupyter though, you can try a using an exclamation mark to run GMT command, e.g. !gmt grdpaste file_a.nc file_b.nc -Goutfile.nc -V -fg.

Depending on how you want to merge your grid files though, there may be a way to do it using xarray too. See https://xarray.pydata.org/en/v0.19.0/user-guide/combining.html. Do you want to mosaic different tiles, concatenate along some dimension, take the mean of a stack of grids, etc? I’m assuming you’re working on the GMRT grids from Importing GMRT data as a grid in pyGMT?

Hi @weiji14, thank you for all this! I ended up not needed to make a mosaic because I got the whole file downloaded - it seems like GMRT only allows downloads up to 1GB…

I do want to overlay/stack two bathymetry datasets though, do you know how to do this?

https://docs.generic-mapping-tools.org/latest/grdblend.html?