Skip to content

should guess_coord_axis optionally create a variable for unindexed coordinates #266

Open
@dcherian

Description

@dcherian
da = xr.DataArray(np.ones(2,3), dims=("x", "y"))

This kind of dataarray exists in CMIP datasets. x,y have absolutely no data (no values, no attrs) associated with them, and so guess_coord_axis does not do anything.

We could have .cf.guess_coord_axis(add_indexes=True) that effectively does

da["x"] = np.arange(da.sizes["x"])
da["y"] = np.arange(da.sizes["y"])

# now do the guessing

This will assign axis='X' and axis='Y' appropriately. I think this would be an OK opt-in feature, though we need a better name than add_indexes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions