Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
Model_NAERSTADMO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Models
Java
Model_NAERSTADMO
Commits
564ebfb3
Commit
564ebfb3
authored
11 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Added decision for warning status
parent
a914acf2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/no/bioforsk/vips/model/naerstadmodel/NaerstadModel.java
+31
-0
31 additions, 0 deletions
...a/no/bioforsk/vips/model/naerstadmodel/NaerstadModel.java
with
31 additions
and
0 deletions
src/main/java/no/bioforsk/vips/model/naerstadmodel/NaerstadModel.java
+
31
−
0
View file @
564ebfb3
...
...
@@ -48,6 +48,10 @@ public class NaerstadModel extends I18nImpl implements Model{
private
final
static
ModelId
MODEL_ID
=
new
ModelId
(
"NAERSTADMO"
);
private
final
static
Double
THRESHOLD_MINOR_RISK
=
1
d
;
private
final
static
Double
THRESHOLD_HIGH_RISK
=
2.5
;
public
NaerstadModel
(){
// Setting the file name of the resource bundle
super
(
"no.bioforsk.vips.model.naerstadmodel.texts"
);
...
...
@@ -90,6 +94,7 @@ public class NaerstadModel extends I18nImpl implements Model{
if
(
this
.
DEBUG
)
System
.
out
.
println
(
"RISK("
+
thePresent
+
")="
+
RISK
);
result
.
setValue
(
"RISK"
,
dFormat
.
format
(
RISK
));
result
.
setWarningStatus
(
this
.
getWarningStatus
(
RISK
));
results
.
add
(
result
);
// Moving on
...
...
@@ -108,6 +113,30 @@ public class NaerstadModel extends I18nImpl implements Model{
throw
new
ModelExcecutionException
(
"An exception occurred. Message is "
+
e
.
getMessage
()
+
" See logs for details"
);
}
}
/**
* Calculates the warning status
* @param RISK
* @return
*/
private
Integer
getWarningStatus
(
Double
RISK
)
{
if
(
RISK
==
null
)
{
return
Result
.
WARNING_STATUS_NO_WARNING_MISSING_DATA
;
}
else
if
(
RISK
<
THRESHOLD_MINOR_RISK
)
{
return
Result
.
WARNING_STATUS_NO_RISK
;
}
else
if
(
RISK
>=
THRESHOLD_MINOR_RISK
&&
RISK
<
THRESHOLD_HIGH_RISK
)
{
return
Result
.
WARNING_STATUS_MINOR_RISK
;
}
else
{
return
Result
.
WARNING_STATUS_HIGH_RISK
;
}
}
@Override
public
ModelId
getModelId
()
{
...
...
@@ -529,5 +558,7 @@ public class NaerstadModel extends I18nImpl implements Model{
return
this
.
weatherUtil
;
}
}
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