gzip#
- geobricks.gzip(data, complevel=3, shuffle=False, to_file=False)[source]#
Apply a non-lossy compression (gzip) to a netCDF dataset.
Parameters#
- datapath (str or pathlib.Path), or variable (xarray.Dataset, xarray.DataArray)
Dataset (netCDF or xarray variable) that will be gzipped (non-lossy).
Note that
data
will be loaded into a xarray.Dataset or xarray.DataArray.- complevel{1, 2, 3, 4, 5, 6, 7, 8, 9}, default 3
Compression level, (1 being fastest, but lowest compression ratio, 9 being slowest but best compression ratio).
- shufflebool, default False
HD5 shuffle filter, which de-interlaces a block of data before zgip compression by reordering the bytes
- to_filebool or path (str or pathlib.Path), default False
If True and if
data
is a path (str or pathlib.Path), the resulting dataset will be exported to a file with the same pathname and the suffix ‘_gzip’. Ifto_file
is a path, the resulting dataset will be exported to this specified filepath.
Returns#
- data_dsxarray.Dataset
Standard GEOP4TH variable (xarray.Dataset) with gzip compression added.
If
to_file
argument is used, the resulting dataset can also be exported to a file.Examples#
geo.gzip(myDataset, complevel = 4, shuffle = True) geo.gzip(r”D:folderdata1.nc”, complevel = 5)