public static boolean compare ( GridDefRecord local , GridDefRecord other ) { java . util . Set < String > keys = local . getKeys ( ) ; java . util . Set < String > okeys = other . getKeys ( ) ; if ( keys . size ( ) != okeys . size ( ) ) return false ; for ( String key : keys ) { if ( key . equals ( WIND_FLAG ) || key . equals ( RESOLUTION ) || key . equals ( VECTOR_COMPONENT_FLAG ) || key . equals ( GDS_KEY ) ) continue ; String val = local . getParam ( key ) ; String oval = other . getParam ( key ) ; // if ( val . matches ( "^[0-9]+\\.[0-9]*" ) ) { //double double d = local . getDouble ( key ) ; double od = other . getDouble ( key ) ; if ( ! Misc . nearlyEquals ( d , od ) ) return false ; } else if ( val . matches ( "^[0-9]+" ) ) { // int if ( ! val . equals ( oval ) ) return false ; } else { // String if ( ! val . equals ( oval ) ) return false ; } } return true ; }
Compare GridDefRecords the numerics will use nearlyEquals so values that differ in 3 or 4th decimal places will return equal . This is being coded because the NDFD model dx differ in the 3 decimal place otherwise equal .