MCPcopy Create free account
hub / github.com/Kitware/VTK / GetNcAtts

Method GetNcAtts

IO/NetCDF/vtkMPASReader.cxx:1306–1337  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1304
1305//------------------------------------------------------------------------------
1306int vtkMPASReader::GetNcAtts()
1307{
1308 int attid = -1;
1309 nc_inq_attid(this->Internals->ncFile, NC_GLOBAL, "on_a_sphere", &attid);
1310 if (attid == -1)
1311 {
1312 vtkWarningMacro(
1313 "Attribute 'on_a_sphere' missing in file " << this->FileName << ". Assuming \"YES\".");
1314 this->OnASphere = true;
1315 }
1316 else
1317 {
1318 size_t attlen;
1319 if (this->Internals->nc_err(
1320 nc_inq_attlen(this->Internals->ncFile, NC_GLOBAL, "on_a_sphere", &attlen)))
1321 {
1322 return 0;
1323 }
1324 char* val = new char[attlen + 1];
1325 val[attlen] = '\0';
1326 if (this->Internals->nc_err(
1327 nc_get_att_text(this->Internals->ncFile, NC_GLOBAL, "on_a_sphere", val)))
1328 {
1329 delete[] val;
1330 return 0;
1331 }
1332 this->OnASphere = (strcmp(val, "YES") == 0);
1333 delete[] val;
1334 }
1335
1336 return 1;
1337}
1338
1339//------------------------------------------------------------------------------
1340// Check parameters are valid

Callers 1

RequestInformationMethod · 0.95

Calls 4

nc_inq_attidFunction · 0.85
nc_inq_attlenFunction · 0.85
nc_get_att_textFunction · 0.85
nc_errMethod · 0.45

Tested by

no test coverage detected