Skip to content
Snippets Groups Projects
Commit 899842d5 authored by Tucker Gary Siegel's avatar Tucker Gary Siegel
Browse files

hopefully this works

parent 537e66a3
No related branches found
No related tags found
No related merge requests found
......@@ -43,11 +43,20 @@ func GetNormalValues(request models.GddRequest) models.GddResponse {
var returnGdds models.GddResponse
var gdds []float64
rows := [][]float64{}
for i := 0; i < len(gs[0].MinTemps); i++ { //; i++ {
// get the int of the planting date. If the date is less than the first date, we do nothing
// otherwise, we adjust
// need to do before because of accumulations
sliceDateInt := request.PlantingDate.YearDay() - 1
if sliceDateInt < 0 {
sliceDateInt = 0
}
for i := sliceDateInt; i < len(gs[0].MinTemps); i++ { //; i++ {
row := []float64{}
for j := 0; j < len(gs); j++ {
row = append(row, utils.CalculateSingleGdd(gs[j].MinTemps[i], gs[j].MaxTemps[i], product))
if request.Accumulate && i > 0 {
if request.Accumulate && i > sliceDateInt {
row[j] += rows[len(rows)-1][j]
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment