issue_comments: 565476562
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/3614#issuecomment-565476562 | https://api.github.com/repos/pydata/xarray/issues/3614 | 565476562 | MDEyOklzc3VlQ29tbWVudDU2NTQ3NjU2Mg== | 14808389 | 2019-12-13T15:11:57Z | 2019-12-14T00:14:55Z | MEMBER | This already works for me in a IPython shell ( In [2]: @xr.register_dataset_accessor("geo") ...: class GeoAccessor: ...: def init(self, xarray_obj): ...: self._obj = xarray_obj ...: ...: @property ...: def center(self): ...: # return the geographic center point of this dataset ...: lon = self._obj.latitude ...: lat = self._obj.longitude ...: return (float(lon.mean()), float(lat.mean())) ...: ...: def plot(self): ...: # plot this array's data on a map, e.g., using Cartopy ...: pass ...: In [3]: ds = xr.Dataset( ...: {"a": (("latitude", "longitude"), np.linspace(0, 1, 5 * 10).reshape(5, 10))}, ...: coords={"latitude": np.arange(5), "longitude": np.arange(10)}, ...: ) In [4]: # ds.geo.c<TAB>: ...: ds.geo.center Out[4]: (2.0, 4.5) ``` Am I missing something? Edit: what does not work is something like ```python In [5]: ds = xr.Dataset( ...: {"a": (("latitude", "longitude"), np.linspace(0, 1, 5 * 10).reshape(5, 10))}, ...: coords={ ...: "latitude": np.arange(5), ...: "longitude": np.arange(10), ...: "time": np.datetime64("1999-01-01"), ...: }, ...: ) In [6]: # ds.time.dt.y<TAB> ...: ds.time.dt.y In [7]: time = ds.time
...: # time.dt.y<TAB>
...: time.dt.year
|
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
536900797 |