home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

12 rows where author_association = "MEMBER", issue = 187208913 and user = 10050469 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: reactions, updated_at (date)

user 1

  • fmaussion · 12 ✖

issue 1

  • New infer_intervals keyword for pcolormesh · 12 ✖

author_association 1

  • MEMBER · 12 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
259734708 https://github.com/pydata/xarray/pull/1079#issuecomment-259734708 https://api.github.com/repos/pydata/xarray/issues/1079 MDEyOklzc3VlQ29tbWVudDI1OTczNDcwOA== fmaussion 10050469 2016-11-10T16:21:28Z 2016-11-10T16:21:28Z MEMBER

I had to modify your code a little bit for this to work, but this is now accepting any axis. Quite a useful function actually!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  New infer_intervals keyword for pcolormesh 187208913
259249333 https://github.com/pydata/xarray/pull/1079#issuecomment-259249333 https://api.github.com/repos/pydata/xarray/issues/1079 MDEyOklzc3VlQ29tbWVudDI1OTI0OTMzMw== fmaussion 10050469 2016-11-08T20:25:21Z 2016-11-08T20:26:15Z MEMBER

Note that in that case, multidimensional-coords and monthly-means are already formatted in rst.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  New infer_intervals keyword for pcolormesh 187208913
259240738 https://github.com/pydata/xarray/pull/1079#issuecomment-259240738 https://api.github.com/repos/pydata/xarray/issues/1079 MDEyOklzc3VlQ29tbWVudDI1OTI0MDczOA== fmaussion 10050469 2016-11-08T19:51:46Z 2016-11-08T19:51:46Z MEMBER

OK. Let's see what the gurus say about this, maybe there is a reason to keep it like this

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  New infer_intervals keyword for pcolormesh 187208913
259237434 https://github.com/pydata/xarray/pull/1079#issuecomment-259237434 https://api.github.com/repos/pydata/xarray/issues/1079 MDEyOklzc3VlQ29tbWVudDI1OTIzNzQzNA== fmaussion 10050469 2016-11-08T19:39:40Z 2016-11-08T19:41:27Z MEMBER

@rabernat : couldn't your tutorial also use the ipython directive and run at build time instead of using the parsed literals? I see that the other examples are also static, is there a reason for this?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  New infer_intervals keyword for pcolormesh 187208913
259220758 https://github.com/pydata/xarray/pull/1079#issuecomment-259220758 https://api.github.com/repos/pydata/xarray/issues/1079 MDEyOklzc3VlQ29tbWVudDI1OTIyMDc1OA== fmaussion 10050469 2016-11-08T18:36:43Z 2016-11-08T18:36:43Z MEMBER

@rabernat thanks for the link! I'll update the docs with a link to your example and with "multidimensional" instead of "irregular".

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  New infer_intervals keyword for pcolormesh 187208913
259215110 https://github.com/pydata/xarray/pull/1079#issuecomment-259215110 https://api.github.com/repos/pydata/xarray/issues/1079 MDEyOklzc3VlQ29tbWVudDI1OTIxNTExMA== fmaussion 10050469 2016-11-08T18:15:45Z 2016-11-08T18:15:45Z MEMBER

Should I remove the if hasattr(ax, 'projection') altogether?

Finally I think it's ok to keep it as it is now, since the data above is likely to always be plotted on a map anyways.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  New infer_intervals keyword for pcolormesh 187208913
258923845 https://github.com/pydata/xarray/pull/1079#issuecomment-258923845 https://api.github.com/repos/pydata/xarray/issues/1079 MDEyOklzc3VlQ29tbWVudDI1ODkyMzg0NQ== fmaussion 10050469 2016-11-07T18:43:24Z 2016-11-07T18:43:24Z MEMBER

Actually, you wouldn't like to infer intervals on these coordinates at all, regardless if you are on a map or not. Should I remove the if hasattr(ax, 'projection') altogether?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  New infer_intervals keyword for pcolormesh 187208913
258921077 https://github.com/pydata/xarray/pull/1079#issuecomment-258921077 https://api.github.com/repos/pydata/xarray/issues/1079 MDEyOklzc3VlQ29tbWVudDI1ODkyMTA3Nw== fmaussion 10050469 2016-11-07T18:33:20Z 2016-11-07T18:33:20Z MEMBER

@jhamman @shoyer this is ready for another review (the test failure seems unrelated).

@ocefpaf I added a note to the docs

@jhamman OK now I get why it clearly doesn't make sense to infer anything in your dataset (plot below). Just out of curiosity: does RASM have a map projection on which it has regular coordinates, too?

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  New infer_intervals keyword for pcolormesh 187208913
258695618 https://github.com/pydata/xarray/pull/1079#issuecomment-258695618 https://api.github.com/repos/pydata/xarray/issues/1079 MDEyOklzc3VlQ29tbWVudDI1ODY5NTYxOA== fmaussion 10050469 2016-11-06T17:22:14Z 2016-11-07T13:57:17Z MEMBER

After giving this a few more thoughts: 1. if the coordinates are 1D (i.e. the grid is regular in the scipy sense: the coordinates don't have to be evenly spaced), infer_intervals should be set to True by default. This should make everybody happy (including @jhamman and me), and this will cover a huge majority of the geoscientific grids. 2. if the coordinates are 2D, what xarray was doing until now was wrong. _infer_interval_breaks was inferring intervals on the first axis only and ignoring the second, so regardless of whether we were plotting on a projection or not, the plot output was cropped (see example above)

So what do we do with this? @jhamman 's suggestion is to set infer_intervals to False, which is equivalent to saying: "this plot is going to be a bit wrong but this is not xarray's problem". I guess that it's fine to do so, but we'd have to be happy with the following:

``` python import numpy as np import matplotlib.pyplot as plt import cartopy.crs as ccrs import xarray as xr

lon, lat = np.linspace(-20, 20, 5), np.linspace(0, 30, 4) lon, lat = np.meshgrid(lon, lat) lon += lat/10 lat += lon/10 da = xr.DataArray(np.arange(20).reshape(4, 5), dims=['y', 'x'], coords = {'lat': (('y', 'x'), lat), 'lon': (('y', 'x'), lon)})

ax = plt.subplot(1, 2, 1, projection=ccrs.PlateCarree()) da.plot.pcolormesh('lon', 'lat', ax=ax, transform=ccrs.PlateCarree(), infer_intervals=False) ax.scatter(lon, lat, transform=ccrs.PlateCarree()) ax.coastlines() ax.set_title('2d irreg case - pcolor')

ax = plt.subplot(1, 2, 2, projection=ccrs.PlateCarree()) da.plot.contourf('lon', 'lat', ax=ax, transform=ccrs.PlateCarree()) ax.scatter(lon, lat, transform=ccrs.PlateCarree()) ax.coastlines() ax.set_title('2d irreg case - contourf') ```

Note that one line and one column of data disappeared (so that the colorbar range doesn't correspond to what we see) and the coordinates are not understood as being in the cell center. The advantage of this choice are twofold: - it's kind of coherent with how contourf would interpret the coordinates (see example above) - if we agree on "1D = infer per default" and "2D = don't infer per default", we might even get rid of the new keyword altogether.

Let's call this option "Option A".

[edited]

I've been playing around with an "Option B", which includes making _infer_interval_breaks accept an axis kwarg. Regardless of the implementation, we could reach the following result:

[\edited]

This plot is closer to what I think the grid actually represents, but I am biased towards my usage of xarray (gridded geoscientific models). The disadvantages of option B are: - it adds a bit of complexity - if you think about it, the problem of plotting irregular grids is not really an xarray problem. If there was a perfect way to handle an irregular grids without having bounded coordinates, I guess that matplotlib would have a tool for it.

I currently tend to go for option A, since option B is a bit awkward and users who have bounded coordinated available somewhere (as suggested by @ocefpaf ) will have to implement their own plotting routine anyway.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  New infer_intervals keyword for pcolormesh 187208913
258841318 https://github.com/pydata/xarray/pull/1079#issuecomment-258841318 https://api.github.com/repos/pydata/xarray/issues/1079 MDEyOklzc3VlQ29tbWVudDI1ODg0MTMxOA== fmaussion 10050469 2016-11-07T13:55:56Z 2016-11-07T13:55:56Z MEMBER

I've come up with a cleaner implementation which doesn't require scipy and produces a very accurate plot:

I'm going to clean all this later today and update my PR, I think that we can come to something nice.

@jhamman : I wonder if the problem you are having in your example is related to flaoting point issues at the pole. Would you mind sending me the file and the code that produces the plot so that I can have a look at it?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  New infer_intervals keyword for pcolormesh 187208913
258388424 https://github.com/pydata/xarray/pull/1079#issuecomment-258388424 https://api.github.com/repos/pydata/xarray/issues/1079 MDEyOklzc3VlQ29tbWVudDI1ODM4ODQyNA== fmaussion 10050469 2016-11-04T10:03:04Z 2016-11-04T10:03:04Z MEMBER

In the old Matlab day we had horrible hacks to get pcolor to work properly

pcolormesh and imshow are indeed very consistent in xarray:

``` python import numpy as np import matplotlib.pyplot as plt import cartopy.crs as ccrs import xarray as xr

da = xr.DataArray(np.arange(20).reshape(4, 5), dims=['lat', 'lon'], coords = {'lat': np.linspace(0, 30, 4), 'lon': np.linspace(-20, 20, 5)})

f = plt.figure(figsize=(5, 8))

ax = plt.subplot(3, 1, 1, projection=ccrs.PlateCarree()) da.plot.imshow(ax=ax, transform=ccrs.PlateCarree()) lon, lat = np.meshgrid(da.lon.values, da.lat.values) ax.scatter(lon, lat, transform=ccrs.PlateCarree()) ax.coastlines() ax.set_title('imshow')

ax = plt.subplot(3, 1, 2, projection=ccrs.PlateCarree()) da.plot.pcolormesh(ax=ax, transform=ccrs.PlateCarree()) ax.scatter(lon, lat, transform=ccrs.PlateCarree()) ax.coastlines() ax.set_title('pcolormesh')

ax = plt.subplot(3, 1, 3, projection=ccrs.PlateCarree()) da.plot.pcolormesh(ax=ax, transform=ccrs.PlateCarree(), infer_intervals=False) ax.scatter(lon, lat, transform=ccrs.PlateCarree()) ax.coastlines() ax.set_title('pcolormesh - no intervals') ```

In most cases setting infer_intervals=False won't be a good idea, but maybe for some exotic projections (at the pole in @jhamman example) it might be easier this way (albeit a bit "wrong").

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  New infer_intervals keyword for pcolormesh 187208913
258380050 https://github.com/pydata/xarray/pull/1079#issuecomment-258380050 https://api.github.com/repos/pydata/xarray/issues/1079 MDEyOklzc3VlQ29tbWVudDI1ODM4MDA1MA== fmaussion 10050469 2016-11-04T09:22:01Z 2016-11-04T09:22:01Z MEMBER

Is infer_intervals creating coordinate bounds for plotting? It looks like it.

Yes, it is a special case for pcolormesh though

What about when we do have cell boundaries in the dataset?

Currently the entire xarray workflow is built upon the implicit assumption that the coordinates are always at the grid-point center ( @shoyer correct me if I'm wrong). I'm not sure if the additional complexity added by cell boundaries is on the xarray devs priority list...

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  New infer_intervals keyword for pcolormesh 187208913

Advanced export

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

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 1517.406ms · About: xarray-datasette