home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

8 rows where issue = 539648897 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 3

  • huard 4
  • spencerkclark 3
  • maboualidev 1

author_association 3

  • CONTRIBUTOR 4
  • MEMBER 3
  • NONE 1

issue 1

  • interp with long cftime coordinates raises an error · 8 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
568223308 https://github.com/pydata/xarray/issues/3641#issuecomment-568223308 https://api.github.com/repos/pydata/xarray/issues/3641 MDEyOklzc3VlQ29tbWVudDU2ODIyMzMwOA== spencerkclark 6628425 2019-12-22T00:50:04Z 2019-12-22T00:50:04Z MEMBER

Thanks @maboualidev; I saw that @andersy005 posted about this too. I haven't had a chance to look deeply into your new package, but I am intrigued by the concept. I think patterns for working with data defined over intervals, be they in time or some other dimension, are something useful and should be explored.

1475 is a good thread in particular if you are interested in ideas for how cell boundaries (and operations that depend on them) might be represented most cleanly within xarray. Discussion there seems somewhat dormant at the moment, but I'd jump in there if you have comments, ideas, or questions.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  interp with long cftime coordinates raises an error 539648897
567738254 https://github.com/pydata/xarray/issues/3641#issuecomment-567738254 https://api.github.com/repos/pydata/xarray/issues/3641 MDEyOklzc3VlQ29tbWVudDU2NzczODI1NA== maboualidev 24830983 2019-12-20T00:37:01Z 2019-12-20T00:44:45Z NONE

I wanted to bring attention to a package that we are working on that originally started with remapping time axis. The package is called AxisUtilities and is available at https://github.com/coderepocenter/AxisUtilities.

It doesn’t yet have any support for CFTime yet (well it does support it now; but you need to manually convert cftime to a number for now) But we are working on it (so that the cftime to number conversion is more automatic). We have the basis there. We are now working on it to make it easier to use and remove certain steps.

It follows the ESMF or SCRIP interpolation pattern, i.e. once you make the remapper object, you could use it for multiple data set as long as the source and destination axis has not changed.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  interp with long cftime coordinates raises an error 539648897
567129939 https://github.com/pydata/xarray/issues/3641#issuecomment-567129939 https://api.github.com/repos/pydata/xarray/issues/3641 MDEyOklzc3VlQ29tbWVudDU2NzEyOTkzOQ== huard 81219 2019-12-18T17:22:55Z 2019-12-18T17:22:55Z CONTRIBUTOR

Note that at the moment, if we pass np.datetime64 objects that exceed the allowed time span, the function yields garbage without failing. Is this something we want to fix as well ?

One option is to convert array and offset to microseconds first, then compute the delta, but this may break people's code.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  interp with long cftime coordinates raises an error 539648897
567085661 https://github.com/pydata/xarray/issues/3641#issuecomment-567085661 https://api.github.com/repos/pydata/xarray/issues/3641 MDEyOklzc3VlQ29tbWVudDU2NzA4NTY2MQ== spencerkclark 6628425 2019-12-18T15:40:19Z 2019-12-18T16:46:27Z MEMBER

That would indeed be a very clean approach (I don't know why that did not occur to me earlier!). In the past that kind of conversion used to have a bug, but it has been fixed as of NumPy 1.15 (see https://github.com/numpy/numpy/issues/11096).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  interp with long cftime coordinates raises an error 539648897
567077543 https://github.com/pydata/xarray/issues/3641#issuecomment-567077543 https://api.github.com/repos/pydata/xarray/issues/3641 MDEyOklzc3VlQ29tbWVudDU2NzA3NzU0Mw== huard 81219 2019-12-18T15:22:07Z 2019-12-18T15:22:07Z CONTRIBUTOR

How about replacing array = np.asarray(pd.Series(array.ravel())).reshape(array.shape) by array = array.astype("timedelta64") ? with numpy 1.17 your example works and the test suite only fails on unrelated netcdf string errors.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  interp with long cftime coordinates raises an error 539648897
567022752 https://github.com/pydata/xarray/issues/3641#issuecomment-567022752 https://api.github.com/repos/pydata/xarray/issues/3641 MDEyOklzc3VlQ29tbWVudDU2NzAyMjc1Mg== huard 81219 2019-12-18T13:04:31Z 2019-12-18T13:04:31Z CONTRIBUTOR

Got it, thanks !

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  interp with long cftime coordinates raises an error 539648897
567020769 https://github.com/pydata/xarray/issues/3641#issuecomment-567020769 https://api.github.com/repos/pydata/xarray/issues/3641 MDEyOklzc3VlQ29tbWVudDU2NzAyMDc2OQ== spencerkclark 6628425 2019-12-18T12:58:23Z 2019-12-18T12:58:23Z MEMBER

Yes, there's a simple workaround for that at least, https://github.com/pydata/xarray/pull/3631#discussion_r359325745, but I agree it would be nice if we didn't need to worry about that.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  interp with long cftime coordinates raises an error 539648897
567018062 https://github.com/pydata/xarray/issues/3641#issuecomment-567018062 https://api.github.com/repos/pydata/xarray/issues/3641 MDEyOklzc3VlQ29tbWVudDU2NzAxODA2Mg== huard 81219 2019-12-18T12:49:43Z 2019-12-18T12:49:43Z CONTRIBUTOR

Another issue with datetime_to_numeric happens with: import xarray as xr import cftime i = xr.CFTimeIndex(xr.cftime_range('2000-01-01', periods=2)) xr.core.duck_array_ops.datetime_to_numeric(i, cftime.DatetimeGregorian(2, 1, 1), datetime_unit='D')

```python

TypeError Traceback (most recent call last) pandas/_libs/tslibs/timedeltas.pyx in pandas._libs.tslibs.timedeltas.array_to_timedelta64()

pandas/_libs/tslibs/timedeltas.pyx in pandas._libs.tslibs.timedeltas.parse_timedelta_string()

TypeError: object of type 'datetime.timedelta' has no len()

During handling of the above exception, another exception occurred:

OverflowError Traceback (most recent call last) <ipython-input-50-b03d9c4f220d> in <module> ----> 1 xr.core.duck_array_ops.datetime_to_numeric(i, cftime.DatetimeGregorian(2, 1, 1), datetime_unit='D')

~/src/xarray/xarray/core/duck_array_ops.py in datetime_to_numeric(array, offset, datetime_unit, dtype) 395 else: 396 offset = min(array) --> 397 array = array - offset 398 399 if not hasattr(array, "dtype"): # scalar is converted to 0d-array

~/src/xarray/xarray/coding/cftimeindex.py in sub(self, other) 431 432 if isinstance(other, (CFTimeIndex, cftime.datetime)): --> 433 return pd.TimedeltaIndex(np.array(self) - np.array(other)) 434 elif isinstance(other, pd.TimedeltaIndex): 435 return CFTimeIndex(np.array(self) - other.to_pytimedelta())

~/.conda/envs/xclim3/lib/python3.6/site-packages/pandas/core/indexes/timedeltas.py in new(cls, data, unit, freq, start, end, periods, closed, dtype, copy, name, verify_integrity) 256 257 tdarr = TimedeltaArray._from_sequence( --> 258 data, freq=freq, unit=unit, dtype=dtype, copy=copy 259 ) 260 return cls._simple_new(tdarr._data, freq=tdarr.freq, name=name)

~/.conda/envs/xclim3/lib/python3.6/site-packages/pandas/core/arrays/timedeltas.py in _from_sequence(cls, data, dtype, copy, freq, unit) 270 freq, freq_infer = dtl.maybe_infer_freq(freq) 271 --> 272 data, inferred_freq = sequence_to_td64ns(data, copy=copy, unit=unit) 273 freq, freq_infer = dtl.validate_inferred_freq(freq, inferred_freq, freq_infer) 274

~/.conda/envs/xclim3/lib/python3.6/site-packages/pandas/core/arrays/timedeltas.py in sequence_to_td64ns(data, copy, unit, errors) 971 if is_object_dtype(data.dtype) or is_string_dtype(data.dtype): 972 # no need to make a copy, need to convert if string-dtyped --> 973 data = objects_to_td64ns(data, unit=unit, errors=errors) 974 copy = False 975

~/.conda/envs/xclim3/lib/python3.6/site-packages/pandas/core/arrays/timedeltas.py in objects_to_td64ns(data, unit, errors) 1096 values = np.array(data, dtype=np.object_, copy=False) 1097 -> 1098 result = array_to_timedelta64(values, unit=unit, errors=errors) 1099 return result.view("timedelta64[ns]") 1100

pandas/_libs/tslibs/timedeltas.pyx in pandas._libs.tslibs.timedeltas.array_to_timedelta64()

pandas/_libs/tslibs/timedeltas.pyx in pandas._libs.tslibs.timedeltas.convert_to_timedelta64()

pandas/_libs/tslibs/timedeltas.pyx in pandas._libs.tslibs.timedeltas.delta_to_nanoseconds()

OverflowError: Python int too large to convert to C long ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  interp with long cftime coordinates raises an error 539648897

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