------------------------------------------------------------------------------
| 1775 | |
| 1776 | //------------------------------------------------------------------------------ |
| 1777 | int vtkNetCDFCFReader::ReadMetaData(int ncFD) |
| 1778 | { |
| 1779 | int numDimensions; |
| 1780 | CALL_NETCDF(this->Accessor->inq_ndims(ncFD, &numDimensions)); |
| 1781 | this->DimensionInfo->v.resize(numDimensions); |
| 1782 | |
| 1783 | std::set<std::string> specialVariables; |
| 1784 | |
| 1785 | for (int i = 0; i < numDimensions; i++) |
| 1786 | { |
| 1787 | this->DimensionInfo->v[i] = |
| 1788 | vtkDimensionInfo(this->Accessor, ncFD, i, this->SpecialDimensionOverrideNames); |
| 1789 | |
| 1790 | // Record any special variables for this dimension. |
| 1791 | vtkStringArray* dimensionVariables = this->DimensionInfo->v[i].GetSpecialVariables(); |
| 1792 | for (vtkIdType j = 0; j < dimensionVariables->GetNumberOfValues(); j++) |
| 1793 | { |
| 1794 | specialVariables.insert(dimensionVariables->GetValue(j)); |
| 1795 | } |
| 1796 | } |
| 1797 | |
| 1798 | int numVariables; |
| 1799 | CALL_NETCDF(this->Accessor->inq_nvars(ncFD, &numVariables)); |
| 1800 | |
| 1801 | // Check all variables for special 2D coordinates. |
| 1802 | for (int i = 0; i < numVariables; i++) |
| 1803 | { |
| 1804 | vtkDependentDimensionInfo info(this->Accessor, ncFD, i, this); |
| 1805 | if (!info.GetValid()) |
| 1806 | continue; |
| 1807 | if (this->FindDependentDimensionInfo(info.GetGridDimensions()) != nullptr) |
| 1808 | { |
| 1809 | continue; |
| 1810 | } |
| 1811 | |
| 1812 | this->DependentDimensionInfo->v.push_back(info); |
| 1813 | |
| 1814 | // Record any special variables. |
| 1815 | vtkStringArray* dimensionVariables = info.GetSpecialVariables(); |
| 1816 | for (vtkIdType j = 0; j < dimensionVariables->GetNumberOfValues(); j++) |
| 1817 | { |
| 1818 | specialVariables.insert(dimensionVariables->GetValue(j)); |
| 1819 | } |
| 1820 | } |
| 1821 | |
| 1822 | // Look at all variables and record them so that the user can select which |
| 1823 | // ones he wants. This oddness of adding and removing from |
| 1824 | // VariableArraySelection is to preserve any current settings for variables. |
| 1825 | typedef std::set<std::string> stringSet; |
| 1826 | stringSet variablesToAdd; |
| 1827 | stringSet variablesToRemove; |
| 1828 | |
| 1829 | // Initialize variablesToRemove with all the variables. Then remove them from |
| 1830 | // the list as we find them. |
| 1831 | for (int i = 0; i < this->VariableArraySelection->GetNumberOfArrays(); i++) |
| 1832 | { |
| 1833 | variablesToRemove.insert(this->VariableArraySelection->GetArrayName(i)); |
| 1834 | } |
nothing calls this directly
no test coverage detected