visad/src/main/java/ucar/nc2/iosp/gempak/GempakFileReader.java
public int getDataPointer(int irow, int icol, String partName) {
    int ipoint = -1;
    if ((irow < 1) || (irow > dmLabel.krow) || (icol < 1)
            || (icol > dmLabel.kcol)) {
      System.out.println("bad row or column number: " + irow + "/"
              + icol);
      return ipoint;
    }
    int iprt = getPartNumber(partName);
    if (iprt == 0) {
      System.out.println("couldn't find part");
      return ipoint;
    }
    // gotta subtract 1 because parts are 1 but List is 0 based
    DMPart part = parts.get(iprt - 1);
    // check for valid data type
    if ((part.ktyprt != MDREAL) && (part.ktyprt != MDGRID)
            && (part.ktyprt != MDRPCK)) {
      System.out.println("Not a valid type");
      return ipoint;
    }
    int ilenhd = part.klnhdr;
    ipoint = dmLabel.kpdata + (irow - 1) * dmLabel.kcol * dmLabel.kprt
            + (icol - 1) * dmLabel.kprt + (iprt - 1);
    return ipoint;
  }
public int getDataPointer(int irow, int icol, String partName) {
    int ipoint = -1;
    if ((irow < 1) || (irow > dmLabel.krow) || (icol < 1)
            || (icol > dmLabel.kcol)) {
      System.out.println("bad row or column number: " + irow + "/"
              + icol);
      return ipoint;
    }
    int iprt = getPartNumber(partName);
    if (iprt == 0) {
      System.out.println("couldn't find part");
      return ipoint;
    }
    // gotta subtract 1 because parts are 1 but List is 0 based
    DMPart part = parts.get(iprt - 1);
    // check for valid data type
    if ((part.ktyprt != MDREAL) && (part.ktyprt != MDGRID)
            && (part.ktyprt != MDRPCK)) {
      System.out.println("Not a valid type");
      return ipoint;
    }
    int ilenhd = part.klnhdr;
    ipoint = dmLabel.kpdata + (irow - 1) * dmLabel.kcol * dmLabel.kprt
            + (icol - 1) * dmLabel.kprt + (iprt - 1);
    return ipoint;
  }
public int getDataPointer ( int irow , int icol , String partName ) { int ipoint = - 1 ; if ( ( irow < 1 ) || ( irow > dmLabel . krow ) || ( icol < 1 ) || ( icol > dmLabel . kcol ) ) { System . out . println ( "bad row or column number: " + irow + "/" + icol ) ; return ipoint ; } int iprt = getPartNumber ( partName ) ; if ( iprt == 0 ) { System . out . println ( "couldn't find part" ) ; return ipoint ; } // gotta subtract 1 because parts are 1 but List is 0 based DMPart part = parts . get ( iprt - 1 ) ; // check for valid data type if ( ( part . ktyprt != MDREAL ) && ( part . ktyprt != MDGRID ) && ( part . ktyprt != MDRPCK ) ) { System . out . println ( "Not a valid type" ) ; return ipoint ; } int ilenhd = part . klnhdr ; ipoint = dmLabel . kpdata + ( irow - 1 ) * dmLabel . kcol * dmLabel . kprt + ( icol - 1 ) * dmLabel . kprt + ( iprt - 1 ) ; return ipoint ; }
Get the pointer to the data.  Taken from DM_RDTR

@param irow     row number
@param icol     column number
@param partName name of the part
@return word (1 based) of start of data.
Get the pointer to the data . Taken from DM_RDTR