grib/src/main/java/ucar/nc2/grib/grib2/Grib2Record.java
public static float[] readData(RandomAccessFile raf, long drsPos, long bmsPos, int gdsNumberPoints, int scanMode, int nx, int ny, int[] nptsInLine) throws IOException {
    raf.seek(drsPos);
    Grib2SectionDataRepresentation drs = new Grib2SectionDataRepresentation(raf);
    Grib2SectionBitMap bms = new Grib2SectionBitMap(raf);
    Grib2SectionData dataSection = new Grib2SectionData(raf);

    if (bmsPos > 0)
      bms = Grib2SectionBitMap.factory(raf, bmsPos);

    Grib2DataReader reader = new Grib2DataReader(drs.getDataTemplate(), gdsNumberPoints, drs.getDataPoints(),
            scanMode, nx, dataSection.getStartingPosition(), dataSection.getMsgLength());

    Grib2Drs gdrs = drs.getDrs(raf);

    float[] data = reader.getData(raf, bms, gdrs);

    if (nptsInLine != null)
      data = QuasiRegular.convertQuasiGrid(data, nptsInLine, nx, ny, GribData.getInterpolationMethod());

    if (getlastRecordRead)
      lastRecordRead = Grib2RecordScanner.findRecordByDrspos(raf, drsPos);
    return data;
  }
public static float[] readData(RandomAccessFile raf, long drsPos, long bmsPos, int gdsNumberPoints, int scanMode, int nx, int ny, int[] nptsInLine) throws IOException {
    raf.seek(drsPos);
    Grib2SectionDataRepresentation drs = new Grib2SectionDataRepresentation(raf);
    Grib2SectionBitMap bms = new Grib2SectionBitMap(raf);
    Grib2SectionData dataSection = new Grib2SectionData(raf);

    if (bmsPos > 0)
      bms = Grib2SectionBitMap.factory(raf, bmsPos);

    Grib2DataReader reader = new Grib2DataReader(drs.getDataTemplate(), gdsNumberPoints, drs.getDataPoints(),
            scanMode, nx, dataSection.getStartingPosition(), dataSection.getMsgLength());

    Grib2Drs gdrs = drs.getDrs(raf);

    float[] data = reader.getData(raf, bms, gdrs);

    if (nptsInLine != null)
      data = QuasiRegular.convertQuasiGrid(data, nptsInLine, nx, ny, GribData.getInterpolationMethod());

    if (getlastRecordRead)
      lastRecordRead = Grib2RecordScanner.findRecordByDrspos(raf, drsPos);
    return data;
  }
public static float [ ] readData ( RandomAccessFile raf , long drsPos , long bmsPos , int gdsNumberPoints , int scanMode , int nx , int ny , int [ ] nptsInLine ) throws IOException { raf . seek ( drsPos ) ; Grib2SectionDataRepresentation drs = new Grib2SectionDataRepresentation ( raf ) ; Grib2SectionBitMap bms = new Grib2SectionBitMap ( raf ) ; Grib2SectionData dataSection = new Grib2SectionData ( raf ) ; if ( bmsPos > 0 ) bms = Grib2SectionBitMap . factory ( raf , bmsPos ) ; Grib2DataReader reader = new Grib2DataReader ( drs . getDataTemplate ( ) , gdsNumberPoints , drs . getDataPoints ( ) , scanMode , nx , dataSection . getStartingPosition ( ) , dataSection . getMsgLength ( ) ) ; Grib2Drs gdrs = drs . getDrs ( raf ) ; float [ ] data = reader . getData ( raf , bms , gdrs ) ; if ( nptsInLine != null ) data = QuasiRegular . convertQuasiGrid ( data , nptsInLine , nx , ny , GribData . getInterpolationMethod ( ) ) ; if ( getlastRecordRead ) lastRecordRead = Grib2RecordScanner . findRecordByDrspos ( raf , drsPos ) ; return data ; }
Read data array: use when you want to be independent of the GribRecord

@param raf             from this RandomAccessFile
@param drsPos          Grib2SectionDataRepresentation starts here
@param bmsPos          if non-zero, use the bms that starts here
@param gdsNumberPoints gdss.getNumberPoints()
@param scanMode        gds.scanMode
@param nx              gds.nx
@return data as float[] array
@throws IOException on read error
Read data array : use when you want to be independent of the GribRecord