id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type
1691206894,I_kwDOAMm_X85kzcTu,7802,Mypy errors with matplotlib 3.8,14371165,closed,0,,,6,2023-05-01T19:03:51Z,2023-09-17T05:03:00Z,2023-09-17T05:02:59Z,MEMBER,,,,"Matplotlib has started to support typing in main (https://github.com/matplotlib/matplotlib/issues/20504) and mypy is throwing a few errors:
```
xarray/core/options.py:12: error: Cannot assign to a type [misc]
xarray/core/options.py:12: error: Incompatible types in assignment (expression has type ""Type[str]"", variable has type ""Type[Colormap]"") [assignment]
xarray/plot/utils.py:808: error: Argument 1 to ""set_xticks"" of ""_AxesBase"" has incompatible type ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]""; expected ""Iterable[float]"" [arg-type]
xarray/plot/utils.py:810: error: Argument 1 to ""set_yticks"" of ""_AxesBase"" has incompatible type ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]""; expected ""Iterable[float]"" [arg-type]
xarray/plot/utils.py:813: error: Argument 1 to ""set_xlim"" of ""_AxesBase"" has incompatible type ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]""; expected ""Union[float, Tuple[float, float], None]"" [arg-type]
xarray/plot/utils.py:815: error: Argument 1 to ""set_ylim"" of ""_AxesBase"" has incompatible type ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]""; expected ""Union[float, Tuple[float, float], None]"" [arg-type]
Generated Cobertura report: /home/runner/work/xarray/xarray/mypy_report/cobertura.xml
Installing missing stub packages:
/home/runner/micromamba-root/envs/xarray-tests/bin/python -m pip install types-Pillow types-PyYAML types-Pygments types-babel types-colorama types-paramiko types-psutil types-pytz types-pywin32 types-setuptools types-urllib3
Generated Cobertura report: /home/runner/work/xarray/xarray/mypy_report/cobertura.xml
Found 154 errors in 10 files (checked 138 source files)
xarray/plot/utils.py:1349: error: Unsupported operand types for * (""_SupportsArray[dtype[Any]]"" and ""float"") [operator]
xarray/plot/utils.py:1349: error: Unsupported operand types for * (""_NestedSequence[_SupportsArray[dtype[Any]]]"" and ""float"") [operator]
xarray/plot/utils.py:1349: error: Unsupported operand types for * (""_NestedSequence[Union[bool, int, float, complex, str, bytes]]"" and ""float"") [operator]
xarray/plot/utils.py:1349: note: Left operand is of type ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]""
xarray/plot/utils.py:1349: error: Unsupported operand types for * (""str"" and ""float"") [operator]
xarray/plot/utils.py:1349: error: Unsupported operand types for * (""bytes"" and ""float"") [operator]
xarray/plot/utils.py:1350: error: Item ""_SupportsArray[dtype[Any]]"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1350: error: Item ""_NestedSequence[_SupportsArray[dtype[Any]]]"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1350: error: Item ""int"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1350: error: Item ""float"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1350: error: Item ""complex"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1350: error: Item ""str"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1350: error: Item ""bytes"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1350: error: Item ""_NestedSequence[Union[bool, int, float, complex, str, bytes]]"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1351: error: Item ""_SupportsArray[dtype[Any]]"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1351: error: Item ""_NestedSequence[_SupportsArray[dtype[Any]]]"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1351: error: Item ""int"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1351: error: Item ""float"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1351: error: Item ""complex"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1351: error: Item ""str"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1351: error: Item ""bytes"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/utils.py:1351: error: Item ""_NestedSequence[Union[bool, int, float, complex, str, bytes]]"" of ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" has no attribute ""mask"" [union-attr]
xarray/plot/facetgrid.py:684: error: ""FigureCanvasBase"" has no attribute ""get_renderer"" [attr-defined]
xarray/plot/accessor.py:182: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/accessor.py:182: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/accessor.py:309: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/accessor.py:309: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/accessor.py:428: error: Overloaded function implementation cannot produce return type of signature 2 [misc]
xarray/plot/accessor.py:428: error: Overloaded function implementation cannot produce return type of signature 3 [misc]
xarray/plot/accessor.py:433: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/accessor.py:433: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/accessor.py:552: error: Overloaded function implementation cannot produce return type of signature 2 [misc]
xarray/plot/accessor.py:552: error: Overloaded function implementation cannot produce return type of signature 3 [misc]
xarray/plot/accessor.py:557: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/accessor.py:557: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/accessor.py:676: error: Overloaded function implementation cannot produce return type of signature 2 [misc]
xarray/plot/accessor.py:676: error: Overloaded function implementation cannot produce return type of signature 3 [misc]
xarray/plot/accessor.py:681: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/accessor.py:681: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/accessor.py:800: error: Overloaded function implementation cannot produce return type of signature 2 [misc]
xarray/plot/accessor.py:800: error: Overloaded function implementation cannot produce return type of signature 3 [misc]
xarray/plot/accessor.py:948: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/accessor.py:948: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/accessor.py:1075: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/accessor.py:1075: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/accessor.py:1190: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/accessor.py:1190: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/dataset_plot.py:324: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/dataset_plot.py:324: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/dataset_plot.py:478: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/dataset_plot.py:478: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""x"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""y"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""u"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""v"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""density"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""linewidth"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""color"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""cmap"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""norm"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""arrowsize"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""arrowstyle"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""minlength"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""transform"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""zorder"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""start_points"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""maxlength"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""integration_direction"" [misc]
xarray/plot/dataset_plot.py:649: error: Function gets multiple values for keyword argument ""broken_streamlines"" [misc]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type ""*List[ndarray[Any, Any]]""; expected ""Union[float, Tuple[float, float]]"" [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type ""*List[ndarray[Any, Any]]""; expected ""Union[str, Colormap, None]"" [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type ""*List[ndarray[Any, Any]]""; expected ""Union[str, Normalize, None]"" [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type ""*List[ndarray[Any, Any]]""; expected ""float"" [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type ""*List[ndarray[Any, Any]]""; expected ""Union[str, ArrowStyle]"" [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type ""*List[ndarray[Any, Any]]""; expected ""Optional[Transform]"" [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type ""*List[ndarray[Any, Any]]""; expected ""Optional[float]"" [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type ""*List[ndarray[Any, Any]]""; expected ""Literal['forward', 'backward', 'both']"" [arg-type]
xarray/plot/dataset_plot.py:649: error: Argument 1 has incompatible type ""*List[ndarray[Any, Any]]""; expected ""bool"" [arg-type]
xarray/plot/dataset_plot.py:751: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/dataset_plot.py:751: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/dataarray_plot.py:718: error: Incompatible return value type (got ""Tuple[Union[ndarray[Any, Any], List[ndarray[Any, Any]]], ndarray[Any, Any], Union[BarContainer, Polygon, List[Union[BarContainer, Polygon]]]]"", expected ""Tuple[ndarray[Any, Any], ndarray[Any, Any], BarContainer]"") [return-value]
xarray/plot/dataarray_plot.py:996: error: ""Axes"" has no attribute ""view_init"" [attr-defined]
xarray/plot/dataarray_plot.py:1106: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/dataarray_plot.py:1106: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/dataarray_plot.py:1261: error: Argument 1 to ""scatter"" of ""Axes"" has incompatible type ""*List[ndarray[Any, Any]]""; expected ""Union[Sequence[Union[Union[Tuple[float, float, float], str], Union[str, Tuple[float, float, float, float], Tuple[Union[Tuple[float, float, float], str], float], Tuple[Tuple[float, float, float, float], float]]]], Union[Union[Tuple[float, float, float], str], Union[str, Tuple[float, float, float, float], Tuple[Union[Tuple[float, float, float], str], float], Tuple[Tuple[float, float, float, float], float]]], None]"" [arg-type]
xarray/plot/dataarray_plot.py:1261: error: Argument 1 to ""scatter"" of ""Axes"" has incompatible type ""*List[ndarray[Any, Any]]""; expected ""Optional[Union[str, Path, MarkerStyle]]"" [arg-type]
xarray/plot/dataarray_plot.py:1261: error: Argument 1 to ""scatter"" of ""Axes"" has incompatible type ""*List[ndarray[Any, Any]]""; expected ""Union[str, Colormap, None]"" [arg-type]
xarray/plot/dataarray_plot.py:1261: error: Argument 1 to ""scatter"" of ""Axes"" has incompatible type ""*List[ndarray[Any, Any]]""; expected ""Union[str, Normalize, None]"" [arg-type]
xarray/plot/dataarray_plot.py:1261: error: Argument 1 to ""scatter"" of ""Axes"" has incompatible type ""*List[ndarray[Any, Any]]""; expected ""Optional[float]"" [arg-type]
xarray/plot/dataarray_plot.py:1261: error: Argument 1 to ""scatter"" of ""Axes"" has incompatible type ""*List[ndarray[Any, Any]]""; expected ""Union[float, Sequence[float], None]"" [arg-type]
xarray/plot/dataarray_plot.py:1615: error: ""Axes"" has no attribute ""set_zlabel"" [attr-defined]
xarray/plot/dataarray_plot.py:1655: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/dataarray_plot.py:1655: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/dataarray_plot.py:1874: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/dataarray_plot.py:1874: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/dataarray_plot.py:2010: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/dataarray_plot.py:2010: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/dataarray_plot.py:2146: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
xarray/plot/dataarray_plot.py:2146: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
xarray/plot/dataarray_plot.py:2464: error: ""Axes"" has no attribute ""plot_surface"" [attr-defined]
xarray/tests/test_plot.py:427: error: Value of type ""Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"" is not indexable [index]
xarray/tests/test_plot.py:443: error: Module has no attribute ""viridis"" [attr-defined]
xarray/tests/test_plot.py:457: error: ""None"" not callable [misc]
xarray/tests/test_plot.py:462: error: ""None"" not callable [misc]
xarray/tests/test_plot.py:465: error: ""None"" not callable [misc]
xarray/tests/test_plot.py:471: error: Module has no attribute ""viridis"" [attr-defined]
xarray/tests/test_plot.py:477: error: Module has no attribute ""viridis"" [attr-defined]
xarray/tests/test_plot.py:482: error: Module has no attribute ""viridis"" [attr-defined]
xarray/tests/test_plot.py:486: error: Module has no attribute ""viridis"" [attr-defined]
xarray/tests/test_plot.py:493: error: ""None"" not callable [misc]
xarray/tests/test_plot.py:498: error: ""None"" not callable [misc]
xarray/tests/test_plot.py:501: error: ""None"" not callable [misc]
xarray/tests/test_plot.py:931: error: Module has no attribute ""magma"" [attr-defined]
xarray/tests/test_plot.py:933: error: Module has no attribute ""magma"" [attr-defined]
xarray/tests/test_plot.py:1173: error: Module has no attribute ""RdBu"" [attr-defined]
xarray/tests/test_plot.py:1746: error: Item ""Colormap"" of ""Optional[Colormap]"" has no attribute ""colors"" [union-attr]
xarray/tests/test_plot.py:1746: error: Item ""None"" of ""Optional[Colormap]"" has no attribute ""colors"" [union-attr]
xarray/tests/test_plot.py:1747: error: Item ""Colormap"" of ""Optional[Colormap]"" has no attribute ""colors"" [union-attr]
xarray/tests/test_plot.py:1747: error: Item ""None"" of ""Optional[Colormap]"" has no attribute ""colors"" [union-attr]
xarray/tests/test_plot.py:1749: error: Item ""Colormap"" of ""Optional[Colormap]"" has no attribute ""_rgba_over"" [union-attr]
xarray/tests/test_plot.py:1749: error: Item ""None"" of ""Optional[Colormap]"" has no attribute ""_rgba_over"" [union-attr]
xarray/tests/test_plot.py:1801: error: Item ""None"" of ""Optional[ndarray[Any, Any]]"" has no attribute ""size"" [union-attr]
xarray/tests/test_plot.py:1952: error: Item ""None"" of ""Optional[ndarray[Any, Any]]"" has no attribute ""min"" [union-attr]
xarray/tests/test_plot.py:1952: error: Item ""None"" of ""Optional[ndarray[Any, Any]]"" has no attribute ""max"" [union-attr]
xarray/tests/test_plot.py:1968: error: Item ""None"" of ""Optional[ndarray[Any, Any]]"" has no attribute ""dtype"" [union-attr]
xarray/tests/test_plot.py:1969: error: Value of type ""Optional[ndarray[Any, Any]]"" is not indexable [index]
xarray/tests/test_plot.py:2125: error: ""Artist"" has no attribute ""get_clim"" [attr-defined]
xarray/tests/test_plot.py:2135: error: ""Colorbar"" has no attribute ""vmin"" [attr-defined]
xarray/tests/test_plot.py:2136: error: ""Colorbar"" has no attribute ""vmax"" [attr-defined]
xarray/tests/test_plot.py:2202: error: ""Artist"" has no attribute ""get_clim"" [attr-defined]
xarray/tests/test_plot.py:2218: error: ""Artist"" has no attribute ""norm"" [attr-defined]
xarray/tests/test_plot.py:2747: error: Item ""_AxesBase"" of ""Optional[_AxesBase]"" has no attribute ""legend_"" [union-attr]
xarray/tests/test_plot.py:2747: error: Item ""None"" of ""Optional[_AxesBase]"" has no attribute ""legend_"" [union-attr]
xarray/tests/test_plot.py:2754: error: Item ""None"" of ""Optional[_AxesBase]"" has no attribute ""get_legend"" [union-attr]
xarray/tests/test_plot.py:2775: error: Item ""None"" of ""Optional[FigureBase]"" has no attribute ""axes"" [union-attr]
xarray/tests/test_plot.py:2775: error: Argument 1 to ""len"" has incompatible type ""Union[_AxesBase, None, Any]""; expected ""Sized"" [arg-type]
xarray/tests/test_plot.py:2803: error: Module has no attribute ""dates"" [attr-defined]
xarray/tests/test_plot.py:2812: error: Module has no attribute ""dates"" [attr-defined]
xarray/tests/test_plot.py:2831: error: Item ""None"" of ""Optional[_AxesBase]"" has no attribute ""xaxis"" [union-attr]
xarray/tests/test_plot.py:2831: error: Module has no attribute ""dates"" [attr-defined]
xarray/tests/test_groupby.py:715: error: Argument 1 to ""groupby"" of ""Dataset"" has incompatible type ""ndarray[Any, dtype[signedinteger[Any]]]""; expected ""Union[Hashable, DataArray, IndexVariable]"" [arg-type]
xarray/tests/test_groupby.py:715: note: Following member(s) of ""ndarray[Any, dtype[signedinteger[Any]]]"" have conflicts:
xarray/tests/test_groupby.py:715: note: __hash__: expected ""Callable[[], int]"", got ""None""
xarray/tests/test_dataset.py:6964: error: ""PlainQuantity[Any]"" not callable [operator]
xarray/tests/test_dataset.py:6965: error: ""PlainQuantity[Any]"" not callable [operator]
xarray/tests/test_dataset.py:7007: error: ""PlainQuantity[Any]"" not callable [operator]
xarray/tests/test_dataset.py:7008: error: ""PlainQuantity[Any]"" not callable [operator]
xarray/tests/test_dataarray.py:6687: error: ""PlainQuantity[Any]"" not callable [operator]
xarray/tests/test_dataarray.py:6689: error: ""PlainQuantity[Any]"" not callable [operator]
xarray/tests/test_dataarray.py:6735: error: ""PlainQuantity[Any]"" not callable [operator]
xarray/tests/test_dataarray.py:6737: error: ""PlainQuantity[Any]"" not callable [operator]
```
Some guidance how to solve these:
> - `[xy]ticks` in mpl is currently overly narrowly type hinted because I was following the docstring, but I agree that `ArrayLike` is a better type hint for that, plan on updating (including the docstring) upstream
> - `[xy]lim` originally neglected the case of passing `set_xlim((min, max))` as a tuple, but that has been updated. xarray has that type hinted as array like, but mpl has it hinted as a 2-tuple (I think it is currently still of floats, but may be expanded as we more directly address units/categoricals/etc). Willing to debate here, but my starting position is that the ""exactly 2 values"" is valuable info here, and I think `tuple` is the only way to do that.
> - `get_renderer` is not actually available on all of our backends, we should maybe see if there is a more preferred way of doing what you are doing here that will work for all backends, but haven't looked into it too closely.
> - `Module has no attribute ` is another instance of dynamically generated behavior which can't be statically type checked (elegantly, at least), can probably be replaced by `mpl.colormaps[""""]` in many cases, which is statically typecheckable
> - Anything to do with 3D Axes is not type hinted, perhaps ignore for now (or help us get that type hinted adequately, but it is relatively low priority currently)
> - `Module has no attribute ""dates""` we don't currently type hint dates/units things, but it is on my mind, not sure yet if it will be in first release or not though (may at least put a placeholder that gets rid of this error, but treats everything as ""Any"").
_Originally posted by @ksunden in https://github.com/pydata/xarray/issues/7787#issuecomment-1523743471_
> The suggestion from mpl (specifically @tacaswell) was to use [constrained layout](https://matplotlib.org/stable/tutorials/intermediate/constrainedlayout_guide.html) for the purpose that xarray currently uses `get_renderer`, this will ensure that the `facetgrid` works with all mpl backends.
_Originally posted by @ksunden in https://github.com/pydata/xarray/issues/7787#issuecomment-1528091492_
> I'm also relatively sure that if you are willing to put a floor on the version of Matplotlib you support `get_window_extent` will use it's internally cached renderer (and when we make it uniformly optional we also fixed the cache invalidation logic).
_Originally posted by @tacaswell in https://github.com/pydata/xarray/issues/7787#issuecomment-1528096647_
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7802/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue
1826978659,I_kwDOAMm_X85s5Xtj,8028,Setting datarrays with non-dimension coordinates errors,14371165,open,0,,,6,2023-07-28T19:20:31Z,2023-08-10T15:25:23Z,,MEMBER,,,,"### What happened?
I'm not sure if this is a bug or a feature but I was expecting this example to work since the new coord is just a slight rewrite of the original dimension coordinate:
```python
import xarray as xr
ds = xr.tutorial.open_dataset(""air_temperature"")
# Change the first time value:
ds[""air_new""] = ds.air.copy()
air_new_changed = ds.air_new[{""time"": 0}] * 3
ds.air_new.loc[air_new_changed.coords] = air_new_changed # Works! :)
# Add a another coord along time axis and change
# the first time value:
ds[""air_new""] = ds.air.copy().assign_coords(
{""time_float"": ds.time.astype(float)}
)
air_new_changed = ds.air_new[{""time"": 0}] * 4
ds.air_new.loc[air_new_changed.coords] = air_new_changed # Error! :(
Traceback (most recent call last):
Cell In[25], line 5
ds.air_new.loc[air_new_changed.coords] = air_new_changed
File ~\AppData\Local\mambaforge\envs\jw\lib\site-packages\xarray\core\dataarray.py:222 in __setitem__
dim_indexers = map_index_queries(self.data_array, key).dim_indexers
File ~\AppData\Local\mambaforge\envs\jw\lib\site-packages\xarray\core\indexing.py:182 in map_index_queries
grouped_indexers = group_indexers_by_index(obj, indexers, options)
File ~\AppData\Local\mambaforge\envs\jw\lib\site-packages\xarray\core\indexing.py:144 in group_indexers_by_index
raise KeyError(f""no index found for coordinate {key!r}"")
KeyError: ""no index found for coordinate 'time_float'""
```
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8028/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue