File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 2323}
2424
2525group = ' com.github.ie3-institute'
26- version = ' 0.4.5 '
26+ version = ' 0.4.6 '
2727description = ' DWDWeatherTools'
2828defaultTasks ' build'
2929sourceCompatibility = javaVersion
Original file line number Diff line number Diff line change @@ -42,11 +42,21 @@ public Extractor(
4242 formattedTimestep = Converter .getFormattedTimestep (file );
4343 }
4444
45+ private boolean validHeadline (String headlineString ) {
46+ // since eccodes v2.21.0 the data extraction expects a headline w/o commas but with whitespaces
47+ // see ECC-1197 - https://jira.ecmwf.int/browse/ECC-1197
48+ String headline = "Latitude Longitude Value" ;
49+ String oldHeadline = "Latitude, Longitude, Value" ;
50+
51+ return headlineString != null
52+ && (headlineString .trim ().equals (headline ) || headlineString .trim ().equals (oldHeadline ));
53+ }
54+
4555 protected HashMap <CoordinateModel , Double > parse (BufferedReader reader ) throws IOException {
4656 HashMap <CoordinateModel , Double > coordinateToValue = new HashMap <>(720729 );
4757 try {
4858 String line = reader .readLine ();
49- if (line == null || ! line . trim (). equals ( "Latitude, Longitude, Value" )) {
59+ if (! validHeadline ( line )) {
5060 throw new IOException ("Unexpected start of file: " + line );
5161 }
5262 while ((line = reader .readLine ()) != null ) {
Original file line number Diff line number Diff line change 2727
2828public class ExtractorTest {
2929
30- private static String resourcesPath =
30+ private static final String resourcesPath =
3131 System .getProperty ("user.dir" )
3232 + File .separator
3333 + "src"
@@ -36,7 +36,7 @@ public class ExtractorTest {
3636 + File .separator
3737 + "resources"
3838 + File .separator ;
39- private static String extractorPath = resourcesPath + "extractorFiles" ;
39+ private static final String extractorPath = resourcesPath + "extractorFiles" ;
4040
4141 private final FileModel dummyFileModel = new FileModel (ZonedDateTime .now (), 1 , Parameter .ASOB_S );
4242
You can’t perform that action at this time.
0 commit comments