home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 202964277 and user = 3496314 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

  • tbohn · 4 ✖

issue 1

  • “ValueError: chunksize cannot exceed dimension size” when trying to write xarray to netcdf · 4 ✖

author_association 1

  • NONE 4
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
326146218 https://github.com/pydata/xarray/issues/1225#issuecomment-326146218 https://api.github.com/repos/pydata/xarray/issues/1225 MDEyOklzc3VlQ29tbWVudDMyNjE0NjIxOA== tbohn 3496314 2017-08-30T23:23:16Z 2017-08-30T23:23:16Z NONE

OK, thanks Joe and Stephan.

On Wed, Aug 30, 2017 at 3:36 PM, Joe Hamman notifications@github.com wrote:

@tbohn https://github.com/tbohn - What is happening here is that xarray is storing the netCDF4 chunk size from the input file. For the LAI variable in your example, that isLAI:_ChunkSizes = 19, 1, 160, 160 ; (you can see this with ncdump -h -s filename.nc).

$ ncdump -s -h veg_hist.0_10n.90_80w.2000_2016.mode_PFT.5dates.nc netcdf veg_hist.0_10n.90_80w.2000_2016.mode_PFT.5dates { dimensions: veg_class = 19 ; lat = 160 ; lon = 160 ; time = UNLIMITED ; // (5 currently) variables: float Cv(veg_class, lat, lon) ; Cv:_FillValue = -1.f ; Cv:units = "-" ; Cv:longname = "Area Fraction" ; Cv:missing_value = -1.f ; Cv:_Storage = "contiguous" ; Cv:_Endianness = "little" ; float LAI(veg_class, time, lat, lon) ; LAI:_FillValue = -1.f ; LAI:units = "m2/m2" ; LAI:longname = "Leaf Area Index" ; LAI:missing_value = -1.f ; LAI:_Storage = "chunked" ; LAI:_ChunkSizes = 19, 1, 160, 160 ; LAI:_Endianness = "little" ; ...

Those integers correspond to the dimensions from LAI. When you slice your dataset, you end up with lat/lon dimensions that are now smaller than the _ChunkSizes. When writing this back to netCDF, xarray is still trying to use the original encoding attribute.

The logical fix is to validate this encoding attribute and either 1) throw an informative error if something isn't going to work, or 2) change the ChunkSizes.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pydata/xarray/issues/1225#issuecomment-326138431, or mute the thread https://github.com/notifications/unsubscribe-auth/ADVZeo0qPYlMc_a8UeGDNp04jtFXqkgOks5sdePhgaJpZM4Ls47i .

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  “ValueError: chunksize cannot exceed dimension size” when trying to write xarray to netcdf 202964277
307524160 https://github.com/pydata/xarray/issues/1225#issuecomment-307524160 https://api.github.com/repos/pydata/xarray/issues/1225 MDEyOklzc3VlQ29tbWVudDMwNzUyNDE2MA== tbohn 3496314 2017-06-09T23:32:38Z 2017-08-30T22:26:44Z NONE

OK, here's my code and the file that it works (fails) on.

Code: ```Python import os.path import numpy as np import xarray as xr ds = xr.open_dataset('veg_hist.0_10n.90_80w.2000_2016.mode_PFT.5dates.nc') ds_out = ds.isel(lat=slice(0,16),lon=slice(0,16))

ds_out.encoding['unlimited_dims'] = 'time'

ds_out.to_netcdf('test.out.nc') ```

Note that I commented out the attempt to make 'time' unlimited - if I attempt it, I get a slightly different chunk size error ('NetCDF: Bad chunk sizes').

I realize that for now I can use 'ncks' as a workaround, but seems to me that xarray should be able to do this too.

File (attached) veg_hist.0_10n.90_80w.2000_2016.mode_PFT.5dates.nc.zip

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  “ValueError: chunksize cannot exceed dimension size” when trying to write xarray to netcdf 202964277
307524406 https://github.com/pydata/xarray/issues/1225#issuecomment-307524406 https://api.github.com/repos/pydata/xarray/issues/1225 MDEyOklzc3VlQ29tbWVudDMwNzUyNDQwNg== tbohn 3496314 2017-06-09T23:34:44Z 2017-06-09T23:34:44Z NONE

(note also that for the example nc file I provided, the slice that my example code makes contains nothing but null values - but that's irrelevant - the error happens for other slices that do contain non-null values.)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  “ValueError: chunksize cannot exceed dimension size” when trying to write xarray to netcdf 202964277
307518173 https://github.com/pydata/xarray/issues/1225#issuecomment-307518173 https://api.github.com/repos/pydata/xarray/issues/1225 MDEyOklzc3VlQ29tbWVudDMwNzUxODE3Mw== tbohn 3496314 2017-06-09T22:55:20Z 2017-06-09T22:55:20Z NONE

I've been encountering this as well, and I don't want to use the scipy engine workaround. If you can tell me what a "self-contained" example means, I can also try to provide one.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  “ValueError: chunksize cannot exceed dimension size” when trying to write xarray to netcdf 202964277

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