home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

2 rows where issue = 256496917 and user = 87719516 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

  • hding1981 · 2 ✖

issue 1

  • Regression: time attributes on PeriodIndex · 2 ✖

author_association 1

  • NONE 2
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
883603251 https://github.com/pydata/xarray/issues/1565#issuecomment-883603251 https://api.github.com/repos/pydata/xarray/issues/1565 IC_kwDOAMm_X840qrcz hding1981 87719516 2021-07-20T18:26:08Z 2021-07-20T18:26:08Z NONE

I am calculating monthly mean anomalies from a CMIP6 file, which is attached and ended by .docx (Please remove .docx from its name after downloading it).

This file has reasonable time coordinate, which has been confirmed by ncdump and cdo. But it shows NaT after a time point by reading the file using xr.open_dataset. I printed out outputs of processing this file using some commands in a jyputer notebook in a pdf file, which is also attached. I really have no idea why xr.open_datase cannot read the time coordinate properly.

Then, I thought maybe I can redefine its time axis by pd.date_range. But it is also not working.

Thank you so much!

Untitled5 - Jupyter Notebook.pdf ts_Amon_CNRM-CM6-1_piControl_r1i1p1f2_gr_185001-234912.tmp.nc.docx

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Regression: time attributes on PeriodIndex 256496917
883585227 https://github.com/pydata/xarray/issues/1565#issuecomment-883585227 https://api.github.com/repos/pydata/xarray/issues/1565 IC_kwDOAMm_X840qnDL hding1981 87719516 2021-07-20T17:57:55Z 2021-07-20T17:57:55Z NONE

I have similar problems with time coordinate. How did you solve your problem in the end?

I also list my problem here.

The following are my commands in a jupyter notebook

import xarray as xr import numpy as np import pandas as pd import sys

dset=xr.open_dataset("input/ts_Amon_CNRM-CM6-1_piControl_r1i1p1f2_gr_185001-234912.nc",decode_times=False) dset['time'] = pd.period_range(start='1850-01-15', end='2349-12-15', freq='M') varname="ts" anom = dset[varname].groupby('time.month')-dset[varname].groupby('time.month').mean('time', keep_attrs=True)

Then, I got the following error message.


KeyError Traceback (most recent call last) ~/miniconda3/envs/python_tutorial/lib/python3.9/site-packages/xarray/core/dataarray.py in _getitem_coord(self, key) 692 try: --> 693 var = self._coords[key] 694 except KeyError:

KeyError: 'time.month'

During handling of the above exception, another exception occurred:

AttributeError Traceback (most recent call last) <ipython-input-1-250a6867750b> in <module> 7 dset['time'] = pd.period_range(start='1850-01-15', end='2349-12-15', freq='M') 8 varname="ts" ----> 9 anom = dset[varname].groupby('time.month')-dset[varname].groupby('time.month').mean('time', keep_attrs=True)

~/miniconda3/envs/python_tutorial/lib/python3.9/site-packages/xarray/core/common.py in groupby(self, group, squeeze, restore_coord_dims) 703 ) 704 --> 705 return self._groupby_cls( 706 self, group, squeeze=squeeze, restore_coord_dims=restore_coord_dims 707 )

~/miniconda3/envs/python_tutorial/lib/python3.9/site-packages/xarray/core/groupby.py in init(self, obj, group, squeeze, grouper, bins, restore_coord_dims, cut_kwargs) 313 f"Received {group!r} instead." 314 ) --> 315 group = obj[group] 316 if len(group) == 0: 317 raise ValueError(f"{group.name} must not be empty")

~/miniconda3/envs/python_tutorial/lib/python3.9/site-packages/xarray/core/dataarray.py in getitem(self, key) 702 def getitem(self, key: Any) -> "DataArray": 703 if isinstance(key, str): --> 704 return self._getitem_coord(key) 705 else: 706 # xarray-style array indexing

~/miniconda3/envs/python_tutorial/lib/python3.9/site-packages/xarray/core/dataarray.py in getitem_coord(self, key) 694 except KeyError: 695 dim_sizes = dict(zip(self.dims, self.shape)) --> 696 , key, var = _get_virtual_variable( 697 self._coords, key, self._level_coords, dim_sizes 698 )

~/miniconda3/envs/python_tutorial/lib/python3.9/site-packages/xarray/core/dataset.py in _get_virtual_variable(variables, key, level_vars, dim_sizes) 179 data = getattr(ref_var.dt, var_name).data 180 else: --> 181 data = getattr(ref_var, var_name).data 182 virtual_var = Variable(ref_var.dims, data) 183

AttributeError: 'IndexVariable' object has no attribute 'month'

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Regression: time attributes on PeriodIndex 256496917

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