Skip to content

Add full support for xarray decode_coords #282

@alexamici

Description

@alexamici

xarray 0.17.0 has introduced a way to optionally keep most auxiliary variables associated with a main variable, including grid_mapping, inside the corresponding DataArray: pydata/xarray#2844

See: http://xarray.pydata.org/en/stable/weather-climate.html?highlight=decode_coords#related-variables

Current behaviour of open_rasterio is to always add the spacial_ref coordinate with CF attributes, so it is similar to always assuming decode_coords="all" (similar but not identical as the grid_mapping key / value pair is in DataArray.attrs instead of DataArray.encoding).

Fully supporting decode_coords while attempting to minimise change means that open_rasterio would return a Dataset for decode_coords="coordinates" and continue returning a DataArray for decode_coords="all" that would be the default.

I would find such an interface very confusing, but open_rasterio already returns different types for different arguments so I'm not sure.

Alternatively we could add a new interface that always return a Dataset. That would also make adding a plugin for the new backend API or xarray very easy (see #281).

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalIdea for a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions