Changeset 391 for XIOS/trunk/src/output/onetcdf4.cpp
- Timestamp:
- 11/09/12 17:23:42 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/output/onetcdf4.cpp
r382 r391 275 275 int grpid = this->getCurrentGroup(); 276 276 int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); 277 CheckError(nc_put_att(grpid, varid, name.c_str(), NC_CHAR, value.size() +1, value.c_str()));277 CheckError(nc_put_att(grpid, varid, name.c_str(), NC_CHAR, value.size(), value.c_str())); 278 278 //CheckError(nc_put_att_string(grpid, varid, name.c_str(), 1, &str)); 279 279 } … … 289 289 CheckError(nc_put_att_double(grpid, varid, name.c_str(), NC_DOUBLE,1, &value)); 290 290 } 291 291 292 template <> 293 void CONetCDF4::addAttribute 294 (const StdString & name, const CArray<double,1>& value, const StdString * varname ) 295 { 296 int grpid = this->getCurrentGroup(); 297 int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); 298 CheckError(nc_put_att_double(grpid, varid, name.c_str(), NC_DOUBLE,value.numElements(), value.dataFirst())); 299 } 292 300 //--------------------------------------------------------------- 293 301 … … 300 308 CheckError(nc_put_att_float(grpid, varid, name.c_str(), NC_FLOAT, 1, &value)); 301 309 } 310 311 template <> 312 void CONetCDF4::addAttribute 313 (const StdString & name, const CArray<float,1>& value, const StdString * varname ) 314 { 315 int grpid = this->getCurrentGroup(); 316 int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); 317 CheckError(nc_put_att_float(grpid, varid, name.c_str(), NC_FLOAT,value.numElements(), value.dataFirst())); 318 } 302 319 303 320 //--------------------------------------------------------------- … … 312 329 } 313 330 331 template <> 332 void CONetCDF4::addAttribute 333 (const StdString & name, const CArray<int,1>& value, const StdString * varname ) 334 { 335 int grpid = this->getCurrentGroup(); 336 int varid = (varname == NULL) ? NC_GLOBAL : this->getVariable(*varname); 337 CheckError(nc_put_att_int(grpid, varid, name.c_str(), NC_INT,value.numElements(), value.dataFirst())); 338 } 314 339 //--------------------------------------------------------------- 315 340
Note: See TracChangeset
for help on using the changeset viewer.