Skip to content

Return xarray.DataArray if outgrid is None #1807

@maxrjones

Description

@maxrjones

Description of the desired feature

For the triangulate draft and grdhisteq, we return an xarray.DataArray if outgrid is True or None, but for other functions we require outgrid to be None to return an xarray.DataArray. Here is an example (requires gridding/triangulate branch):

import pygmt
grid = pygmt.triangulate.regular_grid(
    data="@Table_5_11.txt",
    region=[-0.2,  6.6, -0.2, 6.6],
    spacing=0.2,
    outgrid=True
) # Works
filtered_grid = pygmt.grdfilter(
    grid,
    distance=0,
    filter="c1",
    outgrid=True
) # Fails with "grdfilter [ERROR]: No filename provided"

I would prefer that we return an xarray.DataArray when outgrid is True or None, but otherwise grdhisteq and triangulate should be revised for consistency if we chose to require outgrid to be unset.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions