home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1352314936

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
1352314936 I_kwDOAMm_X85QmrA4 6955 Expose "memory" argument to the "netcdf4" engine 30196 open 0     0 2022-08-26T14:04:00Z 2022-08-26T14:04:00Z   NONE      

Is your feature request related to a problem?

As of today, xarray can't open a netcdf residing in a memory buffer, which is possible in netCDF4 library through the memory argument of the netCDF4.Dataset class constructor.

Describe the solution you'd like

It would be nice to create an xarray.Dataset from a netcdf file in memory like so:

python buf: bytes = ... ds = xr.open_dataset("dummy.nc", engine="netcdf4", memory=buf)

But this fails with

``` File ~/.asdf/installs/python/3.9.13/lib/python3.9/site-packages/xarray/backends/api.py:531, in open_dataset(filename_or_obj, engine, chunks, cache, decode_cf, mask_and_scale, decode_times, decode_timedelta, use_cftime, concat_characters, decode_coords, drop_variables, inline_array, backend_kwargs, kwargs) 519 decoders = _resolve_decoders_kwargs( 520 decode_cf, 521 open_backend_dataset_parameters=backend.open_dataset_parameters, (...) 527 decode_coords=decode_coords, 528 ) 530 overwrite_encoded_chunks = kwargs.pop("overwrite_encoded_chunks", None) --> 531 backend_ds = backend.open_dataset( 532 filename_or_obj, 533 drop_variables=drop_variables, 534 decoders, 535 kwargs, 536 ) 537 ds = _dataset_from_backend_dataset( 538 backend_ds, 539 filename_or_obj, (...) 547 kwargs, 548 ) 549 return ds

TypeError: open_dataset() got an unexpected keyword argument 'memory' ```

Describe alternatives you've considered

An alternative is to save the buffer into a temporary file and open it the usual way, but it feels cumbersome when there is already an argument to open directly from memory.

Additional context

No response

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6955/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 79.391ms · About: xarray-datasette