@ Nullable public static Map < Integer , String > getNcepGenProcess ( ) { if ( genProcessMap != null ) return genProcessMap ; String path = "resources/grib1/ncep/ncepTableA.xml" ; try ( InputStream is = GribResourceReader . getInputStream ( path ) ) { SAXBuilder builder = new SAXBuilder ( ) ; org . jdom2 . Document doc = builder . build ( is ) ; Element root = doc . getRootElement ( ) ; HashMap < Integer , String > result = new HashMap <> ( 200 ) ; List < Element > params = root . getChildren ( "parameter" ) ; for ( Element elem1 : params ) { int code = Integer . parseInt ( elem1 . getAttributeValue ( "code" ) ) ; String desc = elem1 . getChildText ( "description" ) ; result . put ( code , desc ) ; } return Collections . unmodifiableMap ( result ) ; // all at once - thread safe } catch ( IOException | JDOMException ioe ) { logger . error ( "Cant read NCEP Table 1 = " + path , ioe ) ; return null ; } }
public so can be called from Grib2