Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

netcdf.defVarDeflate

Define compression parameters for NetCDF variable

Syntax

netcdf.defVarDeflate(ncid,varid,shuffle,deflate,deflateLevel)

Description

netcdf.defVarDeflate(ncid,varid,shuffle,deflate,deflateLevel) sets the compression parameters for the NetCDF variable specified by varid in the location specified by ncid.

Input Arguments

ncid

Identifier of NetCDF file, returned by netcdf.create or netcdf.open, or of a NetCDF group, returned by netcdf.defGrp.

varid

Identifier of a NetCDF variable, returned by netcdf.defVar.

shuffle

Boolean value. To turn on the shuffle filter, set this argument to true. The shuffle filter can assist with the compression of integer data by changing the byte order in the data stream.

deflate

Boolean value. To turn on compression, set this argument to true and set the deflateLevel argument to the desired compression level.

deflateLevel

Numeric value between 0 and 9 specifying the amount of compression, where 0 is no compression and 9 is the most compression.

Examples

This example create a variable with dimensions [1800 3600] and a compression level of 5. This results in a chunked layout that is a 10-by-10 grid.

ncid = netcdf.create('myfile.nc','NETCDF4');
latdimid = netcdf.defDim(ncid,'lat',1800);
londimid = netcdf.defDim(ncid,'col',3600);
varid = netcdf.defVar(ncid,'earthgrid','double',[latdimid londimid]);
netcdf.defVarDeflate(ncid,varid,true,true,5);
netcdf.close(ncid);

References

This function corresponds to the nc_def_var_deflate function in the netCDF library C API.

For copyright information, read the netcdfcopyright.txt and mexnccopyright.txt files.

Was this topic helpful?