grib/src/main/java/ucar/nc2/grib/grib2/Grib2DataReader.java
private void scanningModeCheck(float[] data, int scanMode, int Xlength) {
    // Mode  0  +x, -y, adjacent x, adjacent rows same dir
    // Mode  64 +x, +y, adjacent x, adjacent rows same dir
    if ((scanMode == 0) || (scanMode == 64))  // dont flip Y - handle it in the HorizCoordSys
    {
      return;
    }

    // change -x to +x ie east to west -> west to east
    if (!GribUtils.scanModeXisPositive(scanMode)) {
      float tmp;
      int mid = Xlength / 2;
      for (int index = 0; index < data.length; index += Xlength) {
        for (int idx = 0; idx < mid; idx++) {
          tmp = data[index + idx];
          data[index + idx] = data[index + Xlength - idx - 1];
          data[index + Xlength - idx - 1] = tmp;
        }
      }
      return;
    }

    if (!GribUtils.scanModeSameDirection(scanMode)) {
      float tmp;
      int mid = Xlength / 2;
      for (int index = 0; index < data.length; index += Xlength) {
        int row = index / Xlength;
        if (row % 2 != 0) {  // odd numbered row, calculate reverse index
          for (int idx = 0; idx < mid; idx++) {
            tmp = data[index + idx];
            data[index + idx] = data[index + Xlength - idx - 1];
            data[index + Xlength - idx - 1] = tmp;
          }
        }
      }
    }
  }
private void scanningModeCheck(float[] data, int scanMode, int Xlength) {
    // Mode  0  +x, -y, adjacent x, adjacent rows same dir
    // Mode  64 +x, +y, adjacent x, adjacent rows same dir
    if ((scanMode == 0) || (scanMode == 64))  // dont flip Y - handle it in the HorizCoordSys
    {
      return;
    }

    // change -x to +x ie east to west -> west to east
    if (!GribUtils.scanModeXisPositive(scanMode)) {
      float tmp;
      int mid = Xlength / 2;
      for (int index = 0; index < data.length; index += Xlength) {
        for (int idx = 0; idx < mid; idx++) {
          tmp = data[index + idx];
          data[index + idx] = data[index + Xlength - idx - 1];
          data[index + Xlength - idx - 1] = tmp;
        }
      }
      return;
    }

    if (!GribUtils.scanModeSameDirection(scanMode)) {
      float tmp;
      int mid = Xlength / 2;
      for (int index = 0; index < data.length; index += Xlength) {
        int row = index / Xlength;
        if (row % 2 != 0) {  // odd numbered row, calculate reverse index
          for (int idx = 0; idx < mid; idx++) {
            tmp = data[index + idx];
            data[index + idx] = data[index + Xlength - idx - 1];
            data[index + Xlength - idx - 1] = tmp;
          }
        }
      }
    }
  }
private void scanningModeCheck ( float [ ] data , int scanMode , int Xlength ) { // Mode  0  +x, -y, adjacent x, adjacent rows same dir // Mode  64 +x, +y, adjacent x, adjacent rows same dir if ( ( scanMode == 0 ) || ( scanMode == 64 ) ) // dont flip Y - handle it in the HorizCoordSys { return ; } // change -x to +x ie east to west -> west to east if ( ! GribUtils . scanModeXisPositive ( scanMode ) ) { float tmp ; int mid = Xlength / 2 ; for ( int index = 0 ; index < data . length ; index += Xlength ) { for ( int idx = 0 ; idx < mid ; idx ++ ) { tmp = data [ index + idx ] ; data [ index + idx ] = data [ index + Xlength - idx - 1 ] ; data [ index + Xlength - idx - 1 ] = tmp ; } } return ; } if ( ! GribUtils . scanModeSameDirection ( scanMode ) ) { float tmp ; int mid = Xlength / 2 ; for ( int index = 0 ; index < data . length ; index += Xlength ) { int row = index / Xlength ; if ( row % 2 != 0 ) { // odd numbered row, calculate reverse index for ( int idx = 0 ; idx < mid ; idx ++ ) { tmp = data [ index + idx ] ; data [ index + idx ] = data [ index + Xlength - idx - 1 ] ; data [ index + Xlength - idx - 1 ] = tmp ; } } } } }
LOOK might be wrong for a quasi regular (thin) grid ??
LOOK might be wrong for a quasi regular ( thin ) grid ??