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

Merge branch 'feature/vipsutv-737-map-module' of...

Merge branch 'feature/vipsutv-737-map-module' of gitlab.nibio.no:VIPS/VIPSLogic into feature/vipsutv-737-map-module
parents 308d712b b458b85f
Branches
No related tags found
1 merge request!191Add map module and Open-Meteo support
......@@ -137,7 +137,7 @@ public class BarleyNetBlotchModelService {
public Response runModel(
@PathParam("organizationId") Integer organizationId,
@QueryParam("timeZone") String timeZoneStr,
@QueryParam("weatherdataType") String weatherdataType,
@QueryParam("weatherDataSourceType") String weatherDataSourceType,
@QueryParam("latitude") String latitude,
@QueryParam("longitude") String longitude,
@QueryParam("weatherStationId") Integer weatherStationId,
......@@ -181,7 +181,7 @@ public class BarleyNetBlotchModelService {
List<WeatherObservation> observations;
if (weatherdataType != null && "weatherstation".equals(weatherdataType.trim())) {
if (weatherDataSourceType != null && "weatherstation".equals(weatherDataSourceType.trim())) {
PointOfInterestWeatherStation weatherStation =
em.find(PointOfInterestWeatherStation.class, weatherStationId);
LOGGER.info("Run model with weatherdata from weatherstation {}", weatherStation.getName());
......@@ -223,6 +223,7 @@ public class BarleyNetBlotchModelService {
new HashSet<>(Collections.singletonList(WeatherObservation.LOG_INTERVAL_ID_1H))
);
} catch (WeatherDataSourceException ex) {
LOGGER.error("Exception while getting observations for latitude={} longitude={}", latitude, longitude, ex);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ex.getMessage()).build();
}
if (observations == null || observations.isEmpty()) {
......
......@@ -53,6 +53,8 @@ import no.nibio.vips.util.ParseRESTParamUtil;
import no.nibio.vips.util.WeatherUtil;
import no.nibio.vips.util.XDate;
import no.nibio.vips.util.weather.WeatherDataSourceUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This is a collection of (one) service(s) for models run from forms (not as part of batch)
......@@ -62,7 +64,9 @@ import no.nibio.vips.util.weather.WeatherDataSourceUtil;
@Path("rest/modelform")
@Facet("restricted")
public class ModelFormService {
private static final Logger LOGGER = LoggerFactory.getLogger(ModelFormService.class);
@EJB
UserBean userBean;
@EJB
......@@ -196,14 +200,15 @@ public class ModelFormService {
Integer VIPSCoreUserId = organization.getDefaultVipsCoreUserId();
List<Result>results = forecastBean.runForecast(mConf, VIPSCoreUserId);
List<Result> results = forecastBean.runForecast(mConf, VIPSCoreUserId);
return Response.ok().entity(results).build();
}
catch(PreprocessorException |RunModelException ex)
{
LOGGER.error("Exception occurred when attempting to run the septoria humidity model", ex);
return Response.serverError().entity(ex.getMessage()).build();
}
}
}
private ForecastModelConfiguration getForecastModelConfiguration(String modelId, String key, String value)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment