Ignore:
Timestamp:
06/03/15 15:06:25 (9 years ago)
Author:
rlacroix
Message:

Support NetCDF4 compression.

Only available for non-parallel output so either if only one server is used or if the multiple file mode is enabled).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/output/netCdfInterface.cpp

    r578 r606  
    525525 
    526526/*! 
     527This function sets the compression level to the specified variable 
     528\param [in] ncid Groud id (or file id) 
     529\param [in] varId Id of the variable 
     530\param [in] compressionLevel The compression level from 0 to 9 (0 disables the compression, 9 is the higher compression) 
     531\return Status code 
     532*/ 
     533int CNetCdfInterface::defVarDeflate(int ncid, int varId, int compressionLevel) 
     534{ 
     535  int status = nc_def_var_deflate(ncid, varId, false, (compressionLevel > 0), compressionLevel); 
     536  if (NC_NOERR != status) 
     537  { 
     538    StdString errormsg(nc_strerror(status)); 
     539    StdStringStream sstr; 
     540 
     541    sstr << "Error in calling function " << "nc_def_var_deflate(ncid, varId, false, (compressionLevel > 0), compressionLevel)" << std::endl; 
     542    sstr << errormsg << std::endl; 
     543    sstr << "Unable to set the compression level of the variable with id: " << varId 
     544         << " and compression level: " << compressionLevel << std::endl; 
     545    StdString e = sstr.str(); 
     546    throw CNetCdfException(e); 
     547  } 
     548 
     549  return status; 
     550} 
     551 
     552/*! 
    527553Set or unset the fill mode for a NetCDF file specified by its file id. 
    528554\param [in] ncid File id 
Note: See TracChangeset for help on using the changeset viewer.