------------------------------------------------------------------------------
| 537 | |
| 538 | //------------------------------------------------------------------------------ |
| 539 | int vtkNetCDFCAMReader::RequestData( |
| 540 | vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector) |
| 541 | { |
| 542 | if (this->FileName == nullptr || this->ConnectivityFileName == nullptr) |
| 543 | { |
| 544 | vtkWarningMacro("Missing a file name."); |
| 545 | return 0; |
| 546 | } |
| 547 | |
| 548 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 549 | vtkUnstructuredGrid* output = |
| 550 | vtkUnstructuredGrid::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 551 | |
| 552 | vtkDebugMacro(<< "Reading NetCDF CAM file."); |
| 553 | this->UpdateProgress(0); |
| 554 | if (this->CurrentConnectivityFileName != nullptr && |
| 555 | strcmp(this->CurrentConnectivityFileName, this->ConnectivityFileName) != 0) |
| 556 | { |
| 557 | this->Internals->closeConnectivity(); |
| 558 | this->SetCurrentConnectivityFileName(nullptr); |
| 559 | } |
| 560 | if (this->Internals->nc_connectivity == -1) |
| 561 | { |
| 562 | if (!this->Internals->openConnectivity(this->ConnectivityFileName)) |
| 563 | { |
| 564 | vtkErrorMacro(<< "Can't read file " << this->ConnectivityFileName); |
| 565 | return 0; |
| 566 | } |
| 567 | this->SetCurrentConnectivityFileName(this->ConnectivityFileName); |
| 568 | } |
| 569 | |
| 570 | // read in the points first |
| 571 | size_t numLevels = 1; // value for single level |
| 572 | const char* levName = nullptr; |
| 573 | int levelsid = 0; |
| 574 | if (this->VerticalDimension == VERTICAL_DIMENSION_MIDPOINT_LAYERS || |
| 575 | this->VerticalDimension == VERTICAL_DIMENSION_INTERFACE_LAYERS) |
| 576 | { |
| 577 | levName = (this->VerticalDimension == VERTICAL_DIMENSION_MIDPOINT_LAYERS) ? "lev" : "ilev"; |
| 578 | int dimid; |
| 579 | if (this->Internals->nc_err(nc_inq_dimid(this->Internals->nc_points, levName, &dimid))) |
| 580 | { |
| 581 | vtkErrorMacro("Cannot find the number of levels (lev dimension)."); |
| 582 | return 0; |
| 583 | } |
| 584 | if (this->Internals->nc_err(nc_inq_dimlen(this->Internals->nc_points, dimid, &numLevels))) |
| 585 | { |
| 586 | return 0; |
| 587 | } |
| 588 | if (this->Internals->nc_err(nc_inq_varid(this->Internals->nc_points, levName, &levelsid))) |
| 589 | { |
| 590 | vtkErrorMacro("Cannot find the number of levels (lev variable)."); |
| 591 | return 0; |
| 592 | } |
| 593 | int ndims; |
| 594 | if (this->Internals->nc_err(nc_inq_varndims(this->Internals->nc_points, levelsid, &ndims))) |
| 595 | { |
| 596 | return 0; |
nothing calls this directly
no test coverage detected