|
21 | 21 | public class WmoCodeFlagTables { |
22 | 22 |
|
23 | 23 | private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(WmoCodeFlagTables.class); |
24 | | - public static final Version standard = Version.GRIB2_22_0_0; |
| 24 | + public static final Version standard = Version.GRIB2_34_0_0; |
25 | 25 |
|
26 | 26 | public enum Version { |
27 | | - GRIB2_22_0_0; |
| 27 | + GRIB2_34_0_0; |
28 | 28 |
|
29 | 29 | public String getResourceName() { |
30 | | - return "/resources/grib2/wmo/" + this.name() + "_CodeFlag_exp_en.xml"; |
| 30 | + return "/resources/grib2/wmo/" + this.name() + "_CodeFlag_en.xml"; |
31 | 31 | } |
32 | 32 |
|
33 | 33 | @Nullable |
34 | 34 | String[] getElemNames() { |
35 | | - if (this == GRIB2_22_0_0) { |
36 | | - return new String[] {"GRIB2_22_0_0_CodeFlag_exp_en", "Title_en", "SubTitle_en", |
37 | | - "MeaningParameterDescription_en", "UnitComments_en"}; |
| 35 | + if (this == GRIB2_34_0_0) { |
| 36 | + return new String[] {"GRIB2_CodeFlag_en", "Title_en", "SubTitle_en", "MeaningParameterDescription_en", |
| 37 | + "UnitComments_en"}; |
38 | 38 | } |
39 | 39 |
|
40 | 40 | return null; |
@@ -107,49 +107,6 @@ public WmoParamTable getParamTable(int discipline, int category) { |
107 | 107 | return new WmoParamTable(wmoTable); |
108 | 108 | } |
109 | 109 |
|
110 | | - /* |
111 | | - * Param Table: |
112 | | - * <GRIB2_22_0_0_CodeFlag_exp_en> |
113 | | - * <No>524</No> |
114 | | - * <Title_en>Code table 4.2 - Parameter number by product discipline and parameter category</Title_en> |
115 | | - * <SubTitle_en>Product discipline 0 - Meteorological products, parameter category 1: moisture</SubTitle_en> |
116 | | - * <CodeFlag>101</CodeFlag> |
117 | | - * <MeaningParameterDescription_en>Specific number concentration of snow</MeaningParameterDescription_en> |
118 | | - * <UnitComments_en>kg-1</UnitComments_en> |
119 | | - * <ElementDescription_en>Number of particles per unit mass of air</ElementDescription_en> |
120 | | - * <Status>Operational</Status> |
121 | | - * </GRIB2_22_0_0_CodeFlag_exp_en> |
122 | | - * |
123 | | - * Code Table: |
124 | | - * <GRIB2_22_0_0_CodeFlag_exp_en> |
125 | | - * <No>2</No> |
126 | | - * <Title_en>Code table 0.0 - Discipline of processed data in the GRIB message, number of GRIB Master table</Title_en> |
127 | | - * <CodeFlag>1</CodeFlag> |
128 | | - * <MeaningParameterDescription_en>Hydrological products</MeaningParameterDescription_en> |
129 | | - * <Status>Operational</Status> |
130 | | - * </GRIB2_22_0_0_CodeFlag_exp_en> |
131 | | - * |
132 | | - * FlagTable: |
133 | | - * <GRIB2_22_0_0_CodeFlag_exp_en> |
134 | | - * <No>168</No> |
135 | | - * <Title_en>Flag table 3.4 - Scanning mode</Title_en> |
136 | | - * <CodeFlag>1</CodeFlag> |
137 | | - * <Value>0</Value> |
138 | | - * <MeaningParameterDescription_en>Points of first row or column scan in the +i (+x) |
139 | | - * direction</MeaningParameterDescription_en> |
140 | | - * <Status>Operational</Status> |
141 | | - * </GRIB2_22_0_0_CodeFlag_exp_en> |
142 | | - * <GRIB2_22_0_0_CodeFlag_exp_en> |
143 | | - * <No>169</No> |
144 | | - * <Title_en>Flag table 3.4 - Scanning mode</Title_en> |
145 | | - * <CodeFlag>1</CodeFlag> |
146 | | - * <Value>1</Value> |
147 | | - * <MeaningParameterDescription_en>Points of first row or column scan in the -i (-x) |
148 | | - * direction</MeaningParameterDescription_en> |
149 | | - * <Status>Operational</Status> |
150 | | - * </GRIB2_22_0_0_CodeFlag_exp_en> |
151 | | - */ |
152 | | - |
153 | 110 | private void readGribCodes(Version version) throws IOException { |
154 | 111 | String[] elems = version.getElemNames(); |
155 | 112 | if (elems == null) { |
@@ -430,124 +387,4 @@ public int getDiscipline() { |
430 | 387 | } |
431 | 388 | } |
432 | 389 | } |
433 | | - |
434 | | - /* |
435 | | - * |
436 | | - * |
437 | | - * @Nullable |
438 | | - * public static String getTableValue(String tableId, int value) { |
439 | | - * if (wmoTables == null) |
440 | | - * try { |
441 | | - * wmoTables = getWmoStandard(); |
442 | | - * } catch (IOException e) { |
443 | | - * throw new IllegalStateException("cant open WMO tables"); |
444 | | - * } |
445 | | - * |
446 | | - * WmoCodeTable table = wmoTables.map.get(tableId); |
447 | | - * if (table == null) return null; |
448 | | - * TableEntry entry = table.get(value); |
449 | | - * if (entry == null) return null; |
450 | | - * return entry.meaning; |
451 | | - * } |
452 | | - * |
453 | | - * @Nullable |
454 | | - * private static TableEntry getTableEntry(String tableId, int value) { |
455 | | - * if (wmoTables == null) |
456 | | - * try { |
457 | | - * wmoTables = getWmoStandard(); |
458 | | - * } catch (IOException e) { |
459 | | - * throw new IllegalStateException("cant open wmo tables"); |
460 | | - * } |
461 | | - * |
462 | | - * WmoCodeTable table = wmoTables.map.get(tableId); |
463 | | - * if (table == null) return null; |
464 | | - * return table.get(value); |
465 | | - * } |
466 | | - * |
467 | | - * void wtf(Formatter f) { |
468 | | - * |
469 | | - * int total = 0; |
470 | | - * int nsame = 0; |
471 | | - * int nsameIgn = 0; |
472 | | - * int ndiff = 0; |
473 | | - * int unknown = 0; |
474 | | - * |
475 | | - * f.format("DIFFERENCES between %s and %s%n", gt1.name, gt2.name); |
476 | | - * for (WmoCodeTable gc1 : gt1.list) { |
477 | | - * |
478 | | - * WmoCodeTable gc2 = gt2.map.get(gc1.tableName); |
479 | | - * if (gc2 == null) { |
480 | | - * f.format("1 table %s not found in %s%n", gc1.getTableId(), gt2.name); |
481 | | - * continue; |
482 | | - * } |
483 | | - * |
484 | | - * for (TableEntry p1 : gc1.entries) { |
485 | | - * TableEntry p2 = gc2.get(p1.start); |
486 | | - * if (p2 == null) { |
487 | | - * f.format("2 code %s not found in %s%n", p1.getId(), gt2.name); |
488 | | - * continue; |
489 | | - * } |
490 | | - * |
491 | | - * if (showDiff && !p1.equals(p2)) { |
492 | | - * f.format("3 %s not equal%n %s%n%n", p1, p2); |
493 | | - * } |
494 | | - * } |
495 | | - * } |
496 | | - * f.format("Total=%d same=%d sameIgn=%d dif=%d unknown=%d%n", total, nsame, nsameIgn, ndiff, unknown); |
497 | | - * } |
498 | | - * |
499 | | - * |
500 | | - * /* public static void showDiffFromCurrent(List<WmoCodeTable> tlist) throws IOException { |
501 | | - * int total = 0; |
502 | | - * int nsame = 0; |
503 | | - * int nsameIgn = 0; |
504 | | - * int ndiff = 0; |
505 | | - * int unknown = 0; |
506 | | - * |
507 | | - * f.format("DIFFERENCES with current parameter table (now,org) %n"); |
508 | | - * for (WmoCodeTable gt : tlist) { |
509 | | - * if (!gt.isParameter) continue; |
510 | | - * for (TableEntry p : gt.entries) { |
511 | | - * if (p.meaning.equalsIgnoreCase("Missing")) continue; |
512 | | - * if (p.start != p.stop) continue; |
513 | | - * |
514 | | - * GridParameter gp = ParameterTable.getParameter(gt.discipline, gt.category, p.start); |
515 | | - * String paramOrg = gp.getDescription(); |
516 | | - * if (paramOrg.startsWith("Unknown")) { |
517 | | - * unknown++; |
518 | | - * continue; |
519 | | - * } |
520 | | - * |
521 | | - * String paramOrgM = munge(paramOrg); |
522 | | - * String paramM = munge(p.name); |
523 | | - * boolean same = paramOrgM.equals(paramM); |
524 | | - * if (same) nsame++; |
525 | | - * boolean sameIgnore = paramOrgM.equalsIgnoreCase(paramM); |
526 | | - * if (sameIgnore) nsameIgn++; |
527 | | - * else ndiff++; |
528 | | - * total++; |
529 | | - * String state = same ? " " : (sameIgnore ? "* " : "**"); |
530 | | - * if (!same && !sameIgnore) |
531 | | - * f.format("%s%d %d %d%n %s%n %s%n", state, gt.discipline, gt.category, p.start, p.name, paramOrg); |
532 | | - * } |
533 | | - * } |
534 | | - * f.format("Total=%d same=%d sameIgn=%d dif=%d unknown=%d%n", total, nsame, nsameIgn, ndiff, unknown); |
535 | | - * } |
536 | | - * |
537 | | - * static String munge(String org) { |
538 | | - * String result = StringUtil2.remove(org, "_"); |
539 | | - * result = StringUtil2.remove(result, "-"); |
540 | | - * return result; |
541 | | - * } |
542 | | - * |
543 | | - * public static void showTable(List<WmoCodeTable> tlist, Formatter f) { |
544 | | - * for (WmoCodeTable gt : tlist) { |
545 | | - * f.format("%d.%d (%d,%d) %s %n", gt.m1, gt.m2, gt.discipline, gt.category, gt.tableName); |
546 | | - * for (TableEntry p : gt.entries) { |
547 | | - * f.format(" %s (%d-%d) = %s %n", p.code, p.start, p.stop, p.meaning); |
548 | | - * } |
549 | | - * } |
550 | | - * } |
551 | | - */ |
552 | | - |
553 | 390 | } |
0 commit comments