Difference between revisions of "Growing Degree Day"

From HiveTool
Jump to: navigation, search
(Created page with " 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`,...")
(No difference)

Revision as of 18:53, 29 April 2018


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