-
Notifications
You must be signed in to change notification settings - Fork 235
Description
Most GMT remote datasets have a default CPT. When plotting a dataset without specifying a CPT, the default CPT will be used. For example, the default CPT for earth_age dataset is @earth_age.cpt.
The following command plots the earth_age_01d_g.nc grid using the default @earth_age.cpt file.
gmt grdimage @earth_age_01d_g -png map
In the following PyGMT script, a grid file name is directly passed to Figure.grdimage. This script produces the indentical image:
import pygmt
fig = pygmt.Figure()
fig.grdimage(grid="@earth_age_01d_g")
fig.colorbar(frame=True)
fig.savefig("map.png")However, if we load the dataset into a xarray.DataArray and pass it to Figure.grdimage, the default CPT changes to "turbo" (GMT's default CPT for any grid data).
import pygmt
from pygmt.datasets import load_earth_age
grid = load_earth_age()
fig = pygmt.Figure()
fig.grdimage(grid=grid)
fig.colorbar()
fig.savefig("map.png")It would be good if PyGMT can use the specific CPT when a CPT is not specified, although it's technically difficult. At least we should document the default CPT for each dataset and add an example showing how to use the default dataset CPT.


