cdm/src/main/java/ucar/nc2/iosp/sigmet/Ray.java
public void readData(RandomAccessFile raf, Range gateRange, IndexIterator ii) throws IOException {
    final int REC_SIZE = 6144;
    raf.seek(offset);
    byte[] data = new byte[bins];
    float[] dd = new float[bins];
    byte d;
    int nb = 0;
    short a00;
    // raf.readFully(data);
    if (dataRead > 0) {
      raf.seek(offset);

      for (int i = 0; i < dataRead; i++) {
        d = raf.readByte();
        dd[i] = SigmetIOServiceProvider.calcData(SigmetIOServiceProvider.recHdr, getDataType(), d);
        nb++;
      }
    }
    // System.out.println("this is az " + getAz());
    raf.seek(offset1);
    int cur_len = offset1;

    while (nb < (int) bins) {
      // --- Check if the code=1 ("1" means an end of a ray)
      a00 = raf.readShort();
      cur_len = cur_len + 2;

      if (a00 == (short) 1) {
        for (int uk = 0; uk < (int) bins; uk++) {
          dd[uk] = -999.99f;
        }
        break;
      }

      if (a00 < 0) {    // -- This is data
        int nwords = a00 & 0x7fff;
        int dataRead1 = nwords * 2;
        int pos = 0;
        if (cur_len % REC_SIZE == 0) {
          pos = 0;
          break;
        }
        raf.seek(cur_len);
        for (int i = 0; i < dataRead1; i++) {
          d = raf.readByte();
          dd[nb] = SigmetIOServiceProvider.calcData(SigmetIOServiceProvider.recHdr, getDataType(), d);
          nb = nb + 1;
          cur_len = cur_len + 1;
          if (nb % REC_SIZE == 0) {
            pos = i + 1;
            break;
          }
        }

        if (pos > 0) {
          break;
        }
      } else if (a00 > 0 & a00 != 1) {
        int num_zero = a00 * 2;
        int dataRead1 = num_zero;
        for (int k = 0; k < dataRead1; k++) {
          dd[nb + k] = SigmetIOServiceProvider.calcData(SigmetIOServiceProvider.recHdr, getDataType(), (byte) 0);
        }
        nb = nb + dataRead1;
        if (cur_len % REC_SIZE == 0) {
          break;
        }

      }
    }                     // ------ end of while for num_bins---------------------------------

    for (int gateIdx : gateRange) {
      if (gateIdx >= bins)
        ii.setFloatNext(Float.NaN);
      else
        ii.setFloatNext(dd[gateIdx]);
    }

  }
public void readData(RandomAccessFile raf, Range gateRange, IndexIterator ii) throws IOException {
    final int REC_SIZE = 6144;
    raf.seek(offset);
    byte[] data = new byte[bins];
    float[] dd = new float[bins];
    byte d;
    int nb = 0;
    short a00;
    // raf.readFully(data);
    if (dataRead > 0) {
      raf.seek(offset);

      for (int i = 0; i < dataRead; i++) {
        d = raf.readByte();
        dd[i] = SigmetIOServiceProvider.calcData(SigmetIOServiceProvider.recHdr, getDataType(), d);
        nb++;
      }
    }
    // System.out.println("this is az " + getAz());
    raf.seek(offset1);
    int cur_len = offset1;

    while (nb < (int) bins) {
      // --- Check if the code=1 ("1" means an end of a ray)
      a00 = raf.readShort();
      cur_len = cur_len + 2;

      if (a00 == (short) 1) {
        for (int uk = 0; uk < (int) bins; uk++) {
          dd[uk] = -999.99f;
        }
        break;
      }

      if (a00 < 0) {    // -- This is data
        int nwords = a00 & 0x7fff;
        int dataRead1 = nwords * 2;
        int pos = 0;
        if (cur_len % REC_SIZE == 0) {
          pos = 0;
          break;
        }
        raf.seek(cur_len);
        for (int i = 0; i < dataRead1; i++) {
          d = raf.readByte();
          dd[nb] = SigmetIOServiceProvider.calcData(SigmetIOServiceProvider.recHdr, getDataType(), d);
          nb = nb + 1;
          cur_len = cur_len + 1;
          if (nb % REC_SIZE == 0) {
            pos = i + 1;
            break;
          }
        }

        if (pos > 0) {
          break;
        }
      } else if (a00 > 0 & a00 != 1) {
        int num_zero = a00 * 2;
        int dataRead1 = num_zero;
        for (int k = 0; k < dataRead1; k++) {
          dd[nb + k] = SigmetIOServiceProvider.calcData(SigmetIOServiceProvider.recHdr, getDataType(), (byte) 0);
        }
        nb = nb + dataRead1;
        if (cur_len % REC_SIZE == 0) {
          break;
        }

      }
    }                     // ------ end of while for num_bins---------------------------------

    for (int gateIdx : gateRange) {
      if (gateIdx >= bins)
        ii.setFloatNext(Float.NaN);
      else
        ii.setFloatNext(dd[gateIdx]);
    }

  }
Read data from this record.

@param raf       read from this file
@param gateRange handles the possible subset of data to return
@param ii        put the data here
@throws java.io.IOException on read error