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

Fixed repo issue

parent de270a8c
No related branches found
No related tags found
No related merge requests found
...@@ -142,6 +142,11 @@ ...@@ -142,6 +142,11 @@
<id>bedatadriven</id> <id>bedatadriven</id>
<name>bedatadriven public repo</name> <name>bedatadriven public repo</name>
<url>https://nexus.bedatadriven.com/content/groups/public/</url> <url>https://nexus.bedatadriven.com/content/groups/public/</url>
</repository>
<repository>
<id>osgeo</id>
<name>OSGEO</name>
<url>https://download.osgeo.org/webdav/geotools/</url>
</repository> </repository>
<repository> <repository>
<id>jitpack.io</id> <id>jitpack.io</id>
......
...@@ -228,8 +228,16 @@ public class WeatherUtil { ...@@ -228,8 +228,16 @@ public class WeatherUtil {
return this.getAggregatedDailyValues(observations, timeZone, minimumObservationsPerDay, typeOfAggregation, 0); return this.getAggregatedDailyValues(observations, timeZone, minimumObservationsPerDay, typeOfAggregation, 0);
} }
public List<WeatherObservation> getAggregatedDailyValues(
List<WeatherObservation> observations, TimeZone timeZone, Integer minimumObservationsPerDay, Integer typeOfAggregation, Integer maxDuplicates)
throws WeatherObservationListException,
InvalidAggregationTypeException
{
return this.getAggregatedDailyValues(observations, timeZone, minimumObservationsPerDay, typeOfAggregation, maxDuplicates, false);
}
/** /**
* Aggregates daily values. Can be set to tolerate duplicates * Aggregates daily values. Can be set to tolerate duplicates and to ignore errors
* @param observations the value of observations * @param observations the value of observations
* @param timeZone the value of timeZone * @param timeZone the value of timeZone
* @param minimumObservationsPerDay the value of minimumObservationsPerDay * @param minimumObservationsPerDay the value of minimumObservationsPerDay
...@@ -238,7 +246,7 @@ public class WeatherUtil { ...@@ -238,7 +246,7 @@ public class WeatherUtil {
* @return the java.util.List<no.nibio.vips.entity.WeatherObservation> * @return the java.util.List<no.nibio.vips.entity.WeatherObservation>
*/ */
public List<WeatherObservation> getAggregatedDailyValues( public List<WeatherObservation> getAggregatedDailyValues(
List<WeatherObservation> observations, TimeZone timeZone, Integer minimumObservationsPerDay, Integer typeOfAggregation, Integer maxDuplicates) List<WeatherObservation> observations, TimeZone timeZone, Integer minimumObservationsPerDay, Integer typeOfAggregation, Integer maxDuplicates, Boolean skipDaysWithTooFewObservations)
throws WeatherObservationListException, throws WeatherObservationListException,
InvalidAggregationTypeException InvalidAggregationTypeException
{ {
...@@ -298,20 +306,23 @@ public class WeatherUtil { ...@@ -298,20 +306,23 @@ public class WeatherUtil {
{ {
//System.out.println("date=" + aDay); //System.out.println("date=" + aDay);
Map hourValuesForADay = dateBucket.get(aDay); Map hourValuesForADay = dateBucket.get(aDay);
// We accept less than minimum values for the last day (we don't throw an error)
if(hourValuesForADay.size() < minimumObservationsPerDay && aDay.compareTo(lastDate) < 0) if(hourValuesForADay.size() < minimumObservationsPerDay)
{ {
throw new WeatherObservationListException( // We accept less than minimum values for the last day (we don't throw an error)
if(skipDaysWithTooFewObservations || aDay.compareTo(lastDate) == 0)
{
continue;
}
else
{
throw new WeatherObservationListException(
"Too few observations to aggregate for parameter " + "Too few observations to aggregate for parameter " +
templateObservation.getElementMeasurementTypeId() + templateObservation.getElementMeasurementTypeId() +
" at date " + aDay +". Found " + hourValuesForADay.size() + " at date " + aDay +". Found " + hourValuesForADay.size() +
", expected minimum " + minimumObservationsPerDay ", expected minimum " + minimumObservationsPerDay
); );
} }
// If last day and too few values: Skip it
else if(hourValuesForADay.size() < minimumObservationsPerDay)
{
continue;
} }
switch(typeOfAggregation){ switch(typeOfAggregation){
case WeatherUtil.AGGREGATION_TYPE_AVERAGE: case WeatherUtil.AGGREGATION_TYPE_AVERAGE:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment