home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1098574761

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/6456#issuecomment-1098574761 https://api.github.com/repos/pydata/xarray/issues/6456 1098574761 IC_kwDOAMm_X85Beuup 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
}
  1197117301
Powered by Datasette · Queries took 76.855ms · About: xarray-datasette