Skip to content

Default CPTs for GMT remote datasets #2325

@seisman

Description

@seisman

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

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")

map

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")

map

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions