pydata / pydata/xarray

Feature Request: Indexable writes to netCDF format files on disk

Open
#2,823 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

contrib-help-wanted topic-backends
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

This is a feature request for indexable writes to a netCDF format file.

The documents mention that data variables (my interpretation is: the entire multi-dimensional array represented as a data-variable entity) can be appended-to or overwritten when using ds.to_netcdf(<filepath>, mode='a'). However, this requires first reading the dataset into memory, then modifying some-or-other data element at said index in a multi-dimensional array, and then replacing the entire data-variable on disk.

It would be incredibly useful to be able to write a single data value to a single array location without first loading and then completely overwriting the complete data-variable.

There may be ways to achieve a similar result by using the underlying netCDF4 module, e.g. per this stack overflow post. But forwards-compatibility and unintended side-effects put a damper on such approaches.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the ds.to_netcdf(, mode='a') entry point and compare its behavior with the underlying netCDF4 indexed-write approach referenced in the issue. The desired outcome is writing one value at one array index without loading and replacing the complete data variable; no specific files or tests are named.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.