Search code examples
pygmt

How to set the elevations of sea to a common negative value in GMT6.1?


I want to draw a relief of some region (sea and land involved), but I DO NOT want to show the variation of marine bathymetry, so I must set them to a common negative value to make sure that all the bathymetry map to the same color, like lightblue. I don't know how to do it?


Solution

  • That's easy using grdclip. When using command line GMT you can try:

    gmt grdclip grid -Ggrid_clipped -Sb0/-1000 -V
    

    which sets all values of your input grid grid< 0 to -1000 (adjust the values for your needs) and writes the clipped grid to outfile grid_clipped.

    If you're using PyGMT you can try:

    import pygmt 
    
    grid = pygmt.grdclip(grid, below = [0, -1000])
    

    where you can directly hand the clipped grid to another PyGMT function for plotting like fig.grdimage(grid = grid).