Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSLogic
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
VIPSLogic
Commits
0120be00
Commit
0120be00
authored
3 years ago
by
Miriam Landa
Browse files
Options
Downloads
Patches
Plain Diff
'ryddet'
parent
141e5d85
Branches
Branches containing commit
No related tags found
1 merge request
!29
Model leaf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/LeafBlotchModelPreprocessor.java
+26
-17
26 additions, 17 deletions
...uling/model/preprocessor/LeafBlotchModelPreprocessor.java
with
26 additions
and
17 deletions
src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/LeafBlotchModelPreprocess.java
→
src/main/java/no/nibio/vips/logic/scheduling/model/preprocessor/LeafBlotchModelPreprocess
or
.java
+
26
−
17
View file @
0120be00
...
...
@@ -42,13 +42,13 @@ import no.nibio.vips.util.weather.WeatherDataSourceUtil;
*
* @author mila
*/
public
class
LeafBlotchModelPreprocess
extends
ModelRunPreprocessor
{
public
class
LeafBlotchModelPreprocess
or
extends
ModelRunPreprocessor
{
public
final
static
String
LEAFBLOTCH_sowingDate
=
"LEAFBLOTCH_SOWING_DATE"
;
@Override
public
ModelConfiguration
getModelConfiguration
(
ForecastConfiguration
configuration
)
throws
PreprocessorException
{
PointOfInterestWeatherStation
weatherStation
=
(
PointOfInterestWeatherStation
)
configuration
.
getWeatherStationPointOfInterestId
();
//
Henter latitude:
//
Latitude for the calculation
Double
latitude
=
weatherStation
.
getLatitude
();
// What timezone is the calculation for
...
...
@@ -56,31 +56,27 @@ public class LeafBlotchModelPreprocess extends ModelRunPreprocessor{
Calendar
cal
=
Calendar
.
getInstance
(
timeZone
);
cal
.
setTime
(
SystemTime
.
getSystemTime
());
cal
.
add
(
Calendar
.
DATE
,
3
);
WeatherUtil
wUtil
=
new
WeatherUtil
();
Date
endDate
=
wUtil
.
normalizeToExactDate
(
cal
.
getTime
(),
timeZone
);
//antar at dette er i dag (dagen data hentes på).
Date
endDate
=
wUtil
.
normalizeToExactDate
(
cal
.
getTime
(),
timeZone
);
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
format
.
setTimeZone
(
timeZone
);
Date
startDate
=
null
;
try
{
startDate
=
format
.
parse
(
configuration
.
getForecastModelConfigurationValue
(
LEAFBLOTCH_sowingDate
));
System
.
out
.
println
(
startDate
);
}
catch
(
ParseException
ex
)
{
System
.
out
.
println
(
"Not working"
);
//For now....
//Logger.getLogger(LeafBlotchModelPreprocess.class.getName()).log(Level.SEVERE, null, ex);
}
ModelConfiguration
retVal
=
new
ModelConfiguration
();
WeatherDataSourceUtil
wdsUtil
=
new
WeatherDataSourceUtil
();
//Hourly weather observations:
List
<
WeatherObservation
>
observations
;
try
{
observations
=
wdsUtil
.
getWeatherObservations
(
weatherStation
,
WeatherObservation
.
LOG_INTERVAL_ID_1H
,
//Hver time?
WeatherObservation
.
LOG_INTERVAL_ID_1H
,
new
String
[]{
WeatherElements
.
TEMPERATURE_MEAN
,
WeatherElements
.
PRECIPITATION
,
...
...
@@ -90,24 +86,37 @@ public class LeafBlotchModelPreprocess extends ModelRunPreprocessor{
endDate
);
}
catch
(
WeatherDataSourceException
ex
)
{
throw
new
PreprocessorException
(
ex
.
getMessage
());
}
}
//Daily weather observations:
List
<
WeatherObservation
>
dailyObs
;
try
{
dailyObs
=
wdsUtil
.
getWeatherObservations
(
weatherStation
,
WeatherObservation
.
LOG_INTERVAL_ID_1D
,
new
String
[]{
WeatherElements
.
TEMPERATURE_MEAN
},
startDate
,
endDate
);
}
catch
(
WeatherDataSourceException
ex
)
{
throw
new
PreprocessorException
(
ex
.
getMessage
());
}
//Combining hourly and daily data
observations
.
addAll
(
dailyObs
);
retVal
.
setModelId
(
this
.
getModelId
());
retVal
.
setConfigParameter
(
"timeZone"
,
timeZone
.
getID
());
retVal
.
setConfigParameter
(
"observations"
,
observations
);
//Værdata
retVal
.
setConfigParameter
(
"latitude"
,
latitude
);
// latitude
retVal
.
setConfigParameter
(
"sowingDate"
,
format
.
format
(
startDate
));
//sådato
retVal
.
setConfigParameter
(
"observations"
,
observations
);
retVal
.
setConfigParameter
(
"latitude"
,
latitude
);
retVal
.
setConfigParameter
(
"sowingDate"
,
format
.
format
(
startDate
));
return
retVal
;
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public
String
getModelId
()
{
return
"LEAFBLOTCH"
;
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
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