Skip to content
Snippets Groups Projects
Commit 9ceeca86 authored by Lene Wasskog's avatar Lene Wasskog
Browse files

Merge branch 'develop' into feature/time-series-in-vipsweb

parents cede7804 6acfcad8
Branches
No related tags found
No related merge requests found
......@@ -24,6 +24,9 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
import com.ibm.icu.util.Calendar;
import no.nibio.vips.entity.ModelConfiguration;
import no.nibio.vips.entity.WeatherObservation;
import no.nibio.vips.logic.entity.ForecastConfiguration;
......@@ -38,7 +41,7 @@ import no.nibio.vips.util.weather.WeatherDataSourceException;
import no.nibio.vips.util.weather.WeatherDataSourceUtil;
/**
* @copyright 2016 <a href="http://www.nibio.no/">NIBIO</a>
* @copyright 2016-2024 <a href="http://www.nibio.no/">NIBIO</a>
* @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/
public class DOWNCASTModelPreprocessor extends ModelRunPreprocessor{
......@@ -49,6 +52,14 @@ public class DOWNCASTModelPreprocessor extends ModelRunPreprocessor{
PointOfInterestWeatherStation weatherStation = (PointOfInterestWeatherStation) configuration.getWeatherStationPointOfInterestId();
WeatherDataSourceUtil wdsUtil = new WeatherDataSourceUtil();
WeatherUtil wUtil = new WeatherUtil();
// We use only short-time forecasts, as the model is very sensitive
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE,3);
if(cal.getTime().before(configuration.getDateEnd()))
{
configuration.setDateEnd(cal.getTime());
}
List<WeatherObservation> observations;
......
......@@ -308,6 +308,8 @@ fieldSowingDate = Field sowing date
fields = Fields
traps = Traps
filter = Filter
filterList = Filter list
......
......@@ -306,6 +306,8 @@ fieldSowingDate = Field sowing date
fields = Fields
traps = Traps
filter = Filter
filterList = Filter list
......
......@@ -306,6 +306,8 @@ fieldSowingDate = Field sowing date
fields = Fields
traps = Traps
filter = Filter
filterList = Filter list
......
......@@ -308,6 +308,8 @@ fieldSowingDate = S\u00e5dato for felt
fields = Felt
traps = Feller
filter = Filter
filterList = Filtr\u00e9r lista
......
......@@ -306,6 +306,8 @@ fieldSowingDate = Field sowing date
fields = Fields
traps = Traps
filter = Filter
filterList = Filter list
......
......@@ -304,6 +304,8 @@ fieldSowingDate = Field sowing date
fields = Fields
traps = Traps
filter = \u8fc7\u6ee4\u5668
filterList = Filter list
......
......@@ -230,38 +230,41 @@
var allPois = [];
/**
* Fetches locations, farms, fields and weather stations, renders the list
*/
function refreshLocationPointOfInterests(pointOfInterestId)
/**
* Fetches locations, farms, fields, traps and weather stations, renders the list
*/
function refreshLocationPointOfInterests(selectedPointOfInterestId)
{
var poiTypes = ["${i18nBundle.genericPlaces}","${i18nBundle.weatherStations}","${i18nBundle.farms}","${i18nBundle.fields}"];
$.getJSON("/rest/poi/user", function( json ) {
allPois = json;
var theList = document.getElementById("locationPointOfInterestId");
theList.options.length = 1;
// Locations first, weather stations next
for(var h=0;h<poiTypes.length;h++)
{
var option = new Option("-- " + poiTypes[h] + " --","-1");
theList.options[theList.options.length] = option;
for(var i=0;i< allPois.length;i++)
{
var poi = allPois[i];
if(poi.pointOfInterestTypeId == h)
{
var option = new Option(poi.name, poi.pointOfInterestId);
if(poi.pointOfInterestId == pointOfInterestId)
{
option.selected=true;
}
theList.options[theList.options.length] = option;
}
}
}
showCorrectMap();
const poiTypes = {
0: "${i18nBundle.genericPlaces}",
1: "${i18nBundle.weatherStations}",
2: "${i18nBundle.farms}",
3: "${i18nBundle.fields}",
5: "${i18nBundle.traps}"
};
$.getJSON("/rest/poi/user", function(json) {
const allPois = json;
const poiListElement = document.getElementById("locationPointOfInterestId");
poiListElement.options.length = 1;
// Iterate through each point of interest type
for (const [typeId, typeName] of Object.entries(poiTypes)) {
poiListElement.options[poiListElement.options.length] = new Option("-- " + typeName + " --", "-1");
// Iterate through all POIs and add them to the list if they match the type
for (let i = 0; i < allPois.length; i++) {
const poi = allPois[i];
if (poi.pointOfInterestTypeId == typeId) {
const poiOption = new Option(poi.name, poi.pointOfInterestId);
if (poi.pointOfInterestId === selectedPointOfInterestId) {
poiOption.selected = true;
}
);
poiListElement.options[poiListElement.options.length] = poiOption;
}
}
}
showCorrectMap();
});
}
......@@ -515,7 +518,7 @@
<input type="hidden" name="observationData" value=""/>
<input type="hidden" name="observationId" value="${observation.observationId!"-1"}"/>
<!--button type="button" onclick="var theForm=document.getElementById('observationForm');theForm['geoInfo'].value=getFeatures();try{mw.save();theForm['observationData'].value=JSON.stringify(mw.toInspect);return validateForm(theForm) && validateGIS(theForm);}catch(e){console.log(e.message);console.log(e);return false;}">Test</button-->
<#if observation.user?has_content>
<#if observation.user?has_content>
<div class="form-group">
<label>${i18nBundle.observer}: ${observation.user.firstName} ${observation.user.lastName}</label>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment