Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSCommon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
VIPSCommon
Commits
8837b87d
Commit
8837b87d
authored
5 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Fixed repo issue
parent
de270a8c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pom.xml
+5
-0
5 additions, 0 deletions
pom.xml
src/main/java/no/nibio/vips/util/WeatherUtil.java
+21
-10
21 additions, 10 deletions
src/main/java/no/nibio/vips/util/WeatherUtil.java
with
26 additions
and
10 deletions
pom.xml
+
5
−
0
View file @
8837b87d
...
@@ -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>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/no/nibio/vips/util/WeatherUtil.java
+
21
−
10
View file @
8837b87d
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment