Changeset 606 for XIOS/branchs
- Timestamp:
- 06/03/15 15:06:25 (9 years ago)
- Location:
- XIOS/branchs/xios-1.0/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/branchs/xios-1.0/src/config/field_attribute.conf
r501 r606 24 24 DECLARE_ATTRIBUTE(double, add_offset) 25 25 DECLARE_ATTRIBUTE(double, scale_factor) 26 27 DECLARE_ATTRIBUTE(int, compression_level) -
XIOS/branchs/xios-1.0/src/config/file_attribute.conf
r501 r606 14 14 DECLARE_ATTRIBUTE(StdString, par_access) 15 15 16 // DECLARE_ATTRIBUTE_DEF(bool, enabled, true)16 DECLARE_ATTRIBUTE(int, compression_level) -
XIOS/branchs/xios-1.0/src/output/nc4_data_output.cpp
r544 r606 736 736 SuperClassWriter::setDefaultValue(fieldid, default_value); 737 737 } 738 739 if (field->compression_level.isEmpty()) 740 field->compression_level = field->file->compression_level.isEmpty() ? 0 : field->file->compression_level; 741 if (field->compression_level < 0 || field->compression_level > 9) 742 ERROR("void CNc4DataOutput::writeField_(CField* field)", 743 "Invalid compression level, the value should range between 0 and 9."); 744 SuperClassWriter::setCompressionLevel(fieldid, field->compression_level); 738 745 739 746 { // Ecriture des coordonnées -
XIOS/branchs/xios-1.0/src/output/netCdfInterface.cpp
r578 r606 525 525 526 526 /*! 527 This 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 */ 533 int 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 /*! 527 553 This function makes a request to netcdf with a ncid, to set the fill parameters for a variable, 528 554 given variable id and type of fill -
XIOS/branchs/xios-1.0/src/output/netCdfInterface.hpp
r524 r606 90 90 static int defVarChunking(int ncid, int varId, int storage, StdSize chunkSize[]); 91 91 92 //! Define variable compression level 93 static int defVarDeflate(int ncid, int varId, int compressionLevel); 94 92 95 //! Define variable fill parameters 93 96 static int defVarFill(int ncid, int varId, int noFill, void* fillValue); -
XIOS/branchs/xios-1.0/src/output/onetcdf4.cpp
r605 r606 288 288 //--------------------------------------------------------------- 289 289 290 void CONetCDF4::setCompressionLevel(const StdString& varname, int compressionLevel) 291 { 292 int grpid = this->getCurrentGroup(); 293 int varid = this->getVariable(varname); 294 CNetCdfInterface::defVarDeflate(grpid, varid, compressionLevel); 295 } 296 297 //--------------------------------------------------------------- 298 290 299 template <> 291 300 void CONetCDF4::addAttribute … … 414 423 { 415 424 sstart.push_back(record); 416 scount.push_back(1); 425 scount.push_back(1); 417 426 if ((start == NULL) && 418 427 (count == NULL)) i++; … … 421 430 422 431 for (;it != end; it++) 423 { 432 { 424 433 if ((start != NULL) && (count != NULL)) 425 434 { -
XIOS/branchs/xios-1.0/src/output/onetcdf4.hpp
r501 r606 46 46 int addVariable(const StdString & name, nc_type type, 47 47 const std::vector<StdString> & dim); 48 48 49 49 //---------------------------------------------------------------- 50 50 public : 51 51 52 52 template <class T> 53 53 void setDefaultValue(const StdString & varname, const T * value = NULL); 54 54 55 void setCompressionLevel(const StdString& varname, int compressionLevel); 56 55 57 template <class T> void addAttribute (const StdString & name, const T & value, const StdString * varname = NULL); 56 58 … … 62 64 const std::vector<StdSize> * count = NULL); 63 65 64 void writeData(const CArray<int, 2>& data, const StdString & name); 66 void writeData(const CArray<int, 2>& data, const StdString & name); 65 67 void writeTimeAxisData(const CArray<double,1>& data, const StdString & name, 66 68 bool collective, StdSize record, bool Isroot) ; … … 70 72 /// Destructeur /// 71 73 virtual ~CONetCDF4(void); 72 74 73 75 //---------------------------------------------------------------- 74 76 75 77 protected : 76 78 … … 93 95 94 96 //---------------------------------------------------------------- 95 97 96 98 private : 97 99 98 100 template <class T> 99 101 void writeData_(int grpid, int varid, … … 118 120 119 121 ///--------------------------------------------------------------- 120 122 121 123 122 124
Note: See TracChangeset
for help on using the changeset viewer.