diff --git a/cron/export/bulk/stations/daily.sql b/cron/export/bulk/stations/daily.sql index d69ff67..3ad21b7 100644 --- a/cron/export/bulk/stations/daily.sql +++ b/cron/export/bulk/stations/daily.sql @@ -87,17 +87,17 @@ UNION all (SELECT `date`, FROM `daily_ghcn` WHERE `station` = :station) UNION all (SELECT date(`time`) as `date`, - if(count(`temp`) < 24, null, round(avg(`temp`), 1)) as `tavg`, - if(count(`temp`) < 24, null, min(`temp`)) as `tmin`, - if(count(`temp`) < 24, null, max(`temp`)) as `tmax`, - if(count(`prcp`) < 24, null, round(sum(`prcp`), 1)) as `prcp`, - if(count(`snow`) < 24, null, max(`snow`)) as `snow`, - if(count(`wdir`) < 24, + if(count(`temp`) < 23, null, round(avg(`temp`), 1)) as `tavg`, + if(count(`temp`) < 23, null, min(`temp`)) as `tmin`, + if(count(`temp`) < 23, null, max(`temp`)) as `tmax`, + if(count(`prcp`) < 23, null, round(sum(`prcp`), 1)) as `prcp`, + if(count(`snow`) < 23, null, max(`snow`)) as `snow`, + if(count(`wdir`) < 23, null, round(degavg(sum(sin(radians(`wdir`))), sum(cos(radians(`wdir`)))), 1)) as `wdir`, - if(count(`wspd`) < 24, null, round(avg(`wspd`), 1)) as `wspd`, - if(count(`wpgt`) < 24, null, max(`wpgt`)) as `wpgt`, - if(count(`pres`) < 24, null, round(avg(`pres`), 1)) as `pres`, + if(count(`wspd`) < 23, null, round(avg(`wspd`), 1)) as `wspd`, + if(count(`wpgt`) < 23, null, max(`wpgt`)) as `wpgt`, + if(count(`pres`) < 23, null, round(avg(`pres`), 1)) as `pres`, null as `tsun`, group_concat(distinct `temp_flag` separator '') as `tavg_flag`, group_concat(distinct `temp_flag` separator '') as `tmin_flag`,