How to decrease nc file bulk using mexnc

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Posts: 30
Joined: Thu Aug 01, 2013 3:11 pm
Location: Ocean University of China

How to decrease nc file bulk using mexnc

#1 Post by shifei » Wed Sep 21, 2016 1:28 pm


Using NETCDF4 can obviously decrease nc file bulk.
Is mexnc function able to make it ?

User avatar
Posts: 526
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University

Re: How to decrease nc file bulk using mexnc

#2 Post by wilkin » Thu Sep 22, 2016 11:04 am

The built-in netcdf utility in more recent releases of Matlab is what you want:
>> help netcdf.create
netcdf.create Create new netCDF file.
ncid = netcdf.create(filename, mode) creates a new netCDF file
according to the file creation mode. The return value is a file

The type of access is described by the mode parameter, which could
be one of the following string values or a bitwise-or of numeric mode

'CLOBBER' - overwrite existing files
'NOCLOBBER' - do not overwrite existing files
'SHARE' - allow for synchronous file updates
'64BIT_OFFSET' - allow the creation of 64-bit files instead of
the classic format
'NETCDF4' - create a netCDF-4/HDF5 file
'CLASSIC_MODEL' - enforce classic model, has no effect unless used
in a bitwise-or with 'NETCDF4'
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559

User avatar
Posts: 135
Joined: Mon May 05, 2003 2:41 pm
Location: The University of Western Australia, Perth, Australia

Re: How to decrease nc file bulk using mexnc

#3 Post by jivica » Fri Sep 23, 2016 5:21 am

Just a hint you can try saving variables as short using add_offset and scale_factor.
This is useful if you have already created netCDF files but want to make them smaller.
With nco you have already ncpdq doing that for you...

Post Reply