visad/src/main/java/ucar/nc2/iosp/gempak/GempakGridReader.java
protected boolean init(boolean fullCheck) throws IOException {

    boolean ok = super.init(fullCheck);
    if (!ok) return false;

    // Modeled after GD_OFIL
    if (dmLabel.kftype != MFGD) {
      logError("not a grid file");
      return false;
    }
    // find the part for GRID
    DMPart part = getPart("GRID");

    if (part == null) {
      logError("No part named GRID found");
      return false;
    }
    int lenhdr = part.klnhdr;
    if (lenhdr > LLGDHD) {
      logError("Grid part header too long");
      return false;
    }
    // int khdrln = lenhdr - 2;

    // check that the column names are correct
    for (int i = 0; i < keys.kkcol.size(); i++) {
      Key colkey = keys.kkcol.get(i);
      if (!colkey.name.equals(kcolnm[i])) {
        logError("Column name " + colkey + " doesn't match " + kcolnm[i]);
        return false;
      }
    }

    if (!fullCheck) {
      return true;
    }

    gridIndex = new GridIndex(filename);
    // Make the NAV and ANAL blocks
    float[] headerArray = getFileHeader(NAVB);
    if (headerArray == null) {
      return false;
    }
    navBlock = new NavigationBlock(headerArray);
    //System.out.println("nav = " + navBlock);
    gridIndex.addHorizCoordSys(navBlock);

    headerArray = getFileHeader(ANLB);
    if (headerArray == null) {
      return false;
    }
    analBlock = new AnalysisBlock(headerArray);

    // Make the grid headers
    // TODO: move this up into GempakFileReader using DM_RHDA
    // and account for the flipping there.
    List<GempakGridRecord> tmpList = new ArrayList<>();
    int[] header = new int[dmLabel.kckeys];
    if ((headers == null) || (headers.colHeaders == null)) {
      return false;
    }
    int gridNum = 0;
    for (int[] fullHeader : headers.colHeaders) {
      gridNum++;  // grid numbers are 1 based
      if ((fullHeader == null) || (fullHeader[0] == IMISSD)) {
        continue;
      }
      // TODO: have GempakGridRecord skip the first word
      System.arraycopy(fullHeader, 1, header, 0, header.length);
      GempakGridRecord gh = new GempakGridRecord(gridNum, header);
      gh.navBlock = navBlock;
      String name = gh.getParameterName();
      //if (name.equals("TMPK") ||
      //    name.equals("UREL") ||
      //    name.equals("VREL") ||
      //    name.equals("PMSL")) {
      tmpList.add(gh);
      //}
    }

    // reset the file size since we've gone through all the grids.
    fileSize = rf.length();

    // find the packing types for these grids
    // TODO: go back to using gridList
    //List gridList = gridIndex.getGridRecords();
    //if ( !gridList.isEmpty()) {
    if (!tmpList.isEmpty()) {
      for (GempakGridRecord gh : tmpList) {
        gh.packingType = getGridPackingType(gh.gridNumber);
        if ((gh.packingType == MDGGRB) || (gh.packingType == MDGRB2)
                || (gh.packingType == MDGNON)) {
          gridIndex.addGridRecord(gh);
        }
      }
    } else {
      return false;
    }

    // check to see if there are any grids that we can handle
    if (gridIndex.getGridRecords().isEmpty()) {
      return false;
    }

    return true;

  }
protected boolean init(boolean fullCheck) throws IOException {

    boolean ok = super.init(fullCheck);
    if (!ok) return false;

    // Modeled after GD_OFIL
    if (dmLabel.kftype != MFGD) {
      logError("not a grid file");
      return false;
    }
    // find the part for GRID
    DMPart part = getPart("GRID");

    if (part == null) {
      logError("No part named GRID found");
      return false;
    }
    int lenhdr = part.klnhdr;
    if (lenhdr > LLGDHD) {
      logError("Grid part header too long");
      return false;
    }
    // int khdrln = lenhdr - 2;

    // check that the column names are correct
    for (int i = 0; i < keys.kkcol.size(); i++) {
      Key colkey = keys.kkcol.get(i);
      if (!colkey.name.equals(kcolnm[i])) {
        logError("Column name " + colkey + " doesn't match " + kcolnm[i]);
        return false;
      }
    }

    if (!fullCheck) {
      return true;
    }

    gridIndex = new GridIndex(filename);
    // Make the NAV and ANAL blocks
    float[] headerArray = getFileHeader(NAVB);
    if (headerArray == null) {
      return false;
    }
    navBlock = new NavigationBlock(headerArray);
    //System.out.println("nav = " + navBlock);
    gridIndex.addHorizCoordSys(navBlock);

    headerArray = getFileHeader(ANLB);
    if (headerArray == null) {
      return false;
    }
    analBlock = new AnalysisBlock(headerArray);

    // Make the grid headers
    // TODO: move this up into GempakFileReader using DM_RHDA
    // and account for the flipping there.
    List<GempakGridRecord> tmpList = new ArrayList<>();
    int[] header = new int[dmLabel.kckeys];
    if ((headers == null) || (headers.colHeaders == null)) {
      return false;
    }
    int gridNum = 0;
    for (int[] fullHeader : headers.colHeaders) {
      gridNum++;  // grid numbers are 1 based
      if ((fullHeader == null) || (fullHeader[0] == IMISSD)) {
        continue;
      }
      // TODO: have GempakGridRecord skip the first word
      System.arraycopy(fullHeader, 1, header, 0, header.length);
      GempakGridRecord gh = new GempakGridRecord(gridNum, header);
      gh.navBlock = navBlock;
      String name = gh.getParameterName();
      //if (name.equals("TMPK") ||
      //    name.equals("UREL") ||
      //    name.equals("VREL") ||
      //    name.equals("PMSL")) {
      tmpList.add(gh);
      //}
    }

    // reset the file size since we've gone through all the grids.
    fileSize = rf.length();

    // find the packing types for these grids
    // TODO: go back to using gridList
    //List gridList = gridIndex.getGridRecords();
    //if ( !gridList.isEmpty()) {
    if (!tmpList.isEmpty()) {
      for (GempakGridRecord gh : tmpList) {
        gh.packingType = getGridPackingType(gh.gridNumber);
        if ((gh.packingType == MDGGRB) || (gh.packingType == MDGRB2)
                || (gh.packingType == MDGNON)) {
          gridIndex.addGridRecord(gh);
        }
      }
    } else {
      return false;
    }

    // check to see if there are any grids that we can handle
    if (gridIndex.getGridRecords().isEmpty()) {
      return false;
    }

    return true;

  }
Initialize this reader.  Get the Grid specific info

@param fullCheck check to make sure there are grids we can handle
@return true if successful
@throws IOException problem reading the data