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

Adaptations to the first version of the parser service for the Norwegian Meteorological

service's Thredds server in VIPSLogic
parent db270934
No related branches found
No related tags found
No related merge requests found
......@@ -21,20 +21,20 @@ package no.nibio.vips.entity;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.vividsolutions.jts.geom.Coordinate;
import java.util.List;
import no.nibio.vips.gis.SimpleWGS84Coordinate;
/**
* @copyright 2017 <a href="http://www.nibio.no/">NIBIO</a>
* @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/
public class MultiPointWeatherObservationList {
private SimpleWGS84Coordinate coordinate;
public class PointWeatherObservationList {
private Coordinate coordinate;
private List<WeatherObservation> observations;
@JsonCreator
public MultiPointWeatherObservationList(
@JsonProperty("coordinate") SimpleWGS84Coordinate coordinate,
public PointWeatherObservationList(
@JsonProperty("coordinate") Coordinate coordinate,
@JsonProperty("observations") List<WeatherObservation> observations
)
{
......@@ -45,14 +45,14 @@ public class MultiPointWeatherObservationList {
/**
* @return the coordinate
*/
public SimpleWGS84Coordinate getCoordinate() {
public Coordinate getCoordinate() {
return coordinate;
}
/**
* @param coordinate the coordinate to set
*/
public void setCoordinate(SimpleWGS84Coordinate coordinate) {
public void setCoordinate(Coordinate coordinate) {
this.coordinate = coordinate;
}
......@@ -70,4 +70,18 @@ public class MultiPointWeatherObservationList {
this.observations = observations;
}
@Override
public String toString()
{
String retVal = this.getClass().getName() + ":" + this.getCoordinate() + "\n";
if(this.getObservations() != null)
{
//retVal += "Observations: \n" + this.getObservations().stream().sorted().map(obs->obs.toString()).collect(Collectors.joining("\n"));
}
else
{
retVal += "No observations";
}
return retVal;
}
}
......@@ -31,7 +31,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import no.nibio.vips.entity.ModelConfiguration;
import no.nibio.vips.entity.MultiPointWeatherObservationList;
import no.nibio.vips.entity.PointWeatherObservationList;
import no.nibio.vips.entity.WeatherObservation;
import no.nibio.vips.model.ConfigValidationException;
......@@ -118,7 +118,7 @@ public class WeatherDataFileReader {
JsonNode all = jp.readValueAsTree();
List<WeatherObservation> observations = new ArrayList<>();
ObjectMapper mapper = new ObjectMapper();
List<MultiPointWeatherObservationList> theList = mapper.convertValue(all, new TypeReference<List<MultiPointWeatherObservationList>>(){});
List<PointWeatherObservationList> theList = mapper.convertValue(all, new TypeReference<List<PointWeatherObservationList>>(){});
config.setConfigParameter("multiPointWeatherObservations", theList);
return config;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment