| 1919 | //------------------------------------------------------------------------------ |
| 1920 | |
| 1921 | void vtkMPASReader::ShiftLonData() |
| 1922 | { |
| 1923 | vtkDebugMacro(<< "In ShiftLonData..." << endl); |
| 1924 | // if atmospheric data, or zero centered, set center to 180 instead of 0 |
| 1925 | if (IsAtmosphere || IsZeroCentered) |
| 1926 | { |
| 1927 | for (size_t j = this->PointOffset; j < this->NumberOfPoints + this->PointOffset; j++) |
| 1928 | { |
| 1929 | // need to shift over the point so center is at PI |
| 1930 | if (this->PointX[j] < 0) |
| 1931 | { |
| 1932 | this->PointX[j] += 2 * vtkMath::Pi(); |
| 1933 | } |
| 1934 | } |
| 1935 | } |
| 1936 | |
| 1937 | if (CenterLon != 180) |
| 1938 | { |
| 1939 | for (size_t j = this->PointOffset; j < this->NumberOfPoints + this->PointOffset; j++) |
| 1940 | { |
| 1941 | // need to shift over the point if centerLon dictates |
| 1942 | if (this->CenterRad < vtkMath::Pi()) |
| 1943 | { |
| 1944 | if (this->PointX[j] > (this->CenterRad + vtkMath::Pi())) |
| 1945 | { |
| 1946 | this->PointX[j] = -((2 * vtkMath::Pi()) - this->PointX[j]); |
| 1947 | } |
| 1948 | } |
| 1949 | else if (this->CenterRad > vtkMath::Pi()) |
| 1950 | { |
| 1951 | if (this->PointX[j] < (this->CenterRad - vtkMath::Pi())) |
| 1952 | { |
| 1953 | this->PointX[j] += 2 * vtkMath::Pi(); |
| 1954 | } |
| 1955 | } |
| 1956 | } |
| 1957 | } |
| 1958 | vtkDebugMacro(<< "Leaving ShiftLonData..." << endl); |
| 1959 | } |
| 1960 | |
| 1961 | //------------------------------------------------------------------------------ |
| 1962 | // Add a "mirror point" -- a point on the opposite side of the lat/lon |