Growing Degree Day
Each plant species has its own lower air temperature threshold and upper
air temperature threshold. It is assumed that no growth occurs outside of this
range. This temperature range varies for each plant.
Growing degree day units are calculated by using the maximum daily air temperature, the minimum daily air temperature and the crop’s lower temperature threshold.
Different methods exist for calculating heat units. The method most commonly used in the U.S. for determining heat unit accumulation relative to corn phenology is the formula first suggested by the National Oceanic and Atmospheric Administration. The “modified growing degree day formula” calculates daily accumulation of GDD’s as the average daily temperature minus 50° F.
Calculate Growing Degree Day (GDD) for each hive and add to database.
Centigrade Tbase = 10 Tmax = 30
SET @gdd_total:=0; SELECT q1.doy, q1.gdd, round(@gdd_total := @gdd_total + q1.gdd) as gdd_tot FROM (SELECT DAYOFYEAR(DATE_FORMAT(`hive_observation_time_local`, '%Y-%m-%d')) AS doy, (least(greatest(max(wx_temp_c),10),30) - least(greatest(min(wx_temp_c),10),30))/2 AS gdd from HIVE_DATA where hive_id=10 group by DATE_FORMAT(`hive_observation_time_local`, '%Y-%m-%d') ) AS q1
SELECT hive_id, DAYOFYEAR(DATE_FORMAT(`hive_observation_time_local`, '%Y-%m-%d')) AS doy, (least(greatest(max(wx_temp_c),10),30) - least(greatest(min(wx_temp_c),10),30))/2 AS gdd from HIVE_DATA group by DATE_FORMAT(`hive_observation_time_local`, '%Y-%m-%d'), hive_id