Skip to content

open_dataset

open_dataset(file_path, flag='r', dataset_type='grid', compression='zstd', compression_level=None, **kwargs)

Open a cfdb dataset. This uses the python package booklet for managing data in a single file.

Parameters:

Name Type Description Default
file_path Union[str, Path]

It must be a path to a local file location. If you want to use a tempfile, then use the name from the NamedTemporaryFile initialized class.

required
flag str

Flag associated with how the file is opened according to the dbm style.

  • 'r' -- Open existing database for reading only (default).
  • 'w' -- Open existing database for reading and writing.
  • 'c' -- Open database for reading and writing, creating it if it doesn't exist.
  • 'n' -- Always create a new, empty database, open for reading and writing.
'r'
dataset_type str

The dataset type to be opened. Default is 'grid'.

  • 'grid' -- The standard CF conventions dimensions/coordinates. Each coordinate must be unique and increasing in ascending order. Each coordinate represents a single axis (i.e. x, y, z, t). The z axis is currently optional.
  • 'ts_ortho' -- A special time series coordinate structure representing the orthogonal multidimensional array representation of time series. Designed for time series data with sparse geometries (e.g. station time series data). The Geometry dtype must represent the xy axis. The z axis is currently optional.
'grid'
compression str

The compression algorithm used for compressing all data. Must be either 'zstd' or 'lz4'. zstd has a good balance of compression ratio to speed, while lz4 emphasises speed. Default is 'zstd'.

'zstd'
compression_level int or None

The compression level used by the compression algorithm. Setting this to None will use the defaults, which is currently 1 for both compression options.

None
**kwargs

Any kwargs that can be passed to booklet.open.

{}

Returns:

Type Description
Dataset