home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

2 rows where issue = 1197117301 and user = 3698640 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

  • delgadom · 2 ✖

issue 1

  • Writing a a dataset to .zarr in a loop makes all the data NaNs · 2 ✖

author_association 1

  • CONTRIBUTOR 2
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
1098574761 https://github.com/pydata/xarray/issues/6456#issuecomment-1098574761 https://api.github.com/repos/pydata/xarray/issues/6456 IC_kwDOAMm_X85Beuup delgadom 3698640 2022-04-13T23:34:16Z 2022-04-13T23:34:48Z CONTRIBUTOR

In the example it's saving every iteration, but in my actual code it's much less frequent

when I said "you're overwriting the file every iteration" I meant to put the emphasis on overwiting. by using mode='w' instead of mode='a' you're telling zarr to delete the file if it exists and the re-create it every time to_zarr is executed.

See the docs on xr.Dataset.to_zarr:

mode ({"w", "w-", "a", "r+", None}, optional) – Persistence mode: “w” means create (overwrite if exists); “w-” means create (fail if exists); “a” means override existing variables (create if does not exist); “r+” means modify existing array values only (raise an error if any metadata or shapes would change). The default mode is “a” if append_dim is set. Otherwise, it is “r+” if region is set and w- otherwise.

This interpretation of mode is consistent across all of python - see the docs for python builtins: open

So I think changing your writes to ds3.to_zarr('zarr_bug.zarr', mode='a') as Max suggested will get you a good part of the way there :)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Writing a a dataset to .zarr in a loop makes all the data NaNs 1197117301
1094411214 https://github.com/pydata/xarray/issues/6456#issuecomment-1094411214 https://api.github.com/repos/pydata/xarray/issues/6456 IC_kwDOAMm_X85BO2PO delgadom 3698640 2022-04-10T23:40:49Z 2022-04-10T23:40:49Z CONTRIBUTOR

@tbloch1 following up on Max's suggestion - it looks like you might be overwriting the file with every iteration. See the docs on ds.to_zarr - mode='w' will overwrite the file while mode='a' will append. That said, you still would need your indices to not overlap. How are you distinguishing between the files? is each one a different point in time?

To me, this doesn't seem likely to be a bug, but is more of a usage question. Have you tried asking on stackoverflow with the xarray tag?

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Writing a a dataset to .zarr in a loop makes all the data NaNs 1197117301

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