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
a3e15201
Commit
a3e15201
authored
4 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Refactoring WARNING_STATUS to separate parameter
parent
ca884867
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
src/main/java/net/ipmdecisions/model/entity/LocationResult.java
+16
-0
16 additions, 0 deletions
...in/java/net/ipmdecisions/model/entity/LocationResult.java
src/main/java/no/nibio/vips/ipmdecisions/DataTransformer.java
+6
-7
6 additions, 7 deletions
...main/java/no/nibio/vips/ipmdecisions/DataTransformer.java
with
22 additions
and
7 deletions
src/main/java/net/ipmdecisions/model/entity/LocationResult.java
+
16
−
0
View file @
a3e15201
...
@@ -28,12 +28,14 @@ public class LocationResult {
...
@@ -28,12 +28,14 @@ public class LocationResult {
private
Double
latitude
;
private
Double
latitude
;
private
Double
altitude
;
private
Double
altitude
;
private
Double
[][]
data
;
private
Double
[][]
data
;
private
Integer
[]
warningStatus
;
public
LocationResult
(
Double
longitude
,
Double
latitude
,
Double
altitude
,
int
rows
,
int
columns
){
public
LocationResult
(
Double
longitude
,
Double
latitude
,
Double
altitude
,
int
rows
,
int
columns
){
this
.
longitude
=
longitude
;
this
.
longitude
=
longitude
;
this
.
latitude
=
latitude
;
this
.
latitude
=
latitude
;
this
.
altitude
=
altitude
;
this
.
altitude
=
altitude
;
this
.
data
=
new
Double
[
rows
][
columns
];
this
.
data
=
new
Double
[
rows
][
columns
];
this
.
warningStatus
=
new
Integer
[
rows
];
}
}
public
LocationResult
(){
public
LocationResult
(){
...
@@ -150,4 +152,18 @@ public class LocationResult {
...
@@ -150,4 +152,18 @@ public class LocationResult {
public
void
setAltitude
(
Double
altitude
)
{
public
void
setAltitude
(
Double
altitude
)
{
this
.
altitude
=
altitude
;
this
.
altitude
=
altitude
;
}
}
/**
* @return the warningStatus
*/
public
Integer
[]
getWarningStatus
()
{
return
warningStatus
;
}
/**
* @param warningStatus the warningStatus to set
*/
public
void
setWarningStatus
(
Integer
[]
warningStatus
)
{
this
.
warningStatus
=
warningStatus
;
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/no/nibio/vips/ipmdecisions/DataTransformer.java
+
6
−
7
View file @
a3e15201
...
@@ -83,7 +83,7 @@ public class DataTransformer {
...
@@ -83,7 +83,7 @@ public class DataTransformer {
// b) check all possible result parameters
// b) check all possible result parameters
Collections
.
sort
(
VIPSResults
);
Collections
.
sort
(
VIPSResults
);
Set
<
String
>
resultParameters
=
new
HashSet
<>();
Set
<
String
>
resultParameters
=
new
HashSet
<>();
resultParameters
.
add
(
"WARNING_STATUS"
);
//
resultParameters.add("WARNING_STATUS");
Long
minSecondsBetween
=
null
;
Long
minSecondsBetween
=
null
;
Long
lastTime
=
null
;
Long
lastTime
=
null
;
for
(
Result
r:
VIPSResults
)
for
(
Result
r:
VIPSResults
)
...
@@ -113,20 +113,18 @@ public class DataTransformer {
...
@@ -113,20 +113,18 @@ public class DataTransformer {
retVal
.
setTimeEnd
(
VIPSResults
.
get
(
VIPSResults
.
size
()-
1
).
getValidTimeStart
().
toInstant
());
retVal
.
setTimeEnd
(
VIPSResults
.
get
(
VIPSResults
.
size
()-
1
).
getValidTimeStart
().
toInstant
());
LocationResult
locationResult
=
new
LocationResult
();
LocationResult
locationResult
=
new
LocationResult
();
Long
rows
=
1
+
(
retVal
.
getTimeEnd
().
getEpochSecond
()
-
retVal
.
getTimeStart
().
getEpochSecond
())
/
retVal
.
getInterval
();
Long
rows
=
1
+
(
retVal
.
getTimeEnd
().
getEpochSecond
()
-
retVal
.
getTimeStart
().
getEpochSecond
())
/
retVal
.
getInterval
();
Double
[][]
data
=
new
Double
[
rows
.
intValue
()][
retVal
.
getResultParameters
().
length
];
// TODO Set correct dimensions
Double
[][]
data
=
new
Double
[
rows
.
intValue
()][
retVal
.
getResultParameters
().
length
];
Integer
[]
warningStatus
=
new
Integer
[
rows
.
intValue
()];
for
(
Result
r:
VIPSResults
)
for
(
Result
r:
VIPSResults
)
{
{
// Calculate which row, based on
// Calculate which row, based on
Long
row
=
(
r
.
getValidTimeStart
().
getTime
()/
1000
-
retVal
.
getTimeStart
().
getEpochSecond
())
/
retVal
.
getInterval
();
Long
row
=
(
r
.
getValidTimeStart
().
getTime
()/
1000
-
retVal
.
getTimeStart
().
getEpochSecond
())
/
retVal
.
getInterval
();
warningStatus
[
row
.
intValue
()]
=
r
.
getWarningStatus
();
// Using the ordering in the resultParameters
// Using the ordering in the resultParameters
for
(
int
i
=
0
;
i
<
retVal
.
getResultParameters
().
length
;
i
++)
for
(
int
i
=
0
;
i
<
retVal
.
getResultParameters
().
length
;
i
++)
{
{
data
[
row
.
intValue
()][
i
]
=
null
;
data
[
row
.
intValue
()][
i
]
=
null
;
if
(
VIPSResultParameters
[
i
].
equals
(
"WARNING_STATUS"
))
if
(
VIPSResultParameters
[
i
]
!=
null
)
{
data
[
row
.
intValue
()][
i
]
=
r
.
getWarningStatus
().
doubleValue
();
}
else
if
(
VIPSResultParameters
[
i
]
!=
null
)
{
{
if
(
r
.
getAllValues
().
get
(
VIPSResultParameters
[
i
])
!=
null
)
if
(
r
.
getAllValues
().
get
(
VIPSResultParameters
[
i
])
!=
null
)
{
{
...
@@ -135,6 +133,7 @@ public class DataTransformer {
...
@@ -135,6 +133,7 @@ public class DataTransformer {
}
}
}
}
}
}
locationResult
.
setWarningStatus
(
warningStatus
);
locationResult
.
setData
(
data
);
locationResult
.
setData
(
data
);
retVal
.
addLocationResult
(
locationResult
);
retVal
.
addLocationResult
(
locationResult
);
return
retVal
;
return
retVal
;
...
...
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