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
Branches
Tags
No related merge requests found
...@@ -21,20 +21,20 @@ package no.nibio.vips.entity; ...@@ -21,20 +21,20 @@ package no.nibio.vips.entity;
import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.vividsolutions.jts.geom.Coordinate;
import java.util.List; import java.util.List;
import no.nibio.vips.gis.SimpleWGS84Coordinate;
/** /**
* @copyright 2017 <a href="http://www.nibio.no/">NIBIO</a> * @copyright 2017 <a href="http://www.nibio.no/">NIBIO</a>
* @author Tor-Einar Skog <tor-einar.skog@nibio.no> * @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/ */
public class MultiPointWeatherObservationList { public class PointWeatherObservationList {
private SimpleWGS84Coordinate coordinate; private Coordinate coordinate;
private List<WeatherObservation> observations; private List<WeatherObservation> observations;
@JsonCreator @JsonCreator
public MultiPointWeatherObservationList( public PointWeatherObservationList(
@JsonProperty("coordinate") SimpleWGS84Coordinate coordinate, @JsonProperty("coordinate") Coordinate coordinate,
@JsonProperty("observations") List<WeatherObservation> observations @JsonProperty("observations") List<WeatherObservation> observations
) )
{ {
...@@ -45,14 +45,14 @@ public class MultiPointWeatherObservationList { ...@@ -45,14 +45,14 @@ public class MultiPointWeatherObservationList {
/** /**
* @return the coordinate * @return the coordinate
*/ */
public SimpleWGS84Coordinate getCoordinate() { public Coordinate getCoordinate() {
return coordinate; return coordinate;
} }
/** /**
* @param coordinate the coordinate to set * @param coordinate the coordinate to set
*/ */
public void setCoordinate(SimpleWGS84Coordinate coordinate) { public void setCoordinate(Coordinate coordinate) {
this.coordinate = coordinate; this.coordinate = coordinate;
} }
...@@ -70,4 +70,18 @@ public class MultiPointWeatherObservationList { ...@@ -70,4 +70,18 @@ public class MultiPointWeatherObservationList {
this.observations = observations; 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; ...@@ -31,7 +31,7 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import no.nibio.vips.entity.ModelConfiguration; 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.entity.WeatherObservation;
import no.nibio.vips.model.ConfigValidationException; import no.nibio.vips.model.ConfigValidationException;
...@@ -118,7 +118,7 @@ public class WeatherDataFileReader { ...@@ -118,7 +118,7 @@ public class WeatherDataFileReader {
JsonNode all = jp.readValueAsTree(); JsonNode all = jp.readValueAsTree();
List<WeatherObservation> observations = new ArrayList<>(); List<WeatherObservation> observations = new ArrayList<>();
ObjectMapper mapper = new ObjectMapper(); 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); config.setConfigParameter("multiPointWeatherObservations", theList);
return config; return config;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment