Skip to content

Add filesystem parameter to cf.read as pass-through to cfdm.read (Part 1)#932

Merged
davidhassell merged 4 commits intomainfrom
copilot/add-filesystem-parameter-cf-read
Mar 19, 2026
Merged

Add filesystem parameter to cf.read as pass-through to cfdm.read (Part 1)#932
davidhassell merged 4 commits intomainfrom
copilot/add-filesystem-parameter-cf-read

Conversation

Copy link
Contributor

Copilot AI commented Mar 16, 2026

Exposes the new filesystem keyword from cfdm PR #393 at the cf.read level. All logic lives in cfdm; this is purely a wrapper update.

Changes

  • cf/read_write/read.py — adds filesystem=None to cf.read.__new__ signature and documents it via template reference in the docstring. Forwarding is handled by the existing kwargs = locals() / super().__new__(**kwargs) mechanism — no new logic required.
  • cf/docstring/docstring.py — adds the {{read filesystem: optional}} substitution definition (mirrors the cfdm PR definition; can be dropped once a cfdm release includes it, as cfdm templates take precedence).

Usage

import fsspec
fs = fsspec.filesystem("s3", anon=True)

# filesystem.open(path, "rb") is called directly; local glob/expansion is bypassed
fields = cf.read("s3://bucket/path/data.nc", filesystem=fs)

NEXTVERSION placeholders in the docstrings follow the same convention used in the prerequisite cfdm PR and will be resolved at release time.


💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Co-authored-by: bnlawrence <1792815+bnlawrence@users.noreply.github.com>
Copilot AI changed the title [WIP] [931] Add filesystem parameter to cf.read for forwarding Add filesystem parameter to cf.read as pass-through to cfdm.read Mar 16, 2026
Copilot AI requested a review from bnlawrence March 16, 2026 10:36
@davidhassell davidhassell linked an issue Mar 17, 2026 that may be closed by this pull request
Copy link
Collaborator

@davidhassell davidhassell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, once the docstring bit is removed.

Also, could we add to the Changelog, after the **2026-??-??** line:


* New keyword to `cf.read`: ``filesystem``
  (https://github.com/NCAS-CMS/cf-python/issues/931)

Thanks!

@davidhassell davidhassell added enhancement New feature or request dataset read Relating to reading datasets labels Mar 17, 2026
@davidhassell davidhassell added this to the NEXTVERSION milestone Mar 17, 2026
Copy link
Collaborator

@davidhassell davidhassell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go, once NCAS-CMS/cfdm#393 is merged.

@davidhassell davidhassell marked this pull request as ready for review March 19, 2026 09:24
@davidhassell davidhassell merged commit cd9bfac into main Mar 19, 2026
1 of 11 checks passed
@davidhassell davidhassell deleted the copilot/add-filesystem-parameter-cf-read branch March 19, 2026 09:24
@davidhassell davidhassell changed the title Add filesystem parameter to cf.read as pass-through to cfdm.read Add filesystem parameter to cf.read as pass-through to cfdm.read (Part 1) Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dataset read Relating to reading datasets enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a filesystem parameter for cf.read()/cfdm.read()

3 participants