How to plot temperature?

The error message implies that your longitude values are not equally spaced (i.e. it is an irregular grid). In your screenshot for example, 86.06917-86.027504=0.041666 is not equal to 86.027504-85.98584=0.041664. You will need to ensure that the longitude values are equally spaced before plotting in PyGMT/GMT.

One solution would be to use xarray’s interp function to interpolate your irregular grid onto a regular grid. You will need to specify the new coords (coordinate values), and the interp function will perform linear interpolation to convert your old grid into a new grid. The new grid can then be plotted with PyGMT/GMT.

1 Like