ui/src/main/java/ucar/nc2/ui/grib/Grib2DataPanel.java
private void checkDuplicates(Formatter f) {

    // how unique are the pds ?
    Set<Long> pdsMap = new HashSet<>();
    int dups = 0;
    int count = 0;

    // do all records have the same runtime ?
    Map<CalendarDate, DateCount> dateMap = new HashMap<>();

    List<Grib2ParameterBean> params = param2BeanTable.getBeans();
    for (Grib2ParameterBean param : params) {
      for (Grib2RecordBean record : param.getRecordBeans()) {
        CalendarDate d = record.gr.getReferenceDate();
        DateCount dc = dateMap.get(d);
        if (dc == null) {
          dc = new DateCount(d);
          dateMap.put(d, dc);
        }
        dc.count++;

        Grib2SectionProductDefinition pdss = record.gr.getPDSsection();
        long crc = pdss.calcCRC();
        if (pdsMap.contains(crc))
          dups++;
        else
          pdsMap.add(crc);
        count++;
      }
    }

    f.format("PDS duplicates = %d / %d%n%n", dups, count);

    List<DateCount> dcList = new ArrayList<>(dateMap.values());
    Collections.sort(dcList);

    f.format("Run Dates%n");
    int total = 0;
    for (DateCount dc : dcList) {
      f.format(" %s == %d%n", dc.d, dc.count);
      total += dc.count;
    }
    f.format("total records = %d%n", total);
  }
private void checkDuplicates(Formatter f) {

    // how unique are the pds ?
    Set<Long> pdsMap = new HashSet<>();
    int dups = 0;
    int count = 0;

    // do all records have the same runtime ?
    Map<CalendarDate, DateCount> dateMap = new HashMap<>();

    List<Grib2ParameterBean> params = param2BeanTable.getBeans();
    for (Grib2ParameterBean param : params) {
      for (Grib2RecordBean record : param.getRecordBeans()) {
        CalendarDate d = record.gr.getReferenceDate();
        DateCount dc = dateMap.get(d);
        if (dc == null) {
          dc = new DateCount(d);
          dateMap.put(d, dc);
        }
        dc.count++;

        Grib2SectionProductDefinition pdss = record.gr.getPDSsection();
        long crc = pdss.calcCRC();
        if (pdsMap.contains(crc))
          dups++;
        else
          pdsMap.add(crc);
        count++;
      }
    }

    f.format("PDS duplicates = %d / %d%n%n", dups, count);

    List<DateCount> dcList = new ArrayList<>(dateMap.values());
    Collections.sort(dcList);

    f.format("Run Dates%n");
    int total = 0;
    for (DateCount dc : dcList) {
      f.format(" %s == %d%n", dc.d, dc.count);
      total += dc.count;
    }
    f.format("total records = %d%n", total);
  }
private void checkDuplicates ( Formatter f ) { // how unique are the pds ? Set < Long > pdsMap = new HashSet <> ( ) ; int dups = 0 ; int count = 0 ; // do all records have the same runtime ? Map < CalendarDate , DateCount > dateMap = new HashMap <> ( ) ; List < Grib2ParameterBean > params = param2BeanTable . getBeans ( ) ; for ( Grib2ParameterBean param : params ) { for ( Grib2RecordBean record : param . getRecordBeans ( ) ) { CalendarDate d = record . gr . getReferenceDate ( ) ; DateCount dc = dateMap . get ( d ) ; if ( dc == null ) { dc = new DateCount ( d ) ; dateMap . put ( d , dc ) ; } dc . count ++ ; Grib2SectionProductDefinition pdss = record . gr . getPDSsection ( ) ; long crc = pdss . calcCRC ( ) ; if ( pdsMap . contains ( crc ) ) dups ++ ; else pdsMap . add ( crc ) ; count ++ ; } } f . format ( "PDS duplicates = %d / %d%n%n" , dups , count ) ; List < DateCount > dcList = new ArrayList <> ( dateMap . values ( ) ) ; Collections . sort ( dcList ) ; f . format ( "Run Dates%n" ) ; int total = 0 ; for ( DateCount dc : dcList ) { f . format ( " %s == %d%n" , dc . d , dc . count ) ; total += dc . count ; } f . format ( "total records = %d%n" , total ) ; }
/* private void checkRuntimes(Formatter f) {
Map<Date, DateCount> runs = new HashMap<Date, DateCount>();
List<Grib2ParameterBean> params = param2BeanTable.getBeans();
for (Grib2ParameterBean pb : params) {
List<Grib2RecordBean> records = pb.getRecordBeans();
for (Grib2RecordBean record : records) {
Date d = record.getBaseTime();
DateCount dc = runs.get(d);
if (dc == null) {
dc = new DateCount(d);
runs.put(d, dc);
}
dc.count++;
}
}

List<DateCount> dcList= new ArrayList<DateCount>(runs.values());
Collections.sort(dcList);

f.format("Run Dates%n");
for (DateCount dc : dcList)
f.format(" %s == %d%n", df.toDateTimeStringISO( dc.d), dc.count);
}
/ * private void checkRuntimes ( Formatter f ) { Map<Date DateCount > runs = new HashMap<Date DateCount > () ; List<Grib2ParameterBean > params = param2BeanTable . getBeans () ; for ( Grib2ParameterBean pb : params ) { List<Grib2RecordBean > records = pb . getRecordBeans () ; for ( Grib2RecordBean record : records ) { Date d = record . getBaseTime () ; DateCount dc = runs . get ( d ) ; if ( dc == null ) { dc = new DateCount ( d ) ; runs . put ( d dc ) ; } dc . count ++ ; } }