Changeset 2529 for XIOS3/trunk/src/io/onetcdf4.cpp
- Timestamp:
- 07/18/23 15:12:50 (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/src/io/onetcdf4.cpp
r2481 r2529 2 2 3 3 #include "onetcdf4.hpp" 4 #include "onetcdf4_plugin.hpp" 4 5 #include "group_template.hpp" 5 6 #include "mpi.hpp" … … 505 506 CNetCdfInterface::defVarFill(grpid, varid, true, NULL); 506 507 } 507 508 setCompressionLevel(name, compressionLevel) ;509 508 510 509 return varid; … … 513 512 //--------------------------------------------------------------- 514 513 515 void CONetCDF4::setCompressionLevel(const StdString& varname, int compressionLevel)514 void CONetCDF4::setCompressionLevel(const StdString& varname, const StdString& compressionType, int compressionLevel, const CArray<double,1>& compressionParams) 516 515 { 517 516 if (compressionLevel < 0 || compressionLevel > 9) 518 517 ERROR("void CONetCDF4::setCompressionLevel(const StdString& varname, int compressionLevel)", 519 518 "Invalid compression level for variable \"" << varname << "\", the value should range between 0 and 9."); 520 if (compressionLevel && wmpi) 519 #ifndef PARALLEL_COMPRESSION 520 if ( ((compressionLevel)||(compressionParams.numElements())) && wmpi) 521 521 ERROR("void CONetCDF4::setCompressionLevel(const StdString& varname, int compressionLevel)", 522 522 "Impossible to use compression for variable \"" << varname << "\" when using parallel mode."); 523 #endif 523 524 int grpid = this->getCurrentGroup(); 524 525 int varid = this->getVariable(varname); 525 CNetCdfInterface::defVarDeflate(grpid, varid, compressionLevel); 526 if (compressionType=="None") 527 { 528 } 529 else if (compressionType=="gzip") 530 { 531 CNetCdfInterface::defVarDeflate(grpid, varid, compressionLevel); 532 } 533 else 534 { 535 size_t cd_nelmts; 536 unsigned int* cd_values = NULL; 537 if (compressionType=="SZ") 538 { 539 CONetCDF4Plugin::interpretParametersSZ(compressionParams, &cd_nelmts, &cd_values); 540 CNetCdfInterface::defVarFilter(grpid, varid, 32017, cd_nelmts, cd_values); 541 } 542 else 543 { 544 ERROR("void CONetCDF4::setCompressionLevel(...)", "compression_type = " << compressionType << " is not managed"); 545 } 546 if (cd_values!=NULL) delete [] cd_values; 547 } 548 526 549 } 527 550
Note: See TracChangeset
for help on using the changeset viewer.