Main Content

netcdf.inqVarChunking

Return chunking parameters for netCDF variable

    Description

    [storage,chunkSizes] = netcdf.inqVarChunking(ncid,varid) returns the chunking parameters for the netCDF variable specified by varid in the file or group specified by ncid.

    example

    Examples

    collapse all

    Open the sample netCDF file, and get chunking parameters for a variable. In this case, the specified variable is stored in 360-by-180-by-1 chunks.

    ncid = netcdf.open("example.nc","NOWRITE");
    gid = netcdf.inqNcid(ncid,"grid1");
    varid = netcdf.inqVarID(gid,"temp");
    [storage,chunkSizes] = netcdf.inqVarChunking(gid,varid)
    
    storage =
    
        'chunked'
    
    
    chunkSizes =
    
       360   180     1
    

    Close the netCDF file.

    netcdf.close(ncid)
    

    Input Arguments

    collapse all

    NetCDF file or group identifier, specified as a nonnegative integer scalar. You can use the netcdf.create or netcdf.open function to return a file identifier. You can use the netcdf.defGrp function to return a group identifier.

    Data Types: double

    NetCDF variable identifier, specified as a nonnegative integer scalar. You can use the netcdf.defVar function to return a variable identifier.

    Data Types: double

    Output Arguments

    collapse all

    Chunk type of the netCDF variable, returned as 'chunked' or 'contiguous'.

    Dimensions of chunk of the netCDF variable, returned as a positive integer array, or [] if storage is 'contiguous'.

    Because MATLAB® uses column-major ordering, the order of dimensions in chunkSizes is reversed relative to what would be observed in the netCDF C API.

    Tips

    • This function corresponds to the nc_inq_var_chunking function in the netCDF library C API.

    Version History

    Introduced in R2010b