visad/src/main/java/ucar/nc2/iosp/gempak/GempakSurfaceIOSP.java
private Array readStandardData(Variable v2, Section section)
          throws IOException {

    Array array = null;
    if (v2 instanceof Structure) {
      List<GempakParameter> params =
              gemreader.getParameters(GempakSurfaceFileReader.SFDT);
      Structure pdata = (Structure) v2;
      StructureMembers members = pdata.makeStructureMembers();
      List<StructureMembers.Member> mbers =
              members.getMembers();
      int i = 0;
      int numBytes = 0;
      int totalNumBytes = 0;
      for (StructureMembers.Member member : mbers) {
        member.setDataParam(4 * i++);
        numBytes = member.getDataType().getSize();
        totalNumBytes += numBytes;
      }
      // one member is a byte
      members.setStructureSize(totalNumBytes);
      float[] missing = new float[mbers.size()];
      int missnum = 0;
      for (Variable v : pdata.getVariables()) {
        Attribute att = v.findAttribute("missing_value");
        missing[missnum++] = (att == null)
                ? GempakConstants.RMISSD
                : att.getNumericValue().floatValue();
      }


      //int num = 0;
      Range stationRange = section.getRange(0);
      Range timeRange = section.getRange(1);
      int size = stationRange.length() * timeRange.length();
      // Create a ByteBuffer using a byte array
      byte[] bytes = new byte[totalNumBytes * size];
      ByteBuffer buf = ByteBuffer.wrap(bytes);
      array = new ArrayStructureBB(members, new int[]{size}, buf, 0);

      for (int stnIdx : stationRange) {
        for (int timeIdx : timeRange) {
          GempakFileReader.RData vals = gemreader.DM_RDTR(timeIdx + 1, stnIdx + 1, GempakSurfaceFileReader.SFDT);
          if (vals == null) {
            int k = 0;
            for (StructureMembers.Member member : mbers) {
              if (member.getDataType().equals(DataType.FLOAT)) {
                buf.putFloat(missing[k]);
              } else {
                buf.put((byte) 1);
              }
              k++;
            }
          } else {
            float[] reals = vals.data;
            int var = 0;
            for (GempakParameter param : params) {
              if (members.findMember(param.getName()) != null) {
                buf.putFloat(reals[var]);
              }
              var++;
            }
            // always add the missing flag
            buf.put((byte) 0);
          }
        }
      }
      //Trace.call2("GEMPAKSIOSP: readStandardData");
    }
    return array;
  }
private Array readStandardData(Variable v2, Section section)
          throws IOException {

    Array array = null;
    if (v2 instanceof Structure) {
      List<GempakParameter> params =
              gemreader.getParameters(GempakSurfaceFileReader.SFDT);
      Structure pdata = (Structure) v2;
      StructureMembers members = pdata.makeStructureMembers();
      List<StructureMembers.Member> mbers =
              members.getMembers();
      int i = 0;
      int numBytes = 0;
      int totalNumBytes = 0;
      for (StructureMembers.Member member : mbers) {
        member.setDataParam(4 * i++);
        numBytes = member.getDataType().getSize();
        totalNumBytes += numBytes;
      }
      // one member is a byte
      members.setStructureSize(totalNumBytes);
      float[] missing = new float[mbers.size()];
      int missnum = 0;
      for (Variable v : pdata.getVariables()) {
        Attribute att = v.findAttribute("missing_value");
        missing[missnum++] = (att == null)
                ? GempakConstants.RMISSD
                : att.getNumericValue().floatValue();
      }


      //int num = 0;
      Range stationRange = section.getRange(0);
      Range timeRange = section.getRange(1);
      int size = stationRange.length() * timeRange.length();
      // Create a ByteBuffer using a byte array
      byte[] bytes = new byte[totalNumBytes * size];
      ByteBuffer buf = ByteBuffer.wrap(bytes);
      array = new ArrayStructureBB(members, new int[]{size}, buf, 0);

      for (int stnIdx : stationRange) {
        for (int timeIdx : timeRange) {
          GempakFileReader.RData vals = gemreader.DM_RDTR(timeIdx + 1, stnIdx + 1, GempakSurfaceFileReader.SFDT);
          if (vals == null) {
            int k = 0;
            for (StructureMembers.Member member : mbers) {
              if (member.getDataType().equals(DataType.FLOAT)) {
                buf.putFloat(missing[k]);
              } else {
                buf.put((byte) 1);
              }
              k++;
            }
          } else {
            float[] reals = vals.data;
            int var = 0;
            for (GempakParameter param : params) {
              if (members.findMember(param.getName()) != null) {
                buf.putFloat(reals[var]);
              }
              var++;
            }
            // always add the missing flag
            buf.put((byte) 0);
          }
        }
      }
      //Trace.call2("GEMPAKSIOSP: readStandardData");
    }
    return array;
  }
Read in the data for the variable.  In this case, it should be
a Structure.  The section should be rank 2 (station, time).

@param v2      variable to read
@param section section of the variable
@return the array of data
@throws IOException problem reading the file