reede, 17. veebruar 2017 22:47.24 UTC+2 kirjutas José Miguel Castellet
Martí:
Hello Jose!
Thank you for pointing out how to do that. I implemented that algorithm,
everything worked well. BUT (there is almost always one, isn't it :-) )
there is a bug in your algorithm.
Namely, if daily minimum is below +10 C, that algorithm fails, because of
incorrect treating of minimum temperature.
GDD algorithm says: is minimum temperature is below +10C, then minimum
temperature = +10C. But *$day.outTemp.avg.raw *gives correct average as it
should be.
For example, when minimum temperature is +5 and maximum temperature is +15,
*$day.outTemp.avg.raw* is +10 and therefore calculated GDD will be 0.
But according to GDD algorithm one should calculate: (15 + 10)/2 - 10 =
12.5 - 10 = 2.5. The difference can be much larger, specially in the spring
or autumn, when night can be rather cool, few degrees above 0 (at least +58
N where I live), and following day easily around +25. So I changed your
code a bit:
#set $monthGDD=0
##
#for $day in $month.days
#if $day.barometer.count.raw
#if $day.outTemp.min.raw<10
#if $day.outTemp.max.raw<30
#if $day.outTemp.max.raw<10
#set $GDD=0
#else
#set $GDD=($day.outTemp.max.raw+10.0)/2.0 - 10
#end if
#else
#set $GDD=20
#end if
#else
#if $day.outTemp.max.raw<30
#set $GDD=($day.outTemp.max.raw+$day.outTemp.min.raw)/2.0 -
10
#else
#set $GDD=20
#end if
#end if
#set $monthGDD=$monthGDD+$GDD
##
Easy to miss, if you live in warm climate :-)
Hopefully someone has figured out how to construct correct cumulative (over
the season!) growing degree day graphs, too :-)
Best regards,
Tõnis
> I introduced the Growing Degree Days (GDD) Base10 (°C) in weewx. To do
> that, I created a new template, NOAA-YYYY-MM_ampliado.txt.tmpl, to
> produce the MONTHLY CLIMATOLOGICAL EXTENDED SUMMARY NOAA file, based on
> the standard NOAA-YYYY-MM.txt.tmpl (MONTHLY CLIMATOLOGICAL SUMMARY). As
> you can see, it contains several additional variables already available in
> weewx.
>
> You can see the result in
> http://www3.uji.es/~pepe/weewx/NOAA/NOAA-2017-02_ampliado.txt
>
> The modified code (*see bold characters*) in the
> NOAA-YYYY-MM_ampliado.txt.tmpl is:
>
> …
>
> TEMPERATURE ($unit.label.outTemp.strip()), RAIN
> ($unit.label.rain.strip()), WIND SPEED ($unit.label.windSpeed.strip()),
> HUMIDITY ($unit.label.outHumidity.strip()), BAROMETER
> ($unit.label.barometer.strip()), *Growing Degree Days/GDD Base10
> ($unit.label.outTemp.strip())*
>
> DAY TEMP HIGH TIME LOW TIME DAYS DAYS RAIN SPEED
> HIGH TIME DIR HUMID HIGH TIME LOW TIME BAROM HIGH
> TIME LOW TIME* GDD*
>
>
> -------------------------------------------------------------------------------------------------------------------------------------------------------------
> *-------*
>
> ## jmcm mie 11 ene 2017 21:50:00 CET calculo el acumulado mensual GDD
> (suma te’rmica, ST)
>
> *#set $monthGDD=0*
>
> *##*
>
> #for $day in $month.days
>
> #if $day.barometer.count.raw
>
> *#if $day.outTemp.avg.raw>10*
>
> * #if $day.outTemp.avg.raw<30*
>
> * #set $GDD=$day.outTemp.avg.raw-10*
>
> * #else*
>
> * #set $GDD=20*
>
> * #end if*
>
> *#else*
>
> *#set $GDD=0*
>
> *#end if*
>
> *#set $monthGDD=$monthGDD+$GDD*
>
> ##
>
> $day.dateTime.format($D) $day.outTemp.avg.nolabel($Temp,$NONE)
> $day.outTemp.max.nolabel($Temp,$NONE) $day.outTemp.maxtime.format($Time)
> $day.outTemp.min.nolabel($Temp,$NONE) $day.outTemp.mintime.format($Time)
> $day.heatdeg.sum.nolabel($Te
>
> mp,$NONE) $day.cooldeg.sum.nolabel($Temp,$NONE)
> $day.rain.sum.nolabel($Rain,$NONE) $day.wind.avg.nolabel($Wind,$NONE)
> $day.wind.max.nolabel($Wind,$NONE) $day.wind.maxtime.format($Time)
> $day.wind.vecdir.nolabel($Dir,$NONE) $day.outHumidit
>
> y.avg.nolabel($Humid,$NONE) $day.outHumidity.max.nolabel($Humid,$NONE)
> $day.outHumidity.maxtime.format($Time)
> $day.outHumidity.min.nolabel($Humid,$NONE)
> $day.outHumidity.mintime.format($Time)
> $day.barometer.avg.nolabel($Barom,$NONE) $day
>
> .barometer.max.nolabel($Barom,$NONE) $day.barometer.maxtime.format($Time)
> $day.barometer.min.nolabel($Barom,$NONE)
> $day.barometer.mintime.format($Time) *#echo ('%6.2f' % $GDD).replace('.',
> ',')#*
>
> #else
>
> $day.dateTime.format($D)
>
> #end if
>
> #end for
>
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> $month.outTemp.avg.nolabel($Temp,$NONE)
> $month.outTemp.max.nolabel($Temp,$NONE)
> $month.outTemp.maxtime.format($D)
> $month.outTemp.min.nolabel($Temp,$NONE)
> $month.outTemp.mintime.format($D) $month.heatdeg.sum.nolabel($Temp,$NONE)
>
> $month.cooldeg.sum.nolabel($Temp,$NONE)
> $month.rain.sum.nolabel($Rain,$NONE) $month.wind.avg.nolabel($Wind,$NONE)
> $month.wind.max.nolabel($Wind,$NONE) $month.wind.maxtime.format($D)
> $month.wind.vecdir.nolabel($Dir) $month.outHumidity
>
> .avg.nolabel($Humid,$NONE) $month.outHumidity.max.nolabel($Humid,$NONE)
> $month.outHumidity.maxtime.format($D)
> $month.outHumidity.min.nolabel($Humid,$NONE)
> $month.outHumidity.mintime.format($D) $month.barometer.avg.nolabel($Barom,$N
>
> ONE) $month.barometer.max.nolabel($Barom,$NONE)
> $month.barometer.maxtime.format($D)
> $month.barometer.min.nolabel($Barom,$NONE)
> $month.barometer.mintime.format($D) *#echo ('%6.2f' %
> $monthGDD).replace('.', ',')#*
>
>
> Hope that helps ;-)
>
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.