Skip to content

Make a gmt xarray accessor to store metadata from grdinfo #499

Open
@weiji14

Description

@weiji14

Description of the desired feature

Metadata (data about data) is important, and there are specific kinds of metadata used by GMT when it decides how to plot a grid, such as:

Instead of explicitly wrapping gmt info or gmt grdinfo as in #147, why not allow the user to just access it via grid.gmt.someattribute? This would make use of xarray accessors and call grdinfo under the hood to retrieve those metadata properties.

Pros:

Cons:

  • We would be designing yet another standard, as per https://xkcd.com/927/
  • Would involve some development effort
  • Might not be as discoverable as simply using grid.attrs["someattribute"] or pygmt.grdinfo(grid), but that's just a documentation thing.

In reality, this gmt accessor can do more than just hold metadata. We could extend it to do grid.gmt.plot and more. But let's start with having it hold the metadata we want, and then build on top of it from there.

References:

Other xarray accessor examples:

Are you willing to help implement and maintain this feature? Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature wantedhelp wantedHelping hands are appreciatedlongtermLong standing issues that need to be resolved

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions