home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

16 rows where author_association = "CONTRIBUTOR" and issue = 398041758 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 1

  • jbusecke 16

issue 1

  • enable internal plotting with cftime datetime · 16 ✖

author_association 1

  • CONTRIBUTOR · 16 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
461631993 https://github.com/pydata/xarray/pull/2665#issuecomment-461631993 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ2MTYzMTk5Mw== jbusecke 14314623 2019-02-07T23:18:24Z 2019-02-07T23:18:24Z CONTRIBUTOR

Is there anything else that I need to do at this point? Sorry for the xarray noob question...

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
461414910 https://github.com/pydata/xarray/pull/2665#issuecomment-461414910 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ2MTQxNDkxMA== jbusecke 14314623 2019-02-07T13:18:07Z 2019-02-07T13:18:07Z CONTRIBUTOR

Awesome. Just added the line. Let me know if you think it is appropriate.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
461066722 https://github.com/pydata/xarray/pull/2665#issuecomment-461066722 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ2MTA2NjcyMg== jbusecke 14314623 2019-02-06T15:33:36Z 2019-02-06T15:33:36Z CONTRIBUTOR

Thanks. I updated the PR accordingly.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
460902688 https://github.com/pydata/xarray/pull/2665#issuecomment-460902688 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ2MDkwMjY4OA== jbusecke 14314623 2019-02-06T05:08:09Z 2019-02-06T05:08:09Z CONTRIBUTOR

Seems like the travis builds all pass, wohoo. Please let me know if anything else is needed.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
460803180 https://github.com/pydata/xarray/pull/2665#issuecomment-460803180 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ2MDgwMzE4MA== jbusecke 14314623 2019-02-05T21:05:17Z 2019-02-05T21:05:17Z CONTRIBUTOR

I think I have addressed all the above remarks (Many thanks for the thorough review and tips). Waiting for the CI again.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
460777924 https://github.com/pydata/xarray/pull/2665#issuecomment-460777924 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ2MDc3NzkyNA== jbusecke 14314623 2019-02-05T19:47:56Z 2019-02-05T19:47:56Z CONTRIBUTOR

I am smh getting these errors in the backend part of the tests:

``` ======================================================== FAILURES ========================================================= _____ TestNetCDF3ViaNetCDF4Data.test_encoding_same_dtype ______

self = <xarray.tests.test_backends.TestNetCDF3ViaNetCDF4Data object at 0xd238d9a20>

def test_encoding_same_dtype(self):
    ds = Dataset({'x': ('y', np.arange(10.0, dtype='f4'))})
    kwargs = dict(encoding={'x': {'dtype': 'f4'}})
    with self.roundtrip(ds, save_kwargs=kwargs) as actual:
      assert actual.x.encoding['dtype'] == 'f4'

E AssertionError: assert dtype('>f4') == 'f4'

xarray/tests/test_backends.py:853: AssertionError _______ TestGenericNetCDFData.test_encoding_same_dtype ________

self = <xarray.tests.test_backends.TestGenericNetCDFData object at 0xd238e0588>

def test_encoding_same_dtype(self):
    ds = Dataset({'x': ('y', np.arange(10.0, dtype='f4'))})
    kwargs = dict(encoding={'x': {'dtype': 'f4'}})
    with self.roundtrip(ds, save_kwargs=kwargs) as actual:
      assert actual.x.encoding['dtype'] == 'f4'

E AssertionError: assert dtype('>f4') == 'f4'

xarray/tests/test_backends.py:853: AssertionError ``` They do not always show up...not sure what to make of it, but could be an issue with my local environment. Lets see if the CI shows this aswell.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
460744700 https://github.com/pydata/xarray/pull/2665#issuecomment-460744700 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ2MDc0NDcwMA== jbusecke 14314623 2019-02-05T18:14:42Z 2019-02-05T18:14:42Z CONTRIBUTOR

Ok I think I have most of the things covered. All test pass for me locally. What should I add to the whats-new.rst. I thought of something like this under Enhancements (or would this be considered a bug fix?): Internal plotting now supports cftime.datetime objects as time axis (@spencerkclark, @jbusecke)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
457785427 https://github.com/pydata/xarray/pull/2665#issuecomment-457785427 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ1Nzc4NTQyNw== jbusecke 14314623 2019-01-26T01:02:47Z 2019-01-26T01:03:13Z CONTRIBUTOR

Great idea to simplify @spencerkclark. Thanks. Regarding the tests. I have removed the following:

``` @requires_cftime def test_plot_cftime_coordinate_error(): cftime = _import_cftime() time = cftime.num2date(np.arange(5), units='days since 0001-01-01', calendar='noleap') data = DataArray(np.arange(5), coords=[time], dims=['time']) with raises_regex(TypeError, 'requires coordinates to be numeric or dates'): data.plot()

@requires_cftime def test_plot_cftime_data_error(): cftime = _import_cftime() data = cftime.num2date(np.arange(5), units='days since 0001-01-01', calendar='noleap') data = DataArray(data, coords=[np.arange(5)], dims=['x']) with raises_regex(NotImplementedError, 'cftime.datetime'): data.plot() ``` And the test suite passes locally.

But I assume Ill have to add another test dataset with a cftime.datetime time-axis, which then gets dragged through all the plotting tests? Where would I have to put that in?

Many thanks for all the help

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
457768114 https://github.com/pydata/xarray/pull/2665#issuecomment-457768114 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ1Nzc2ODExNA== jbusecke 14314623 2019-01-25T23:18:16Z 2019-01-25T23:21:13Z CONTRIBUTOR

I have quickly looked into the testing and found an oddity that might be important if nc-time-axis is not installed.

So in the definition of plot in plot.py I have changed

if contains_cftime_datetimes(darray): to if any([contains_cftime_datetimes(darray[dim]) for dim in darray.dims]): Because if I understand correctly, the previous statement only checks the dtype of the actual data, not the dimensions. Is this appropriate or am I misunderstanding the syntax? In my example above it doesnt matter, because this only spits out an error message when nc-time-axis is not available.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
457766633 https://github.com/pydata/xarray/pull/2665#issuecomment-457766633 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ1Nzc2NjYzMw== jbusecke 14314623 2019-01-25T23:10:48Z 2019-01-25T23:10:48Z CONTRIBUTOR

Ok so the plotting works now with both timeseries and 2d data as follows

``` import xarray as xr import numpy as np %matplotlib inline

Create a simple line dataarray with cftime

time = xr.cftime_range(start='2000', periods=4, freq='1H', calendar='noleap') data = np.random.rand(len(time)) da = xr.DataArray(data, coords=[('time', time)]) da.plot() ![download](https://user-images.githubusercontent.com/14314623/51777752-6d427580-20cc-11e9-9c3d-a91d31b10312.png)

Check with 2d data

time = xr.cftime_range(start='2000', periods=6, freq='2MS', calendar='noleap') data2 = np.random.rand(len(time), 4) da2 = xr.DataArray(data2, coords=[('time', time), ('other', range(4))]) da2.plot() ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
457723510 https://github.com/pydata/xarray/pull/2665#issuecomment-457723510 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ1NzcyMzUxMA== jbusecke 14314623 2019-01-25T20:51:30Z 2019-01-25T20:51:30Z CONTRIBUTOR

Cool. Ill give it a shot right now.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
457196788 https://github.com/pydata/xarray/pull/2665#issuecomment-457196788 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ1NzE5Njc4OA== jbusecke 14314623 2019-01-24T13:30:24Z 2019-01-24T13:30:24Z CONTRIBUTOR

Sounds good to me.

Best

Julius On Jan 23, 2019, 12:56 PM -0500, Spencer Clark notifications@github.com, wrote:

I agree @dcherian; I just pinged the PR again, but if there is no activity there by this time next week, I think we should probably move forward here. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
456883187 https://github.com/pydata/xarray/pull/2665#issuecomment-456883187 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ1Njg4MzE4Nw== jbusecke 14314623 2019-01-23T17:02:14Z 2019-01-23T17:02:14Z CONTRIBUTOR

Is there still interest in this PR? Or did the upstream changes move ahead? I am finding myself explaining workarounds for this too students in the department, so maybe my time would be better invested getting this fix to the full community?

But obviously if things are going to be fixed upstream soon, I would devote time to other projects. Thoughts?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
453298775 https://github.com/pydata/xarray/pull/2665#issuecomment-453298775 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ1MzI5ODc3NQ== jbusecke 14314623 2019-01-10T23:24:52Z 2019-01-10T23:24:52Z CONTRIBUTOR

Oh shoot, I now remember seeing this. If this will be implemented soon I guess the PR can be discarded. Any chance you would have a quick solution for the pcolormesh plot error (second example in the PR) @spencerkclark?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
453282855 https://github.com/pydata/xarray/pull/2665#issuecomment-453282855 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ1MzI4Mjg1NQ== jbusecke 14314623 2019-01-10T22:38:47Z 2019-01-10T22:38:47Z CONTRIBUTOR

One of the more general questions I had was if we should expose the conversion using nc-time-axis in the public API. That way users could easily plot the data in matplotlib, e.g.: da_new = da.convert_cftime() plt.plot(da_new.time, da_new) Just an idea...

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758
453280699 https://github.com/pydata/xarray/pull/2665#issuecomment-453280699 https://api.github.com/repos/pydata/xarray/issues/2665 MDEyOklzc3VlQ29tbWVudDQ1MzI4MDY5OQ== jbusecke 14314623 2019-01-10T22:31:48Z 2019-01-10T22:32:16Z CONTRIBUTOR

I have been along the lines of a short example. This works for timeseries data.

``` import xarray as xr import numpy as np %matplotlib inline

Create a simple line dataarray with cftime

time = xr.cftime_range(start='2000', periods=6, freq='2MS', calendar='noleap') data = np.random.rand(len(time)) da = xr.DataArray(data, coords=[('time', time)]) da.plot() ```

For pcolormesh plots this still fails.

```

Create a simple line dataarray with cftime

time = xr.cftime_range(start='2000', periods=6, freq='2MS', calendar='noleap') data2 = np.random.rand(len(time), 4) da2 = xr.DataArray(data2, coords=[('time', time), ('other', range(4))]) da2.plot() ```

--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-2-645c66b57bde> in <module> 3 data2 = np.random.rand(len(time), 4) 4 da2 = xr.DataArray(data2, coords=[('time', time), ('other', range(4))]) ----> 5 da2.plot() ~/Work/CODE/PYTHON/xarray/xarray/plot/plot.py in __call__(self, **kwargs) 585 586 def __call__(self, **kwargs): --> 587 return plot(self._da, **kwargs) 588 589 @functools.wraps(hist) ~/Work/CODE/PYTHON/xarray/xarray/plot/plot.py in plot(darray, row, col, col_wrap, ax, hue, rtol, subplot_kws, **kwargs) 220 kwargs['ax'] = ax 221 --> 222 return plotfunc(darray, **kwargs) 223 224 ~/Work/CODE/PYTHON/xarray/xarray/plot/plot.py in newplotfunc(darray, x, y, figsize, size, aspect, ax, row, col, col_wrap, xincrease, yincrease, add_colorbar, add_labels, vmin, vmax, cmap, center, robust, extend, levels, infer_intervals, colors, subplot_kws, cbar_ax, cbar_kwargs, xscale, yscale, xticks, yticks, xlim, ylim, norm, **kwargs) 887 vmax=cmap_params['vmax'], 888 norm=cmap_params['norm'], --> 889 **kwargs) 890 891 # Label the plot with metadata ~/Work/CODE/PYTHON/xarray/xarray/plot/plot.py in pcolormesh(x, y, z, ax, infer_intervals, **kwargs) 1135 (np.shape(y)[0] == np.shape(z)[0])): 1136 if len(y.shape) == 1: -> 1137 y = _infer_interval_breaks(y, check_monotonic=True) 1138 else: 1139 # we have to infer the intervals on both axes ~/Work/CODE/PYTHON/xarray/xarray/plot/plot.py in _infer_interval_breaks(coord, axis, check_monotonic) 1085 coord = np.asarray(coord) 1086 -> 1087 if check_monotonic and not _is_monotonic(coord, axis=axis): 1088 raise ValueError("The input coordinate is not sorted in increasing " 1089 "order along axis %d. This can lead to unexpected " ~/Work/CODE/PYTHON/xarray/xarray/plot/plot.py in _is_monotonic(coord, axis) 1069 n = coord.shape[axis] 1070 delta_pos = (coord.take(np.arange(1, n), axis=axis) >= -> 1071 coord.take(np.arange(0, n - 1), axis=axis)) 1072 delta_neg = (coord.take(np.arange(1, n), axis=axis) <= 1073 coord.take(np.arange(0, n - 1), axis=axis)) TypeError: '>=' not supported between instances of 'CalendarDateTime' and 'CalendarDateTime'

Perhaps @spencerkclark has an idea how to deal with differencing cftime.datetime objects?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  enable internal plotting with cftime datetime 398041758

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 12.46ms · About: xarray-datasette