home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 231021167

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/364#issuecomment-231021167 https://api.github.com/repos/pydata/xarray/issues/364 231021167 MDEyOklzc3VlQ29tbWVudDIzMTAyMTE2Nw== 7504461 2016-07-07T08:54:46Z 2016-07-07T08:59:15Z NONE

Thanks, @shoyer !

Here is an example of how I circumvented the problem:

data = np.random.rand(24*5) times = pd.date_range('2000-01-01', periods=24*5, freq='H') foo = xray.DataArray(data, coords=[times], dims=['time']) foo = foo.to_dataset(dim=foo.dims,name='foo')

T = time.mktime( dt.datetime(1970,1,1,12+1,25,12).timetuple() ) # 12.42 hours Tint = [ int( time.mktime( t.timetuple() ) / T ) for t in foo.time.values.astype('datetime64[s]').tolist()] foo2 = xray.DataArray( Tint, coords=foo.time.coords, dims=foo.time.dims) foo.merge(foo2.to_dataset(name='Tint'), inplace=True)

foo_grp = foo.groupby('Tint')

foo_grp.group.plot.line()

In my case, the dataset is quite large then it costed a lot of computational time to merge the new variable Tint.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  60303760
Powered by Datasette · Queries took 0.654ms · About: xarray-datasette