Skip to content

Read file-like object datasets #937

Open

Description

@davidhassell

It would be very nice to be able to read datasets defined by an open file handle with cfdm.read.

>>> import fsspec
>>> fs = fsspec.filesystem(...)
>>> fh = fs.open('filename.nc', 'rb')
>>> f = cf.read(fh)

This particular example would be equivalent to:

>>> f = cf.read('filename.nc', filesystem=fs)

E.g. for a local file, this should also work:

>>> fh = open('filename.nc', 'rb')
>>> f = cf.read(fh)

This will be largely implemented via NCAS-CMS/cfdm#401

PR to follow.

Activity

  1. changed the title [-]Read open file handle datasets[/-] [+]Read file-like object datasets[/+] on Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dataset readRelating to reading datasetsenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions