home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 1100895150

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/6453#issuecomment-1100895150 https://api.github.com/repos/pydata/xarray/issues/6453 1100895150 IC_kwDOAMm_X85BnlOu 6628425 2022-04-17T14:55:56Z 2022-04-17T14:55:56Z MEMBER

After a little more investigating I think I've narrowed this down to the following example. This particular example happens to be problematic even with the development version of xarray (i.e. it is an existing bug): ``` In [1]: import pandas as pd ...: import xarray as xr

In [2]: times = pd.date_range("2000", periods=2)

In [3]: variable = xr.Variable(["time"], times)

In [4]: variable.encoding Out[4]: {}

In [5]: xr.conventions.decode_cf_variable(variable).encoding Out[5]: {'dtype': dtype('<M8[ns]')} `` The issue is that callingdecode_cf_variableon a variable that already has adatetime64[ns]dtype adds an encoding attribute that leads to problems downstream ('<M8[ns]'` is not a valid dtype in a netCDF file).

In this case it seems like we'd prefer not to add or modify any encoding attributes at all -- we are perfectly capable of handling empty encoding dictionaries for datetime-like data when writing it out to disk.

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