home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

1 row where state = "closed" and user = 42851573 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date), closed_at (date)

type 1

  • issue 1

state 1

  • closed · 1 ✖

repo 1

  • xarray 1
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
1183858748 I_kwDOAMm_X85GkEA8 6424 DataArray.plot.contourf() fails when data has no positive values ellequelle 42851573 closed 0     3 2022-03-28T19:00:33Z 2022-03-30T14:28:51Z 2022-03-30T14:28:51Z NONE      

What happened?

For a DataArray with no positive values, the plot.contourf() fails to produce the correct figure. It makes the contourf plot and returns successfully, but emits several warnings and does not complete the colorbar. Two sample screenshots are in \

below.

The plot.contour() function has the same behavior, but only when add_colorbar=True.

What did you expect to happen?

No response

Minimal Complete Verifiable Example

Python import xarray as XR da = xr.DataArray(np.arange(20).reshape(4,5), dims=('x','y')) da.plot.contourf() # successful (first image below) (da-19).plot.contourf() # fails (second image below)

Relevant log output

```Python

da = xr.DataArray(np.arange(20).reshape(4,5), dims=('x','y'))

da <xarray.DataArray (x: 4, y: 5)> array([[ 0, 1, 2, 3, 4], [ 5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19]]) Dimensions without coordinates: x, y

da.plot.contourf() # successful (first image below) <matplotlib.contour.QuadContourSet at 0x299dc2940>

(da-18).plot.contourf() # successful <matplotlib.contour.QuadContourSet at 0x299dc2940>

(da-19).plot.contourf() # fails (second image below) <matplotlib.contour.QuadContourSet at 0x299dc2940> ~/miniconda3/envs/plots/lib/python3.9/site-packages/matplotlib/transforms.py:2663: RuntimeWarning: divide by zero encountered in double_scalars y_scale = 1.0 / inh ~/miniconda3/envs/plots/lib/python3.9/site-packages/matplotlib/transforms.py:2665: RuntimeWarning: invalid value encountered in double_scalars [0.0 , y_scale, (-inb*y_scale)], posx and posy should be finite values posx and posy should be finite values posx and posy should be finite values posx and posy should be finite values

da-19 <xarray.DataArray (x: 4, y: 5)> array([[-19, -18, -17, -16, -15], [-14, -13, -12, -11, -10], [ -9, -8, -7, -6, -5], [ -4, -3, -2, -1, 0]]) Dimensions without coordinates: x, y ```

Anything else we need to know?

Screenshots of plots ```python > da.plot.contourf() # successful ``` ```python > (da-19).plot.contourf() # fails ```

Environment

xr.show_versions() miniconda3/envs/plots/lib/python3.9/site-packages/_distutils_hack/__init__.py:30: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") INSTALLED VERSIONS ------------------ commit: None python: 3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:25:14) [Clang 12.0.1 ] python-bits: 64 OS: Darwin OS-release: 21.3.0 machine: arm64 processor: arm byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.1 libnetcdf: 4.8.1 xarray: 2022.3.0 pandas: 1.3.5 numpy: 1.21.5 scipy: 1.7.1 netCDF4: 1.5.7 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.6.0 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.3.4 dask: 2022.03.0 distributed: None matplotlib: 3.5.0 cartopy: 0.20.2 seaborn: None numbagg: None fsspec: 2022.02.0 cupy: None pint: None sparse: None setuptools: 61.2.0 pip: 22.0.4 conda: None pytest: None IPython: 7.29.0 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6424/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 252.104ms · About: xarray-datasette