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/358#issuecomment-291611335,https://api.github.com/repos/pydata/xarray/issues/358,291611335,MDEyOklzc3VlQ29tbWVudDI5MTYxMTMzNQ==,1217238,2017-04-04T19:46:39Z,2017-04-04T20:37:12Z,MEMBER,"Yes, looks pretty good. It would be nice to consolidate this with xarray's current logic for getting virtual datetime variables (they should probably delegate to the accessor): https://github.com/pydata/xarray/blob/94790388c273c0c1ce2c203940a706d331deb14f/xarray/core/dataset.py#L41 > I wonder, is there any way to register such an accessor with DataArrays that have a specific dtype? The simplest option is to raise `AttributeError` or `TypeError` in the constructor, e.g., ```python @xarray.register_dataarray_accessor('float_only') class FloatOnlyAccessor(object): def __init__(self, parent): if parent.dtype.kind != 'f': raise TypeError('wrong dtype') self.parent = parent ``` ``` >>> xarray.DataArray(1.5).float_only <__main__.FloatOnlyAccessor at 0x8d51350> >>> xarray.DataArray(1).float_only TypeError: wrong dtype ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,59720901 https://github.com/pydata/xarray/issues/358#issuecomment-291568964,https://api.github.com/repos/pydata/xarray/issues/358,291568964,MDEyOklzc3VlQ29tbWVudDI5MTU2ODk2NA==,4992424,2017-04-04T17:14:18Z,2017-04-04T17:14:18Z,NONE,"[Proof of concept, borrowing liberally from pandas](https://gist.github.com/anonymous/6254b1f682e05d10aaf51d93ed343534). I think this will be pretty straightforward to hook up into xarray. I wonder, is there any way to register such an accessor with `DataArray`s that have a specific dtype? Ideally we'd only want to expose this accessor if a DataArray was a numpy.datetime64 type under the hood.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,59720901 https://github.com/pydata/xarray/issues/358#issuecomment-291232960,https://api.github.com/repos/pydata/xarray/issues/358,291232960,MDEyOklzc3VlQ29tbWVudDI5MTIzMjk2MA==,1217238,2017-04-03T18:34:47Z,2017-04-03T18:34:47Z,MEMBER,"Yes, I think this would be quite straightforward. I think the easiest way to do it would simply be to reuse xarray's accessor interface (i.e., `register_dataarray_accessor`) and then implement all the desired methods/properties.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,59720901 https://github.com/pydata/xarray/issues/358#issuecomment-291228898,https://api.github.com/repos/pydata/xarray/issues/358,291228898,MDEyOklzc3VlQ29tbWVudDI5MTIyODg5OA==,4992424,2017-04-03T18:20:32Z,2017-04-03T18:20:32Z,NONE,"Working on a project today which would greatly benefit from having the .dt accessors. Given that this issue is nearly two years old, any thoughts on what it would take to resolve in the present codebase? Still as straightforward as wrappers on the pandas time series methods?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,59720901