davidhassell · GitHub

It would be very nice to be able to read Kerchunk datasets with cf.read.

The route to this is not to pass in a Kerchunk file name to cf.read:

>>> f = cf.read('kerchunk.json')

because there doesn't seem to be a nice one-size-fits-all way to open and parse them.

Rather, we should assume that the user has opened it into a virtual directory, and passes that to cf.read:

>>> import fsspec
>>> fs = fsspec.filesystem('reference', fo='kerchunk.json', <options>)
>>> kerchunk = fs.get_mapper()
>>> f = cf.read(kerchunk)

This is (in essence) how other libraries deal with Kerchunk (e.g. zarr and xarray).

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

PR to follow.

Read the original on github.com ↗