Skip to content
Snippets Groups Projects
Commit ea5dd057 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Fixing deserialization of Weather data

parent 69ea8982
No related branches found
No related tags found
1 merge request!1Master
...@@ -240,11 +240,10 @@ public class NegativePrognosisModel extends I18nImpl implements Model{ ...@@ -240,11 +240,10 @@ public class NegativePrognosisModel extends I18nImpl implements Model{
@Override @Override
public void setConfiguration(ModelConfiguration config) throws ConfigValidationException { public void setConfiguration(ModelConfiguration config) throws ConfigValidationException {
ObjectMapper mapper = new ObjectMapper();
// Setting timezone // Setting timezone
this.timeZone = TimeZone.getTimeZone((String) config.getConfigParameter("timeZone")); this.timeZone = TimeZone.getTimeZone((String) config.getConfigParameter("timeZone"));
// Getting weather data // Getting weather data
List<WeatherObservation> observations = mapper.convertValue(config.getConfigParameter("observations"), new TypeReference<List<WeatherObservation>>(){}); List<WeatherObservation> observations = this.modelUtil.extractWeatherObservationList(config.getConfigParameter("observations"));
for(WeatherObservation o:observations) for(WeatherObservation o:observations)
{ {
this.dataMatrix.setParamDoubleValueForDate(o.getTimeMeasured(), o.getElementMeasurementTypeId(), o.getValue()); this.dataMatrix.setParamDoubleValueForDate(o.getTimeMeasured(), o.getElementMeasurementTypeId(), o.getValue());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment