expose CFMaskCoder
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
Is your feature request related to a problem?
We have CFMaskCoder that lazily masks out the values of the _FillValue and missing_value attributes (if present).
For the Zarr backend, we have use_zarr_fill_value_as_mask which controls whether the fill_value attribute is masked: https://docs.xarray.dev/en/stable/generated/xarray.open_zarr.html
If True, use the zarr Array fill_value to mask the data, the same as done for NetCDF data with _FillValue or missing_value attributes. If False, the fill_value is ignored and the data are not masked. If None, this defaults to True for zarr_version=2 and False for zarr_version=3.
We have requests for masking data outside the [valid_min,valid_max] or the valid_range range: https://github.com/pydata/xarray/issues/8359.
Describe the solution you'd like
I propose we expose
coders.MaskCoder(attributes:Iterable[str], valid_range:bool)
(no CF) to allow configurable masking.
It may take some work to figure out how to set a per-backend encode/decode pipeline.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing CFMaskCoder behavior and the open_zarr masking option described in the issue. Trace how backend encode/decode pipelines are configured, then determine how configurable masking and valid-range handling would fit each backend. Done means the proposed MaskCoder is exposed and the relevant backend pipelines support the requested masking choices.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100