Skip to content

Commit

Permalink
more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
t-ober committed Mar 10, 2022
1 parent 5b6e175 commit 8448e25
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/main/java/edu/ie3/tools/Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private void handleTimestep(ZonedDateTime currentModelrun, int timestep) {
logger.info(formattedTimestep + "Opening of archive files started");
long tic, toc;
tic = System.currentTimeMillis();
openArchiveFiles(currentModelrun, timestep);
decompressGribFiles(currentModelrun, timestep);
toc = System.currentTimeMillis();
logger.info(
formattedTimestep + "Opening of archive files finished (" + (toc - tic) / 1000 + "s)");
Expand All @@ -175,7 +175,12 @@ private void handleTimestep(ZonedDateTime currentModelrun, int timestep) {
logger.info(formattedTimestep + "Timestep finished");
}

private void openArchiveFiles(ZonedDateTime currentModelrun, int timestep) {
/** Decompresses all grib files that are intact for every parameter.
*
* @param currentModelrun the model run for which to decompress files
* @param timestep the time step that is currently handled
*/
private void decompressGribFiles(ZonedDateTime currentModelrun, int timestep) {
String folderpath =
Main.directory
+ File.separator
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/edu/ie3/tools/Extractor.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,28 @@ public Extractor(
formattedTimestep = Converter.getFormattedTimestep(file);
}

/** Checks headline of grib file whether it is valid. Since eccodes v2.21.0 the data extraction expects a headline w/o
* commas but with whitespaces see ECC-1197 - https://jira.ecmwf.int/browse/ECC-1197
*
* @param headlineString the headline string
* @return whether it is valid or not
*/
private boolean validHeadline(String headlineString) {
// since eccodes v2.21.0 the data extraction expects a headline w/o commas but with whitespaces
// see ECC-1197 - https://jira.ecmwf.int/browse/ECC-1197
String headline = "Latitude Longitude Value";
String oldHeadline = "Latitude, Longitude, Value";

return headlineString != null
&& (headlineString.trim().equals(headline) || headlineString.trim().equals(oldHeadline));
}

/** Parses the output of a parameter grib file. And returns a map from coordinate where the value was measured to actual value
* fixme: coordinate without id?
*
*
* @param reader the reader of the grib file input stream
* @return map from coordinate where the value was measured to actual value
* @throws IOException
*/
protected HashMap<CoordinateModel, Double> parse(BufferedReader reader) throws IOException {
HashMap<CoordinateModel, Double> coordinateToValue = new HashMap<>(720729);
try {
Expand Down

0 comments on commit 8448e25

Please sign in to comment.