Skip to content

Better typings for open_rasterio #856

@renaudjester

Description

@renaudjester

Hi all!

I was wondering if it could be considered to improve the typings for rioxarray.open_rasterio.

Indeed, the returned typings are

xarray.Dataset | xarray.DataArray | list[xarray.Dataset]

Creating so many typing issues in the code, like:

Cannot access attribute "attrs" for class "list[Dataset]"
  Attribute "attrs" is unknown. Pylance[reportAttributeAccessIssue]

The solution would be to ignore the type or check everywhere if the instance is a list, which is not a clean solution IMO.

It would be amazing if you would consider only returning xarray.Dataset | xarray.DataArray for this function.

Have a great day!

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