grib/src/main/java/ucar/nc2/grib/grib2/Grib2DataReader.java
public float[] getData(RandomAccessFile raf, Grib2SectionBitMap bitmapSection, Grib2Drs gdrs)
      throws IOException {
    this.bitmap = bitmapSection.getBitmap(raf);
    this.bitmapIndicator = bitmapSection.getBitMapIndicator();

    if (bitmap != null) { // is bitmap ok ?
      if (bitmap.length * 8 < totalNPoints) { // gdsNumberPoints == nx * ny ??
        logger.warn("Bitmap section length = {} != grid length {} ({},{})", bitmap.length,
            totalNPoints, nx, totalNPoints / nx);
        throw new IllegalStateException("Bitmap section length!= grid length");
      }
    }

    raf.seek(startPos + 5); // skip past first 5 bytes in data section, now ready to read

    float[] data;
    switch (dataTemplate) {
      case 0:
        data = getData0(raf, (Grib2Drs.Type0) gdrs);
        break;
      case 2:
        data = getData2(raf, (Grib2Drs.Type2) gdrs);
        break;
      case 3:
        data = getData3(raf, (Grib2Drs.Type3) gdrs);
        break;
      case 40:
        data = getData40(raf, (Grib2Drs.Type40) gdrs);
        break;
      case 41:
        data = getData41(raf, (Grib2Drs.Type0) gdrs);
        break;
      case 50002:
        data = getData50002(raf, (Grib2Drs.Type50002) gdrs);
        break;
      default:
        throw new UnsupportedOperationException("Unsupported DRS type = " + dataTemplate);
    }

    //int scanMode = gds.getGds().getScanMode();
    //int nx = gds.getGds().getNx();  // needs some smarts for different type Grids
    scanningModeCheck(data, scanMode, nx);

    return data;
  }
public float[] getData(RandomAccessFile raf, Grib2SectionBitMap bitmapSection, Grib2Drs gdrs)
      throws IOException {
    this.bitmap = bitmapSection.getBitmap(raf);
    this.bitmapIndicator = bitmapSection.getBitMapIndicator();

    if (bitmap != null) { // is bitmap ok ?
      if (bitmap.length * 8 < totalNPoints) { // gdsNumberPoints == nx * ny ??
        logger.warn("Bitmap section length = {} != grid length {} ({},{})", bitmap.length,
            totalNPoints, nx, totalNPoints / nx);
        throw new IllegalStateException("Bitmap section length!= grid length");
      }
    }

    raf.seek(startPos + 5); // skip past first 5 bytes in data section, now ready to read

    float[] data;
    switch (dataTemplate) {
      case 0:
        data = getData0(raf, (Grib2Drs.Type0) gdrs);
        break;
      case 2:
        data = getData2(raf, (Grib2Drs.Type2) gdrs);
        break;
      case 3:
        data = getData3(raf, (Grib2Drs.Type3) gdrs);
        break;
      case 40:
        data = getData40(raf, (Grib2Drs.Type40) gdrs);
        break;
      case 41:
        data = getData41(raf, (Grib2Drs.Type0) gdrs);
        break;
      case 50002:
        data = getData50002(raf, (Grib2Drs.Type50002) gdrs);
        break;
      default:
        throw new UnsupportedOperationException("Unsupported DRS type = " + dataTemplate);
    }

    //int scanMode = gds.getGds().getScanMode();
    //int nx = gds.getGds().getNx();  // needs some smarts for different type Grids
    scanningModeCheck(data, scanMode, nx);

    return data;
  }
/*
Code Table Code table 5.0 - Data representation template number (5.0)
0: Grid point data - simple packing
1: Matrix value at grid point - simple packing
2: Grid point data - complex packing
3: Grid point data - complex packing and spatial differencing
4: Grid point data - IEEE floating point data
40: Grid point data - JPEG 2000 code stream format
41: Grid point data - Portable Network Graphics (PNG)
50: Spectral data - simple packing
51: Spherical harmonics data - complex packing
61: Grid point data - simple packing with logarithm pre-processing
200: Run length packing with level values
65535: Missing