-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#377 Create Wanda Seawat black box wrapper, add time info to exchange…
… items
- Loading branch information
1 parent
f96feca
commit 2b62d85
Showing
6 changed files
with
66 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
model_wanda_seawat/java/src/org/openda/model_wanda_seawat/WandaSeawatUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.openda.model_wanda_seawat; | ||
|
||
import org.openda.exchange.TimeInfo; | ||
import org.openda.exchange.timeseries.TimeUtils; | ||
|
||
import java.io.File; | ||
import java.text.ParseException; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
import java.util.Locale; | ||
import java.util.TreeMap; | ||
|
||
public class WandaSeawatUtils { | ||
static TimeInfo getTimeInfo(String filePrefix, TreeMap<String, File> fileNamesToFiles) { | ||
try { | ||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat('\'' + filePrefix + "'yyyyMMddHHmmss", Locale.US); | ||
double[] timesArray = new double[fileNamesToFiles.size()]; | ||
String[] strings = fileNamesToFiles.keySet().toArray(new String[0]); | ||
for (int i = 0; i < strings.length; i++) { | ||
String fileName = strings[i]; | ||
Date dateFromFileName = simpleDateFormat.parse(fileName); | ||
timesArray[i] = TimeUtils.date2Mjd(dateFromFileName); | ||
} | ||
return new TimeInfo(timesArray); | ||
} catch (ParseException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters