Deprecation Cycle for `netcdf4` backend URL behavior

Open
#10,951 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

Start with xarray/backends/netCDF4_.py around lines 718-731 and review the linked pull requests and issue discussions about guess_can_open. Determine whether the project wants a broader guessing change or a narrower netcdf4 scope, then define the deprecation warning and target release. Done means the end state and deprecation cycle are agreed and documented.

Written by the indexing model from the issue text.

Description

needs triage
What is your issue?

As discussed in https://github.com/pydata/xarray/pull/10931 and https://github.com/pydata/xarray/pull/10804 the netcdf4 backend currently claims all URLs via it's guess_can_open method.

https://github.com/pydata/xarray/blob/6e82a3afa8e47e7ed59441e77f812ceeaeaf5668/xarray/backends/netCDF4_.py#L718-L731

This is overeager and led to issues such as https://github.com/pydata/xarray/issues/10801. Therefore this behavior needs to be deprecated in favor of either more explicit options https://github.com/pydata/xarray/pull/10931#issuecomment-3560387850 or at a minimum a tighter scope for what URLs the backend claims in it's guess method.

However, some users and workflows currently rely on this behavior, which caused failures: https://github.com/pydata/xarray/pull/10804#discussion_r2542097630

Therefore, any changes will require a long deprecation cycle with a warning emitted when a user relies on the to-be-changed guessing behavior.

Questions

  1. What should the end state be?

Is this a wholesale change of guessing behavior for all backends - potentially removing guessing in favor of always explicit speccificaiton? Or is this a smaller descoping of what URLs the netcdf4 backend claims?

  1. What time frame?

I propose the 2026.01.0 release

Additional reading

The URL-pipeline syntax originally proposed in ZEP8, that now lives here: https://github.com/jbms/url-pipeline#url-pipeline-specification seems as though it would be able to solve the issues here (e.g. specifying if something is a dap url)

Dominant language
Python
Stars
4.2k
Forks
1.5k
Avg merge
2d 21h
Merged PRs (30d)
74

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

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.

More from pydata/xarray

All issues in pydata/xarray

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.