Skip to content

Changes to assignment warning in sel/isel methods #9869

@JanukanS

Description

@JanukanS

What is your issue?

I have a few suggestions on the warning against value assignment in the DataArray.sel documentation. I wanted to get a maintainer's opinion on if these changes are helpful before I submit a PR.

1. Similar functions should have this warning
DataArray.isel, Dataset.sel and Dataset.isel also can't be used for value assignment and should have a similar warning on their documentation page.

2. Warning should be specific to the function
Each warning should only warn against using a specific function. Currently the warning on DataArray.sel warns against using either DataArray.sel or DataArray.isel. The code example in the warning should use a specific function. The example in the DataArray.sel warning currently uses the isel method.

3. Warning should tell user how to properly assign values
The warning currently tells the user not to use isel/sel for value assignment but doesn't direct the user towards an alternative. The code example currently tells the user what not to do. The example can be extended by a line to show the correct way (i.e. direct/loc indexing)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions