private Map<Integer, Grib2Parameter> initLocalTable(String resourcePath, Formatter f) {
Map<Integer, Grib2Parameter> result = new HashMap<>(100);
try (InputStream is = GribResourceReader.getInputStream(resourcePath)) {
if (is == null) throw new IllegalStateException("Cant find " + resourcePath);
if (f != null) f.format("%s, %-20s, %-20s, %-20s%n", "id", "name", "units", "gname");
TableParser parser = new TableParser("3i,7i,11i,15i,49,69,74,");
parser.setComment("!");
List<TableParser.Record> recs = parser.readAllRecords(is, 50000);
for (TableParser.Record record : recs) {
int disc = (Integer) record.get(0);
int cat = (Integer) record.get(1);
int id = (Integer) record.get(2);
int template = (Integer) record.get(3);
String name = ((String) record.get(4)).trim();
String units = ((String) record.get(5)).trim();
String gname = ((String) record.get(6)).trim();
String ids = disc+"-"+cat+"-"+id;
if (f != null) f.format("%s == %-20s, %-20s, %-20s%n", ids, name, units, gname);
Grib2Parameter gp = new Grib2Parameter(disc, cat, id, gname, units, null, name);
result.put(Grib2Customizer.makeParamId(disc, cat, id), gp);
}
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}
return result;
}