Commit 0709ba03 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Initial commit

parents
Pipeline #239 canceled with stages
target/
nbproject/
classes/
Model_MAIZEPHENO
File added
Tag-V3 : Separation logic based on algorithmId
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>no.nibio.vips.model</groupId>
<artifactId>Model_PHYNOLOGYM</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>no.nibio.vips.common</groupId>
<artifactId>VIPSCommon</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<name>Model_PHYNOLOGYM</name>
</project>
\ No newline at end of file
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package no.nibio.vips.model.phenology;
import no.nibio.vips.util.DateMap;
/**
*
* @author wildfly
*/
public class DataMatrix extends DateMap
{
public final static String TEMPERATURE_MEAN = "TM"; // Mean Temperature
public final static String TEMPERATURE_MAX = "TX"; // Max Temperature
public final static String TEMPERATURE_MIN = "TN"; // Min Temperature
public final static String TEMPERATURE_DAILY_TIME = "DTT"; // Daily Temperature Time
public final static String TEMP_NON_NEGATIVE = "NON_NEG";
public final static Double BASE_TEMP_VALUE = 10.0;
public final static String PARAM_PHENOLOGYM_VARIETY = "VARIETY";
public final static String PARAM_PHENOLOGYM_PHASE = "PHASE";
public final static String PARAM_HEAT_SUM = "HEATSUM";
public final static String PARAM_HEAT_REQUIREMENT = "HEATREQ";
public final static String PLANTATION_DATA = "plantationData";
public final static String PARAM_SOWINGDATE = "startDate";
public final static String PARAM_PLANTATION_DATA = "plantationData";
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package no.nibio.vips.model.phenology;
/**
*
* @author wildfly
*/
public class PhenologyModelStore {
private PhenologyModelStore(){ }
private static PhenologyModelStore instance = null;
private static void activateStore()
{
}
public Double dayDegreeModel(Double tm_daily, Double heatSum, Double baseTempValue)
{
Double tm_nonNegative = getNonNegative(tm_daily, baseTempValue); //tm_nonNegative + ((tm_calculate < 0)? 0 : tm_calculate);
heatSum = heatSum + tm_nonNegative;
return heatSum;
}
public Double hourlyMeanWithBaseMaxAndOptTemp(Double tm, Double tb, Double tOpt, Double tu)
{
Double f1, f2, f3, f4 = 0.0;
Double p1, p2, p3, p4 = 0.0;
Double htt = 0.0;
f1 = tm - tb;
f2 = tOpt - tb;
f3 = tu - tm;
f4 = tu - tOpt;
p1 = f1 / f2;
p2 = f3 / f4;
p3 = f4/ f2;
p4 = Math.pow(p2, p3);
htt = (tm < tb)? 0.0 : (tm<tb)? 0.0 : (p1 * f2 * p4 );
return htt;
}
/**
*
* @param tm_daily
* @return
*/
public Double getNonNegative(Double tm_daily, Double baseTempValue){
Double tm_calculate = 0.0;
Double tm_nonNegative = 0.0;
tm_calculate = tm_daily - baseTempValue;
tm_nonNegative = tm_nonNegative + ((tm_calculate < 0)? 0 : tm_calculate);
return tm_nonNegative;
}
public static PhenologyModelStore getInstance()
{
if(instance == null)
{
instance = new PhenologyModelStore();
}
return instance;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package no.nibio.vips.model.phenology;
import java.util.Date;
import java.util.List;
/**
*
* @author wildfly
*/
public class Plant {
private String speciesLatinName;
private String typeName;
private Double baseTemp;
private Double optTemp; /* Optimum temperature */
private Double upperTemp; /* Upper temperature */
private Integer logIntervalId;
private Integer algorithmId;
private Date startDate;
private String[] weatherParams;
private List<Plantation> plantations;
public String getSpeciesLatinName() {
return speciesLatinName;
}
public void setSpeciesLatinName(String speciesLatinName) {
this.speciesLatinName = speciesLatinName;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public Double getBaseTemp() {
return baseTemp;
}
public void setBaseTemp(Double baseTemp) {
this.baseTemp = baseTemp;
}
public Double getOptTemp() {
return optTemp;
}
public void setOptTemp(Double optTemp) {
this.optTemp = optTemp;
}
public Double getUpperTemp() {
return upperTemp;
}
public void setUpperTemp(Double upperTemp) {
this.upperTemp = upperTemp;
}
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;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public List<Plantation> getPlantations() {
return plantations;
}
public void setPlantations(List<Plantation> plantations) {
this.plantations = plantations;
}
public String[] getWeatherParams() {
return weatherParams;
}
public void setWeatherParams(String[] weatherParams) {
this.weatherParams = weatherParams;
}
@Override
public String toString() {
return "Plant{" + "speciesLatinName=" + speciesLatinName + ", typeName=" + typeName + ", baseTemp=" + baseTemp + ", optTemp=" + optTemp + ", upperTemp=" + upperTemp + ", logIntervalId=" + logIntervalId + ", algorithmId=" + algorithmId + ", startDate=" + startDate + ", weatherParams=" + weatherParams + ", plantations=" + plantations + '}';
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package no.nibio.vips.model.phenology;
import java.util.Date;
/**
*
* @author wildfly
*/
public class Plantation {
private String typeName;
private String phaseName;
private Double heatReq;
public Plantation() {
}
public Plantation(String typeName, String phaseName, Double heatReq) {
this.typeName = typeName;
this.phaseName = phaseName;
this.heatReq = heatReq;
}
public Plantation(String phaseName, Double heatReq) {
this.phaseName = phaseName;
this.heatReq = heatReq;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getPhaseName() {
return phaseName;
}
public void setPhaseName(String phaseName) {
this.phaseName = phaseName;
}
public Double getHeatReq() {
return heatReq;
}
public void setHeatReq(Double heatReq) {
this.heatReq = heatReq;
}
@Override
public String toString() {
return "Plantation{" + "typeName=" + typeName + ", phaseName=" + phaseName + ", heatReq=" + heatReq + '}';
}
}
{
"species":
[
{
"speciesLatinName" : "Zea mays",
"baseTemp" : "10",
"weatherLogIntervalId" : "2",
"weatherParameters" : ["TN","TX","TM"],
"dayDegreeAlgorithmId" : "1",
"typeNames" :
[
{
"typeName" : "TESTVARIETY 2",
"baseTemp" : "10",
"weatherLogIntervalId" : "2",
"weatherParameters" : ["TN","TX","TM"],
"dayDegreeAlgorithmId" :"1",
"phaseInfo" :
[
{
"phaseName": "VE",
"heatReq" : "66.67"
},
{
"phaseName": "V2",
"heatReq" : "111.11"
},
{
"phaseName": "V3",
"heatReq" : "194.44"
},
{
"phaseName": "V4-V6",
"heatReq" : "263.89"
},
{
"phaseName": "V7-V9",
"heatReq" : "338.89"
},
{
"phaseName": "V10",
"heatReq" : "411.11"
},
{
"phaseName": "VT",
"heatReq" : "630.55"
},
{
"phaseName": "R2",
"heatReq" : "922.22"
},
{
"phaseName": "R5",
"heatReq" : "1361.11"
},
{
"phaseName": "R6",
"heatReq" : "1500"
}
]
}
]
}
]
}
\ No newline at end of file
name=Fall Army Worm - Phenology Model
license= Copyright (c) 2020 NIBIO <http://www.nibio.no/>. \
\
This file is part of Altenaria Model. \
Altenaria Model is free software: you can redistribute it and/or modify \
it under the terms of the NIBIO Open Source License as published by \
NIBIO, either version 1 of the License, or (at your option) any \
later version. \
\
MamestraBrassicaeModel is distributed in the hope that it will be useful, \
but WITHOUT ANY WARRANTY; without even the implied warranty of \
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \
NIBIO Open Source License for more details. \
\
You should have received a copy of the NIBIO Open Source License \
along with Altenaria Model. If not, see <http://www.nibio.no/licenses/>.
statusInterpretation=TODO
usage=Description of required input parameters:\n\
timeZone - What timezone the calculation is for. Necessary to calculate daily values from the provided hourly values. \
See this list of time zones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones (Column "TZ")\n\
observations - list of weather data. The following parameters are required:\n\
* TM - Average temperature (Degrees Celcius)
sampleconfig=TODO
description=TODO
name=Fall Army Worm - Phenology Model
license= Copyright (c) 2020 NIBIO <http://www.nibio.no/>. \
\
This file is part of Altenaria Model. \
Altenaria Model is free software: you can redistribute it and/or modify \
it under the terms of the NIBIO Open Source License as published by \
NIBIO, either version 1 of the License, or (at your option) any \
later version. \
\
MamestraBrassicaeModel is distributed in the hope that it will be useful, \
but WITHOUT ANY WARRANTY; without even the implied warranty of \
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \
NIBIO Open Source License for more details. \
\
You should have received a copy of the NIBIO Open Source License \
along with Altenaria Model. If not, see <http://www.nibio.no/licenses/>.
statusInterpretation=TODO
usage=Description of required input parameters:\n\
timeZone - What timezone the calculation is for. Necessary to calculate daily values from the provided hourly values. \
See this list of time zones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones (Column "TZ")\n\
observations - list of weather data. The following parameters are required:\n\
* TM - Average temperature (Degrees Celcius)
sampleconfig=TODO
description=TODO
\ No newline at end of file
[
{
"maizeVarity" : "COMMON",
"phaseName": "V2",
"baseTemp" : "B101",
"heatReq" : "200"
},
{
"maizeVarity" : "COMMON",
"phaseName": "V6",
"baseTemp" : "B101",
"heatReq" : "475"
},
{
"maizeVarity" : "COMMON",
"phaseName": "V12",
"baseTemp" : "B101",
"heatReq" : "870"
},
{
"maizeVarity" : "COMMON",
"phaseName": "VT",
"baseTemp" : "B101",
"heatReq" : "1135"
},
{
"maizeVarity" : "COMMON",
"phaseName": "R1",
"baseTemp" : "B101",
"heatReq" : "1400"
},
{
"maizeVarity" : "COMMON",
"phaseName": "R6",
"baseTemp" : "B201",
"heatReq" : "2700"
}
]
{
"speciesLatinName" : "Zea mays",
"typeName" : "TESTVARIETY 2",
"baseTemp" : "10",
"phaseInfo":
[
{
"phaseName": "VE",
"heatReq" : "66.67"
},
{
"phaseName": "V2",
"heatReq" : "111.11"
},
{
"phaseName": "V3",
"heatReq" : "194.44"
},
{
"phaseName": "V4-V6",
"heatReq" : "263.89"
},
{
"phaseName": "V7-V9",
"heatReq" : "338.89"
},
{
"phaseName": "V10",
"heatReq" : "411.11"
},
{
"phaseName": "VT",
"heatReq" : "630.55"
},
{
"phaseName": "R2",
"heatReq" : "922.22"
},
{
"phaseName": "R5",
"heatReq" : "1361.11"
},
{
"phaseName": "R6",
"heatReq" : "1500"
}
]
}
\ No newline at end of file
{
"species":
[
{
"speciesLatinName" : "Zea mays",
"baseTemp" : "10",
"weatherLogIntervalId" : "2",
"weatherParameters" : ["TN","TX","TM"],
"dayDegreeAlgorithmId" : "1",
"typeNames" :
[
{
"typeName" : "TESTVARIETY 2",
"baseTemp" : "10",
"weatherLogIntervalId" : "2",
"weatherParameters" : ["TN","TX","TM"],
"dayDegreeAlgorithmId" :"1",
"phaseInfo" :
[