grib/src/main/java/ucar/nc2/grib/grib1/tables/Grib1ParamTableReader.java
private Map<Integer, Grib1Parameter> readParameterTableEcmwf() throws IOException {
    HashMap<Integer, Grib1Parameter> result = new HashMap<>();

    try (InputStream is = GribResourceReader.getInputStream(path);
        BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
      String line = br.readLine();
      if (line == null) {
        throw new FileNotFoundException(path + " is empty");
      }
      if (!line.startsWith("...")) {
        this.desc = line; // maybe ??
      }

      while (line != null && !line.startsWith("...")) {
        line = br.readLine(); // skip
      }

      while (true) {
        line = br.readLine();
        if (line == null) {
          break; // done with the file
        }
        if ((line.length() == 0) || line.startsWith("#")) {
          continue;
        }
        if (line.startsWith("...")) { // ...  may have already been read
          line = br.readLine();
          if (line == null) {
            break;
          }
        }
        String num = line.trim();
        line = br.readLine();
        String name = (line != null) ? line.trim() : null;
        line = br.readLine();
        String desc = (line != null) ? line.trim() : null;
        line = br.readLine();
        String units1 = (line != null) ? line.trim() : null;

        // optional notes
        line = br.readLine();
        String notes = (line == null || line.startsWith("...")) ? null : line.trim();
        if (desc != null && desc.equalsIgnoreCase("undefined")) {
          continue; // skip
        }

        int p1;
        try {
          p1 = Integer.parseInt(num);
        } catch (Exception e) {
          logger.warn("Cant parse " + num + " in file " + path);
          continue;
        }
        Grib1Parameter parameter = new Grib1Parameter(this, p1, name, desc, units1);
        result.put(parameter.getNumber(), parameter);
        logger.debug(" %s (%s)%n", parameter, notes);
      }
      return Collections.unmodifiableMap(result);  // all at once - thread safe
    }

  }
private Map<Integer, Grib1Parameter> readParameterTableEcmwf() throws IOException {
    HashMap<Integer, Grib1Parameter> result = new HashMap<>();

    try (InputStream is = GribResourceReader.getInputStream(path);
        BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
      String line = br.readLine();
      if (line == null) {
        throw new FileNotFoundException(path + " is empty");
      }
      if (!line.startsWith("...")) {
        this.desc = line; // maybe ??
      }

      while (line != null && !line.startsWith("...")) {
        line = br.readLine(); // skip
      }

      while (true) {
        line = br.readLine();
        if (line == null) {
          break; // done with the file
        }
        if ((line.length() == 0) || line.startsWith("#")) {
          continue;
        }
        if (line.startsWith("...")) { // ...  may have already been read
          line = br.readLine();
          if (line == null) {
            break;
          }
        }
        String num = line.trim();
        line = br.readLine();
        String name = (line != null) ? line.trim() : null;
        line = br.readLine();
        String desc = (line != null) ? line.trim() : null;
        line = br.readLine();
        String units1 = (line != null) ? line.trim() : null;

        // optional notes
        line = br.readLine();
        String notes = (line == null || line.startsWith("...")) ? null : line.trim();
        if (desc != null && desc.equalsIgnoreCase("undefined")) {
          continue; // skip
        }

        int p1;
        try {
          p1 = Integer.parseInt(num);
        } catch (Exception e) {
          logger.warn("Cant parse " + num + " in file " + path);
          continue;
        }
        Grib1Parameter parameter = new Grib1Parameter(this, p1, name, desc, units1);
        result.put(parameter.getNumber(), parameter);
        logger.debug(" %s (%s)%n", parameter, notes);
      }
      return Collections.unmodifiableMap(result);  // all at once - thread safe
    }

  }
private Map < Integer , Grib1Parameter > readParameterTableEcmwf ( ) throws IOException { HashMap < Integer , Grib1Parameter > result = new HashMap <> ( ) ; try ( InputStream is = GribResourceReader . getInputStream ( path ) ; BufferedReader br = new BufferedReader ( new InputStreamReader ( is , StandardCharsets . UTF_8 ) ) ) { String line = br . readLine ( ) ; if ( line == null ) { throw new FileNotFoundException ( path + " is empty" ) ; } if ( ! line . startsWith ( "..." ) ) { this . desc = line ; // maybe ?? } while ( line != null && ! line . startsWith ( "..." ) ) { line = br . readLine ( ) ; // skip } while ( true ) { line = br . readLine ( ) ; if ( line == null ) { break ; // done with the file } if ( ( line . length ( ) == 0 ) || line . startsWith ( "#" ) ) { continue ; } if ( line . startsWith ( "..." ) ) { // ...  may have already been read line = br . readLine ( ) ; if ( line == null ) { break ; } } String num = line . trim ( ) ; line = br . readLine ( ) ; String name = ( line != null ) ? line . trim ( ) : null ; line = br . readLine ( ) ; String desc = ( line != null ) ? line . trim ( ) : null ; line = br . readLine ( ) ; String units1 = ( line != null ) ? line . trim ( ) : null ; // optional notes line = br . readLine ( ) ; String notes = ( line == null || line . startsWith ( "..." ) ) ? null : line . trim ( ) ; if ( desc != null && desc . equalsIgnoreCase ( "undefined" ) ) { continue ; // skip } int p1 ; try { p1 = Integer . parseInt ( num ) ; } catch ( Exception e ) { logger . warn ( "Cant parse " + num + " in file " + path ) ; continue ; } Grib1Parameter parameter = new Grib1Parameter ( this , p1 , name , desc , units1 ) ; result . put ( parameter . getNumber ( ) , parameter ) ; logger . debug ( " %s (%s)%n" , parameter , notes ) ; } return Collections . unmodifiableMap ( result ) ; // all at once - thread safe } }
/*
WMO standard table 2: Version Number 3.
Codes and data units for FM 92-X Ext.GRIB.
......................
001
P
Pressure
Pa
Pa
......................
002
MSL
Mean sea level pressure
Pa
Pa
......................
003
None
Pressure tendency
Pa s**-1
Pa s**-1
......................
004
PV
Potential vorticity
K m**2 kg**-1 s**-1
K m**2 kg**-1 s**-1
......................
005
None
ICAO Standard Atmosphere reference height
m
m
/ * WMO standard table 2 : Version Number 3 . Codes and data units for FM 92 - X Ext . GRIB . ...................... 001 P Pressure Pa Pa ...................... 002 MSL Mean sea level pressure Pa Pa ...................... 003 None Pressure tendency Pa s ** - 1 Pa s ** - 1 ...................... 004 PV Potential vorticity K m ** 2 kg ** - 1 s ** - 1 K m ** 2 kg ** - 1 s ** - 1 ...................... 005 None ICAO Standard Atmosphere reference height m m