Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Store virtual datasets as Kerchunk Parquet references

Parquet Logo

Store virtual datasets as Kerchunk Parquet references

Overview

In this notebook we will cover how to store virtual datasets as Kerchunk Parquet references instead of Kerchunk JSON references. For large virtual datasets, using Parquet should have performance implications as the overall reference file size should be smaller and the memory overhead of combining the reference files should be lower.

This notebook builds upon the Kerchunk Basics, Multi-File Datasets with Kerchunk and the Kerchunk and Dask notebooks.

Prerequisites

  • Time to learn: 30 minutes


Imports

Setting up the Dask Client

/home/runner/micromamba/envs/kerchunk-cookbook/lib/python3.14/site-packages/distributed/node.py:195: UserWarning: Port 8787 is already in use.
Perhaps you already have a cluster running?
Hosting the HTTP server on port 35767 instead
  warnings.warn(
Loading...

Create Input File List

Here we are using fsspec's glob functionality along with the * wildcard operator and some string slicing to grab a list of NetCDF files from a s3 fsspec filesystem.

Subset the Data

To speed up our example, lets take a subset of the year of data.

Generate Lazy References

Here we create a function to generate a list of Dask delayed objects.

Start the Dask Processing

To view the processing you can view it in real-time on the Dask Dashboard. ex: http://127.0.0.1:8787/status

2026-09-26 02:59:59,929 - distributed.worker - ERROR - Compute Failed
Key:       generate_virtual_dataset-850883a8-d0a3-4afc-b193-e90c8bc7517a
State:     executing
Task:  <Task 'generate_virtual_dataset-850883a8-d0a3-4afc-b193-e90c8bc7517a' generate_virtual_dataset(...)>
Exception: 'TypeError("open_virtual_dataset() got an unexpected keyword argument \'indexes\'")'
Traceback: '  File "/tmp/ipykernel_4548/841847916.py", line 2, in generate_virtual_dataset\n'

2026-09-26 02:59:59,933 - distributed.worker - ERROR - Compute Failed
Key:       generate_virtual_dataset-9116ee4a-79ad-4f44-9bad-643a39d2d68f
State:     executing
Task:  <Task 'generate_virtual_dataset-9116ee4a-79ad-4f44-9bad-643a39d2d68f' generate_virtual_dataset(...)>
Exception: 'TypeError("open_virtual_dataset() got an unexpected keyword argument \'indexes\'")'
Traceback: '  File "/tmp/ipykernel_4548/841847916.py", line 2, in generate_virtual_dataset\n'

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[6], line 1
----> 1 virtual_datasets = list(dask.compute(*tasks))

File ~/micromamba/envs/kerchunk-cookbook/lib/python3.14/site-packages/dask/base.py:769, in compute(traverse, optimize_graph, scheduler, get, *args, **kwargs)
    766     expr = expr.optimize()
    767     keys = list(flatten(expr.__dask_keys__()))
--> 769     results = schedule(expr, keys, **kwargs)
    771 return repack(results)

Cell In[5], line 2
----> 2     return open_virtual_dataset(
      3         file, indexes={}, reader_options={"storage_options": storage_options}
      4     )

TypeError: open_virtual_dataset() got an unexpected keyword argument 'indexes'

Combine virtual datasets using VirtualiZarr

Write the virtual dataset to a Kerchunk Parquet reference

Shutdown the Dask cluster

Load kerchunked dataset

Next we initiate a fsspec ReferenceFileSystem. We need to pass:

  • The name of the parquet store

  • The remote protocol (This is the protocol of the input file urls)

  • The target protocol (file since we saved our parquet store locally).