A file system interface (cdffs
) to allow users to work with CDF Files using the fsspec supported/compatible python packages (pandas
, xarray
etc).
fsspec
provides an abstract file system interface to work with local/cloud storages and based on the protocol name (example, s3
or abfs
) provided in the path, fsspec
translates the incoming requests to storage specific implementations and send the responses back to the upstream package to work with the desired data.
Refer fsspec documentation to get the list of all supported/compatible python packages.
cdffs
is available on PyPI. Install using,
pip install cognite-cdffs
Important steps to follow when working with CDF Files using the fsspec
supported python packages.
- Import
cdffs
package
from cognite import cdffs # noqa
-
Follow instructions from Authentication to authenticate.
-
Read/write the files from/to CDF using
fsspec
supported packages. Example,- Read
zarr
files using usingxarray
.
ds = xarray.open_zarr("cdffs://sample_data/test.zarr")
- Write
zarr
files usingxarray
.
ds.to_zarr("cdffs://sample_data/test.zarr", storage_options={"file_metadata": metadata})
- Read
Refer cdffs.readthedocs.io for more details.
cdffs
uses pydandic.v1 package using vendoring. It was mainly introduced to overcome version conflicts
related to the Cognite Notebooks.
Want to contribute? Check out CONTRIBUTING.