Ignore:
Timestamp:
11/12/15 16:33:03 (8 years ago)
Author:
mhnguyen
Message:

Reading attributes of curvilinear grid from file

+) Correct some minor bugs detecting type of grid
+) Use constant string for attributes conforming to CF convention
+) Add part of code to read attributes of curvilinear grid

Test
+) On Curie
+) test_remap passes

File:
1 edited

Legend:

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

    r686 r782  
    603603int CNetCdfInterface::inqAttName(int ncid, int varid, int attnum, StdString& name) 
    604604{ 
    605   char attName[NC_MAX_NAME + 1]; 
    606   int status = nc_inq_attname(ncid, varid, attnum, attName); 
     605  std::vector<char> attName(NC_MAX_NAME + 1,' '); 
     606  int status = nc_inq_attname(ncid, varid, attnum, &attName[0]); 
    607607  if (NC_NOERR != status) 
    608608  { 
     
    616616    throw CNetCdfException(e); 
    617617  } 
     618 
     619  int nameSize = 0; 
     620  while ((nameSize < NC_MAX_NAME) && (' ' != attName[nameSize] )) ++nameSize; 
     621  name.resize(nameSize); 
     622//  for (int idx = 0; idx < nameSize; ++idx) name.at(idx) = attName[idx]; 
     623  std::copy(&attName[0], &attName[nameSize-1], name.begin()); 
    618624 
    619625  return status; 
Note: See TracChangeset for help on using the changeset viewer.