grib/src/main/java/ucar/nc2/grib/grib2/tools/EcmwfCodeTableCompare.java
public static void compareTables(Grib2CodeTableInterface t1, Grib2CodeTableInterface t2, Formatter f) {
    int extra = 0;
    int conflict = 0;
    f.format("%s%n", t2.getName());
    for (Grib2CodeTableInterface.Entry p1 : t1.getEntries()) {
      if (t1.getEntry(p1.getCode()) == null) {
        f.format(" ERROR %s missing own code %d%n", t1.getShortName(), p1.getCode());
      }
      Grib2CodeTableInterface.Entry p2 = t2.getEntry(p1.getCode());
      if (p2 == null) {
        extra++;
        if (verbose) {
          f.format("  %s missing %s%n", t2.getShortName(), p1);
        }
      } else {
        if (!Util.equivilantName(p1.getName(), p2.getName())) {
          f.format("  p1=%10s %s%n", p1.getCode(), p1.getName());
          f.format("  p2=%10s %s%n", p2.getCode(), p2.getName());
          conflict++;
        }
      }
    }

    int missing = 0;
    for (Grib2CodeTableInterface.Entry p2 : t2.getEntries()) {
      if (t2.getEntry(p2.getCode()) == null) {
        f.format(" ERROR %s missing own code %d%n", t2.getShortName(), p2.getCode());
      }
      Grib2CodeTableInterface.Entry p1 = t1.getEntry(p2.getCode());
      if (p1 == null) {
        missing++;
        f.format("  %s missing %s%n", t1.getShortName(), p2);
        t1.getEntry(p2.getCode());
      }
    }
    if (conflict > 0 || missing > 0) {
      f.format(" ***Conflicts=%d extra=%d missing=%s%n", conflict, extra, missing);
    }
  }
public static void compareTables(Grib2CodeTableInterface t1, Grib2CodeTableInterface t2, Formatter f) {
    int extra = 0;
    int conflict = 0;
    f.format("%s%n", t2.getName());
    for (Grib2CodeTableInterface.Entry p1 : t1.getEntries()) {
      if (t1.getEntry(p1.getCode()) == null) {
        f.format(" ERROR %s missing own code %d%n", t1.getShortName(), p1.getCode());
      }
      Grib2CodeTableInterface.Entry p2 = t2.getEntry(p1.getCode());
      if (p2 == null) {
        extra++;
        if (verbose) {
          f.format("  %s missing %s%n", t2.getShortName(), p1);
        }
      } else {
        if (!Util.equivilantName(p1.getName(), p2.getName())) {
          f.format("  p1=%10s %s%n", p1.getCode(), p1.getName());
          f.format("  p2=%10s %s%n", p2.getCode(), p2.getName());
          conflict++;
        }
      }
    }

    int missing = 0;
    for (Grib2CodeTableInterface.Entry p2 : t2.getEntries()) {
      if (t2.getEntry(p2.getCode()) == null) {
        f.format(" ERROR %s missing own code %d%n", t2.getShortName(), p2.getCode());
      }
      Grib2CodeTableInterface.Entry p1 = t1.getEntry(p2.getCode());
      if (p1 == null) {
        missing++;
        f.format("  %s missing %s%n", t1.getShortName(), p2);
        t1.getEntry(p2.getCode());
      }
    }
    if (conflict > 0 || missing > 0) {
      f.format(" ***Conflicts=%d extra=%d missing=%s%n", conflict, extra, missing);
    }
  }
public static void compareTables ( Grib2CodeTableInterface t1 , Grib2CodeTableInterface t2 , Formatter f ) { int extra = 0 ; int conflict = 0 ; f . format ( "%s%n" , t2 . getName ( ) ) ; for ( Grib2CodeTableInterface . Entry p1 : t1 . getEntries ( ) ) { if ( t1 . getEntry ( p1 . getCode ( ) ) == null ) { f . format ( " ERROR %s missing own code %d%n" , t1 . getShortName ( ) , p1 . getCode ( ) ) ; } Grib2CodeTableInterface . Entry p2 = t2 . getEntry ( p1 . getCode ( ) ) ; if ( p2 == null ) { extra ++ ; if ( verbose ) { f . format ( "  %s missing %s%n" , t2 . getShortName ( ) , p1 ) ; } } else { if ( ! Util . equivilantName ( p1 . getName ( ) , p2 . getName ( ) ) ) { f . format ( "  p1=%10s %s%n" , p1 . getCode ( ) , p1 . getName ( ) ) ; f . format ( "  p2=%10s %s%n" , p2 . getCode ( ) , p2 . getName ( ) ) ; conflict ++ ; } } } int missing = 0 ; for ( Grib2CodeTableInterface . Entry p2 : t2 . getEntries ( ) ) { if ( t2 . getEntry ( p2 . getCode ( ) ) == null ) { f . format ( " ERROR %s missing own code %d%n" , t2 . getShortName ( ) , p2 . getCode ( ) ) ; } Grib2CodeTableInterface . Entry p1 = t1 . getEntry ( p2 . getCode ( ) ) ; if ( p1 == null ) { missing ++ ; f . format ( "  %s missing %s%n" , t1 . getShortName ( ) , p2 ) ; t1 . getEntry ( p2 . getCode ( ) ) ; } } if ( conflict > 0 || missing > 0 ) { f . format ( " ***Conflicts=%d extra=%d missing=%s%n" , conflict , extra , missing ) ; } }
Compare 2 tables, print report.
Compare 2 tables print report .