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 42541 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-10-18 02:34:04,428 - distributed.worker - ERROR - Compute Failed
Key:       generate_virtual_dataset-f81a2d99-178b-4533-bd84-9758d54e6acc
State:     executing
Task:  <Task 'generate_virtual_dataset-f81a2d99-178b-4533-bd84-9758d54e6acc' generate_virtual_dataset(...)>
Exception: 'TypeError("open_virtual_dataset() got an unexpected keyword argument \'indexes\'")'
Traceback: '  File "/tmp/ipykernel_4868/841847916.py", line 2, in generate_virtual_dataset\n'

2026-10-18 02:34:05,141 - distributed.worker - ERROR - Compute Failed
Key:       generate_virtual_dataset-158c6883-ece6-4d02-8dee-9e3f674bf892
State:     executing
Task:  <Task 'generate_virtual_dataset-158c6883-ece6-4d02-8dee-9e3f674bf892' generate_virtual_dataset(...)>
Exception: 'TypeError("open_virtual_dataset() got an unexpected keyword argument \'indexes\'")'
Traceback: '  File "/tmp/ipykernel_4868/841847916.py", line 2, in generate_virtual_dataset\n'

2026-10-18 02:34:05,161 - distributed.worker - ERROR - Compute Failed
Key:       generate_virtual_dataset-9c5296ea-cece-4315-ac86-2ffacf4afeab
State:     executing
Task:  <Task 'generate_virtual_dataset-9c5296ea-cece-4315-ac86-2ffacf4afeab' generate_virtual_dataset(...)>
Exception: 'TypeError("open_virtual_dataset() got an unexpected keyword argument \'indexes\'")'
Traceback: '  File "/tmp/ipykernel_4868/841847916.py", line 2, in generate_virtual_dataset\n'

2026-10-18 02:34:05,432 - distributed.worker - ERROR - Compute Failed
Key:       generate_virtual_dataset-ea0f95cf-ce51-40bb-a675-1995c124989a
State:     executing
Task:  <Task 'generate_virtual_dataset-ea0f95cf-ce51-40bb-a675-1995c124989a' generate_virtual_dataset(...)>
Exception: 'TypeError("open_virtual_dataset() got an unexpected keyword argument \'indexes\'")'
Traceback: '  File "/tmp/ipykernel_4868/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).