Skip to content
Snippets Groups Projects
Commit 70874687 authored by Bhabesh Bhabani Mukhopadhyay's avatar Bhabesh Bhabani Mukhopadhyay
Browse files

Addition of 'LogIntervalId' and 'DegreeAlgorithmId'

LogIntervalId will determine frequency of weather dataupdate and algorithmId will determine which day degree algorithm required for a particular phenology model
parent 6b9eff30
No related branches found
No related merge requests found
......@@ -76,12 +76,14 @@ public class PhenologyModelPreprocessor extends ModelRunPreprocessor{
private final static String NODE_SPECIES = "species";
private final static String NODE_SPECIES_LATIN_NAME = "speciesLatinName";
private final static String NODE_BASE_TEMP = "baseTemp";
private final static String NODE_LOG_INTERVAL_ID = "weatherLogIntervalId";
private final static String NODE_TYPE_NAMES = "typeNames";
private final static String NODE_TYPE_NAME = "typeName";
private final static String NODE_PHASE_INFO = "phaseInfo";
private final static String NODE_PHASE_NAME = "phaseName";
private final static String NODE_HEAT_REQ = "heatReq";
private final static String NODE_WEATHER_PARAMS = "weatherParameters";
private final static String NODE_DD_ALGORITHM_ID = "dayDegreeAlgorithmId";
@Override
public ModelConfiguration getModelConfiguration(ForecastConfiguration configuration) throws PreprocessorException {
......@@ -268,6 +270,14 @@ public class PhenologyModelPreprocessor extends ModelRunPreprocessor{
{
plant.setBaseTemp(nodeSpecies.get(NODE_BASE_TEMP).asDouble());
}
if(null != nodeSpecies.get(NODE_LOG_INTERVAL_ID).asText())
{
plant.setLogIntervalId(nodeSpecies.get(NODE_LOG_INTERVAL_ID).asInt());
}
if(null != nodeSpecies.get(NODE_DD_ALGORITHM_ID).asText())
{
plant.setAlgorithmId(nodeSpecies.get(NODE_DD_ALGORITHM_ID).asInt());
}
JsonNode nodeSpeciesWeatherParams = nodeSpecies.path(NODE_WEATHER_PARAMS);
if( null != nodeSpeciesWeatherParams && nodeSpeciesWeatherParams.isArray())
{
......@@ -289,6 +299,14 @@ public class PhenologyModelPreprocessor extends ModelRunPreprocessor{
if(nodeTypeName.get(NODE_TYPE_NAME).asText().trim().equalsIgnoreCase(strParamTypeName))
{
plant.setTypeName(strParamTypeName);
if(null != nodeTypeName.get(NODE_LOG_INTERVAL_ID).asText())
{
plant.setLogIntervalId(nodeTypeName.get(NODE_LOG_INTERVAL_ID).asInt());
}
if(null != nodeTypeName.get(NODE_DD_ALGORITHM_ID).asText())
{
plant.setAlgorithmId(nodeTypeName.get(NODE_DD_ALGORITHM_ID).asInt());
}
if(null != nodeTypeName.get(NODE_BASE_TEMP).asText())
{
plant.setBaseTemp(nodeTypeName.get(NODE_BASE_TEMP).asDouble());
......
......@@ -13,6 +13,8 @@ public class Plant {
private String speciesLatinName;
private String typeName;
private Double baseTemp;
private Integer logIntervalId;
private Integer algorithmId;
private Date startDate;
private String[] weatherParams;
......@@ -42,6 +44,22 @@ public class Plant {
this.baseTemp = baseTemp;
}
public Integer getLogIntervalId() {
return logIntervalId;
}
public void setLogIntervalId(Integer logIntervalId) {
this.logIntervalId = logIntervalId;
}
public Integer getAlgorithmId() {
return algorithmId;
}
public void setAlgorithmId(Integer algorithmId) {
this.algorithmId = algorithmId;
}
public Date getStartDate() {
return startDate;
}
......@@ -68,9 +86,11 @@ public class Plant {
@Override
public String toString() {
return "Plant{" + "speciesLatinName=" + speciesLatinName + ", typeName=" + typeName + ", baseTemp=" + baseTemp + ", startDate=" + startDate + ", weatherParams=" + weatherParams + ", plantations=" + plantations + '}';
return "Plant{" + "speciesLatinName=" + speciesLatinName + ", typeName=" + typeName + ", baseTemp=" + baseTemp + ", logIntervalId=" + logIntervalId + ", algorithmId=" + algorithmId + ", startDate=" + startDate + ", weatherParams=" + weatherParams + ", plantations=" + plantations + '}';
}
}
......@@ -4,13 +4,17 @@
{
"speciesLatinName" : "Zea mays",
"baseTemp" : "10",
"weatherParameters" : ["TN","TX","TM"],
"weatherLogIntervalId" : "2",
"weatherParameters" : ["TN","TX","TM"],
"dayDegreeAlgorithmId" : "1",
"typeNames" :
[
{
"typeName" : "TESTVARIETY 2",
"baseTemp" : "10",
"weatherLogIntervalId" : "2",
"weatherParameters" : ["TN","TX","TM"],
"dayDegreeAlgorithmId" :"1",
"phaseInfo" :
[
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment