Re: [weewx-user] Re: Issue with NOAA Template when trying to add additional fields

2020-09-16 Thread Tom Keffer
Turned out allowing iterators to use data bindings was an easier problem
than I thought. Fixed in commit b50fe45


Now you can do something like

#for $day in $month.days
$day($data_binding='purpleair_binding').pm2_5_atm.max
#end for

-tk


On Tue, Jun 30, 2020 at 6:43 AM Tom Keffer  wrote:

> Yes, this is a limitation in the iterators: they cannot use a data
> binding. There's probably a workaround, but I'd have to think about it a
> bit.
>
> In the meantime, I've put up issue #580
>  to track.
>
> Probably related to issue #384 
> as well.
>
> -tk
>
> On Tue, Jun 30, 2020 at 6:16 AM Rahul Bedi  wrote:
>
>> Tried. I get a similar error:
>>
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator: Generate failed with exception '> 'exceptions.TypeError'>'
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator:  Ignoring template
>> /etc/weewx/skins/Seasons/NOAA/NOAA--MM.txt.tmpl
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator:  Reason: 'TimespanBinder' object is not callable
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator:   Traceback (most recent call last):
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator: File
>> "/usr/share/weewx/weewx/cheetahgenerator.py", line 322, in generate
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator:   unicode_string =
>> compiled_template.respond()
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator: File
>> "cheetah__etc_weewx_skins_Seasons_NOAA_NOAA__MM_txt_tmpl_1593522919_43_84946.py",
>> line 479, in respond
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator: File
>> "cheetah__etc_weewx_skins_Seasons_NOAA_NOAA__MM_txt_tmpl_1593522919_43_84946.py",
>> line 252, in __errorCatcher27
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator: File "", line 1, in 
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator:   TypeError: 'TimespanBinder' object is not
>> callable
>>
>> On Tue, Jun 30, 2020 at 6:10 PM gjr80  wrote:
>>
>>> Hi,
>>>
>>> Try using:
>>>
>>> $day($data_binding='purpleair_binding').pm2_5_atm.maxtime.format($Time)
>>> $day($data_binding='purpleair_binding').pm2_5_atm.max.nolabel($Count,
>>> $NONE)
>>>
>>> Gary
>>>
>>>
>>> On Tuesday, 30 June 2020 22:32:23 UTC+10, Rahul Bedi wrote:

 Hi,

 I have been trying to update the NOAA template to incorporate the air
 quality data in the monthly report, but when I added the two entries (in
 red)  in the file  NOAA--MM.txt.tmpl, I an error (attached at the end).
 Interestingly the same two entries, in the hilo.inc file in the Seasons
 skin work fine.

 Even more interestingly, the same two entries placed just before the
 "MONTHLY ..." line, work just fine.

 Any idea about what am I doing wrong ?

 Thanks.

 - Rahul


 #errorCatcher Echo
 #set $YM="%Y %m"
 #set $D=" %d"
 #set $M=" %b"
 #set $Time=" %H:%M"
 #set $NODAY=" N/A"
 #set $Temp="%6.1f"
 #set $Wind="%6.1f"
 #set $Dir="%6.0f"
 #set $Count="%6d"
 #set $NONE="   N/A"
 #if $unit.unit_type_dict.group_rain == "mm"
 #set $Rain="%6.1f"
 #else
 #set $Rain="%6.2f"
 #end if


MONTHLY CLIMATOLOGICAL SUMMARY for $month_name
 $year_name


 NAME: $station.location
 ELEV: $station.altitudeLAT:
 $station.latitude[0]-$station.latitude[1] $station.latitude[2]LONG:
 $station.longitude[0]-$station.longitude[1] $station.longitude[2]


TEMPERATURE ($unit.label.outTemp.strip()), RAIN
 ($unit.label.rain.strip()), WIND SPEED ($unit.label.windSpeed.strip())

  HEAT   COOL AVG
   MEAN   DEGDEG  WIND
  DOM
 DAY   TEMP   HIGH   TIMELOW   TIME   DAYS   DAYS   RAIN  SPEED
  HIGH   TIMEDIR

 ---
 #for $day in $month.days
 #if $day.barometer.count.raw
 $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($Temp,$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) 

Re: [weewx-user] Re: Issue with NOAA Template when trying to add additional fields

2020-06-30 Thread gjr80
There is nothing that will directly give you the first of the month. The 
closest you can do is $days_ago:

$day($data_binding=‘some binding’, $days_ago=20).outTemp.maxtime

But of course as we move through the month the actual day provided will change. 
You could use a little in-line python in your template to calculate an offset 
based on the current day of month to use with the number of days ago and then 
use that in the tag, eg (untested):

#set $offset = (some calculation)
$day($data_binding=‘some binding’, $days_ago=$offset).outTemp.maxtime
$day($data_binding=‘some binding’, $days_ago=$offset+1).outTemp.maxtime

Not sure how well that will work (not sure if in-line calculation is supported 
in $day() tags) and it’s starting to get complex and messy.

For info detail on aggregate tag usage can be found in the Customization Guide 
(http://weewx.com/docs/customizing.htm#general_aggregation_periods).

Gary

-- 
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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/d284759c-a6d0-4796-93b9-f5ddadd82ebbo%40googlegroups.com.


Re: [weewx-user] Re: Issue with NOAA Template when trying to add additional fields

2020-06-30 Thread Rahul Bedi
BTW if I was to manually replace $day with a variable that is, say, the
first day of the month ? How would I do that ?

I am trying to remove the loop and replace that with 31 lines that will be
one for each possible date.

Thx.

- Rahul

On Tue, Jun 30, 2020 at 7:28 PM Rahul Bedi  wrote:

> Thanks Tom and Gary. The only other way I can think of is to do the kludgy
> way of removing the loop altogether and doing it 31 times for the month :(.
> Not pretty but had to do that in hilo.inc
>
> - Rahul
>
> On Tue, Jun 30, 2020 at 7:14 PM Tom Keffer  wrote:
>
>> Yes, this is a limitation in the iterators: they cannot use a data
>> binding. There's probably a workaround, but I'd have to think about it a
>> bit.
>>
>> In the meantime, I've put up issue #580
>>  to track.
>>
>> Probably related to issue #384
>>  as well.
>>
>> -tk
>>
>> On Tue, Jun 30, 2020 at 6:16 AM Rahul Bedi  wrote:
>>
>>> Tried. I get a similar error:
>>>
>>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>>> weewx.cheetahgenerator: Generate failed with exception '>> 'exceptions.TypeError'>'
>>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>>> weewx.cheetahgenerator:  Ignoring template
>>> /etc/weewx/skins/Seasons/NOAA/NOAA--MM.txt.tmpl
>>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>>> weewx.cheetahgenerator:  Reason: 'TimespanBinder' object is not callable
>>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>>> weewx.cheetahgenerator:   Traceback (most recent call last):
>>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>>> weewx.cheetahgenerator: File
>>> "/usr/share/weewx/weewx/cheetahgenerator.py", line 322, in generate
>>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>>> weewx.cheetahgenerator:   unicode_string =
>>> compiled_template.respond()
>>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>>> weewx.cheetahgenerator: File
>>> "cheetah__etc_weewx_skins_Seasons_NOAA_NOAA__MM_txt_tmpl_1593522919_43_84946.py",
>>> line 479, in respond
>>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>>> weewx.cheetahgenerator: File
>>> "cheetah__etc_weewx_skins_Seasons_NOAA_NOAA__MM_txt_tmpl_1593522919_43_84946.py",
>>> line 252, in __errorCatcher27
>>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>>> weewx.cheetahgenerator: File "", line 1, in 
>>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>>> weewx.cheetahgenerator:   TypeError: 'TimespanBinder' object is not
>>> callable
>>>
>>> On Tue, Jun 30, 2020 at 6:10 PM gjr80  wrote:
>>>
 Hi,

 Try using:

 $day($data_binding='purpleair_binding').pm2_5_atm.maxtime.format($Time)
 $day($data_binding='purpleair_binding').pm2_5_atm.max.nolabel($Count,
 $NONE)

 Gary


 On Tuesday, 30 June 2020 22:32:23 UTC+10, Rahul Bedi wrote:
>
> Hi,
>
> I have been trying to update the NOAA template to incorporate the air
> quality data in the monthly report, but when I added the two entries (in
> red)  in the file  NOAA--MM.txt.tmpl, I an error (attached at the 
> end).
> Interestingly the same two entries, in the hilo.inc file in the
> Seasons skin work fine.
>
> Even more interestingly, the same two entries placed just before the
> "MONTHLY ..." line, work just fine.
>
> Any idea about what am I doing wrong ?
>
> Thanks.
>
> - Rahul
>
>
> #errorCatcher Echo
> #set $YM="%Y %m"
> #set $D=" %d"
> #set $M=" %b"
> #set $Time=" %H:%M"
> #set $NODAY=" N/A"
> #set $Temp="%6.1f"
> #set $Wind="%6.1f"
> #set $Dir="%6.0f"
> #set $Count="%6d"
> #set $NONE="   N/A"
> #if $unit.unit_type_dict.group_rain == "mm"
> #set $Rain="%6.1f"
> #else
> #set $Rain="%6.2f"
> #end if
>
>
>MONTHLY CLIMATOLOGICAL SUMMARY for $month_name
> $year_name
>
>
> NAME: $station.location
> ELEV: $station.altitudeLAT:
> $station.latitude[0]-$station.latitude[1] $station.latitude[2]LONG:
> $station.longitude[0]-$station.longitude[1] $station.longitude[2]
>
>
>TEMPERATURE ($unit.label.outTemp.strip()), RAIN
> ($unit.label.rain.strip()), WIND SPEED ($unit.label.windSpeed.strip())
>
>  HEAT   COOL AVG
>   MEAN   DEGDEG  WIND
>  DOM
> DAY   TEMP   HIGH   TIMELOW   TIME   DAYS   DAYS   RAIN  SPEED
>  HIGH   TIMEDIR
>
> ---
> #for $day in $month.days
> #if $day.barometer.count.raw
> $day.dateTime.format($D) $day.outTemp.avg.nolabel($Temp,$NONE)
> $day.outTemp.max.nolabel($Temp,$NONE) 

Re: [weewx-user] Re: Issue with NOAA Template when trying to add additional fields

2020-06-30 Thread Rahul Bedi
Thanks Tom and Gary. The only other way I can think of is to do the kludgy
way of removing the loop altogether and doing it 31 times for the month :(.
Not pretty but had to do that in hilo.inc

- Rahul

On Tue, Jun 30, 2020 at 7:14 PM Tom Keffer  wrote:

> Yes, this is a limitation in the iterators: they cannot use a data
> binding. There's probably a workaround, but I'd have to think about it a
> bit.
>
> In the meantime, I've put up issue #580
>  to track.
>
> Probably related to issue #384 
> as well.
>
> -tk
>
> On Tue, Jun 30, 2020 at 6:16 AM Rahul Bedi  wrote:
>
>> Tried. I get a similar error:
>>
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator: Generate failed with exception '> 'exceptions.TypeError'>'
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator:  Ignoring template
>> /etc/weewx/skins/Seasons/NOAA/NOAA--MM.txt.tmpl
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator:  Reason: 'TimespanBinder' object is not callable
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator:   Traceback (most recent call last):
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator: File
>> "/usr/share/weewx/weewx/cheetahgenerator.py", line 322, in generate
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator:   unicode_string =
>> compiled_template.respond()
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator: File
>> "cheetah__etc_weewx_skins_Seasons_NOAA_NOAA__MM_txt_tmpl_1593522919_43_84946.py",
>> line 479, in respond
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator: File
>> "cheetah__etc_weewx_skins_Seasons_NOAA_NOAA__MM_txt_tmpl_1593522919_43_84946.py",
>> line 252, in __errorCatcher27
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator: File "", line 1, in 
>> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator:   TypeError: 'TimespanBinder' object is not
>> callable
>>
>> On Tue, Jun 30, 2020 at 6:10 PM gjr80  wrote:
>>
>>> Hi,
>>>
>>> Try using:
>>>
>>> $day($data_binding='purpleair_binding').pm2_5_atm.maxtime.format($Time)
>>> $day($data_binding='purpleair_binding').pm2_5_atm.max.nolabel($Count,
>>> $NONE)
>>>
>>> Gary
>>>
>>>
>>> On Tuesday, 30 June 2020 22:32:23 UTC+10, Rahul Bedi wrote:

 Hi,

 I have been trying to update the NOAA template to incorporate the air
 quality data in the monthly report, but when I added the two entries (in
 red)  in the file  NOAA--MM.txt.tmpl, I an error (attached at the end).
 Interestingly the same two entries, in the hilo.inc file in the Seasons
 skin work fine.

 Even more interestingly, the same two entries placed just before the
 "MONTHLY ..." line, work just fine.

 Any idea about what am I doing wrong ?

 Thanks.

 - Rahul


 #errorCatcher Echo
 #set $YM="%Y %m"
 #set $D=" %d"
 #set $M=" %b"
 #set $Time=" %H:%M"
 #set $NODAY=" N/A"
 #set $Temp="%6.1f"
 #set $Wind="%6.1f"
 #set $Dir="%6.0f"
 #set $Count="%6d"
 #set $NONE="   N/A"
 #if $unit.unit_type_dict.group_rain == "mm"
 #set $Rain="%6.1f"
 #else
 #set $Rain="%6.2f"
 #end if


MONTHLY CLIMATOLOGICAL SUMMARY for $month_name
 $year_name


 NAME: $station.location
 ELEV: $station.altitudeLAT:
 $station.latitude[0]-$station.latitude[1] $station.latitude[2]LONG:
 $station.longitude[0]-$station.longitude[1] $station.longitude[2]


TEMPERATURE ($unit.label.outTemp.strip()), RAIN
 ($unit.label.rain.strip()), WIND SPEED ($unit.label.windSpeed.strip())

  HEAT   COOL AVG
   MEAN   DEGDEG  WIND
  DOM
 DAY   TEMP   HIGH   TIMELOW   TIME   DAYS   DAYS   RAIN  SPEED
  HIGH   TIMEDIR

 ---
 #for $day in $month.days
 #if $day.barometer.count.raw
 $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($Temp,$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) 
 

Re: [weewx-user] Re: Issue with NOAA Template when trying to add additional fields

2020-06-30 Thread Tom Keffer
Yes, this is a limitation in the iterators: they cannot use a data binding.
There's probably a workaround, but I'd have to think about it a bit.

In the meantime, I've put up issue #580
 to track.

Probably related to issue #384 
as well.

-tk

On Tue, Jun 30, 2020 at 6:16 AM Rahul Bedi  wrote:

> Tried. I get a similar error:
>
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
> weewx.cheetahgenerator: Generate failed with exception ' 'exceptions.TypeError'>'
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
> weewx.cheetahgenerator:  Ignoring template
> /etc/weewx/skins/Seasons/NOAA/NOAA--MM.txt.tmpl
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
> weewx.cheetahgenerator:  Reason: 'TimespanBinder' object is not callable
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
> weewx.cheetahgenerator:   Traceback (most recent call last):
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
> weewx.cheetahgenerator: File
> "/usr/share/weewx/weewx/cheetahgenerator.py", line 322, in generate
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
> weewx.cheetahgenerator:   unicode_string =
> compiled_template.respond()
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
> weewx.cheetahgenerator: File
> "cheetah__etc_weewx_skins_Seasons_NOAA_NOAA__MM_txt_tmpl_1593522919_43_84946.py",
> line 479, in respond
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
> weewx.cheetahgenerator: File
> "cheetah__etc_weewx_skins_Seasons_NOAA_NOAA__MM_txt_tmpl_1593522919_43_84946.py",
> line 252, in __errorCatcher27
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
> weewx.cheetahgenerator: File "", line 1, in 
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
> weewx.cheetahgenerator:   TypeError: 'TimespanBinder' object is not
> callable
>
> On Tue, Jun 30, 2020 at 6:10 PM gjr80  wrote:
>
>> Hi,
>>
>> Try using:
>>
>> $day($data_binding='purpleair_binding').pm2_5_atm.maxtime.format($Time)
>> $day($data_binding='purpleair_binding').pm2_5_atm.max.nolabel($Count,
>> $NONE)
>>
>> Gary
>>
>>
>> On Tuesday, 30 June 2020 22:32:23 UTC+10, Rahul Bedi wrote:
>>>
>>> Hi,
>>>
>>> I have been trying to update the NOAA template to incorporate the air
>>> quality data in the monthly report, but when I added the two entries (in
>>> red)  in the file  NOAA--MM.txt.tmpl, I an error (attached at the end).
>>> Interestingly the same two entries, in the hilo.inc file in the Seasons
>>> skin work fine.
>>>
>>> Even more interestingly, the same two entries placed just before the
>>> "MONTHLY ..." line, work just fine.
>>>
>>> Any idea about what am I doing wrong ?
>>>
>>> Thanks.
>>>
>>> - Rahul
>>>
>>>
>>> #errorCatcher Echo
>>> #set $YM="%Y %m"
>>> #set $D=" %d"
>>> #set $M=" %b"
>>> #set $Time=" %H:%M"
>>> #set $NODAY=" N/A"
>>> #set $Temp="%6.1f"
>>> #set $Wind="%6.1f"
>>> #set $Dir="%6.0f"
>>> #set $Count="%6d"
>>> #set $NONE="   N/A"
>>> #if $unit.unit_type_dict.group_rain == "mm"
>>> #set $Rain="%6.1f"
>>> #else
>>> #set $Rain="%6.2f"
>>> #end if
>>>
>>>
>>>MONTHLY CLIMATOLOGICAL SUMMARY for $month_name
>>> $year_name
>>>
>>>
>>> NAME: $station.location
>>> ELEV: $station.altitudeLAT:
>>> $station.latitude[0]-$station.latitude[1] $station.latitude[2]LONG:
>>> $station.longitude[0]-$station.longitude[1] $station.longitude[2]
>>>
>>>
>>>TEMPERATURE ($unit.label.outTemp.strip()), RAIN
>>> ($unit.label.rain.strip()), WIND SPEED ($unit.label.windSpeed.strip())
>>>
>>>  HEAT   COOL AVG
>>>   MEAN   DEGDEG  WIND
>>>DOM
>>> DAY   TEMP   HIGH   TIMELOW   TIME   DAYS   DAYS   RAIN  SPEED
>>>  HIGH   TIMEDIR
>>>
>>> ---
>>> #for $day in $month.days
>>> #if $day.barometer.count.raw
>>> $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($Temp,$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('purpleair_binding').pm2_5_atm.maxtime.format($Time)
>>> $day('purpleair_binding').pm2_5_atm.max.nolabel($Count,$NONE)
>>> #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) 

Re: [weewx-user] Re: Issue with NOAA Template when trying to add additional fields

2020-06-30 Thread gjr80
I think I see what is going on. Normally you can pass a $data_binding to a 
$day tag to pull an aggregate from another database. However, in this case 
the $day tag is not a normal $day tag but rather it comes from iterating 
over all of the days in the month (for $day in $month.days) and you can't 
pass a $data_binding to that $day (I suspect you can pass it to $month but 
that is going to apply the same data binding to all $day tags). So I can't 
see how it can be done (short of putting you air quality data in the same 
database). Might be worth waiting till Tom looks at this, he may have some 
cunning magic he can perform.

Gary

On Tuesday, 30 June 2020 23:16:31 UTC+10, Rahul Bedi wrote:
>
> Tried. I get a similar error:
>
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR 
> weewx.cheetahgenerator: Generate failed with exception ' 'exceptions.TypeError'>'
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR 
> weewx.cheetahgenerator:  Ignoring template 
> /etc/weewx/skins/Seasons/NOAA/NOAA--MM.txt.tmpl
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR 
> weewx.cheetahgenerator:  Reason: 'TimespanBinder' object is not callable
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR 
> weewx.cheetahgenerator:   Traceback (most recent call last):
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR 
> weewx.cheetahgenerator: File 
> "/usr/share/weewx/weewx/cheetahgenerator.py", line 322, in generate
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR 
> weewx.cheetahgenerator:   unicode_string = 
> compiled_template.respond()
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR 
> weewx.cheetahgenerator: File 
> "cheetah__etc_weewx_skins_Seasons_NOAA_NOAA__MM_txt_tmpl_1593522919_43_84946.py",
>  
> line 479, in respond
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR 
> weewx.cheetahgenerator: File 
> "cheetah__etc_weewx_skins_Seasons_NOAA_NOAA__MM_txt_tmpl_1593522919_43_84946.py",
>  
> line 252, in __errorCatcher27
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR 
> weewx.cheetahgenerator: File "", line 1, in 
> Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR 
> weewx.cheetahgenerator:   TypeError: 'TimespanBinder' object is not 
> callable
>
>

-- 
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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/19af6989-e959-4141-9075-ca31b2a34ef7o%40googlegroups.com.


Re: [weewx-user] Re: Issue with NOAA Template when trying to add additional fields

2020-06-30 Thread Rahul Bedi
Tried. I get a similar error:

Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
weewx.cheetahgenerator: Generate failed with exception ''
Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
weewx.cheetahgenerator:  Ignoring template
/etc/weewx/skins/Seasons/NOAA/NOAA--MM.txt.tmpl
Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
weewx.cheetahgenerator:  Reason: 'TimespanBinder' object is not callable
Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
weewx.cheetahgenerator:   Traceback (most recent call last):
Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
weewx.cheetahgenerator: File
"/usr/share/weewx/weewx/cheetahgenerator.py", line 322, in generate
Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
weewx.cheetahgenerator:   unicode_string =
compiled_template.respond()
Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
weewx.cheetahgenerator: File
"cheetah__etc_weewx_skins_Seasons_NOAA_NOAA__MM_txt_tmpl_1593522919_43_84946.py",
line 479, in respond
Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
weewx.cheetahgenerator: File
"cheetah__etc_weewx_skins_Seasons_NOAA_NOAA__MM_txt_tmpl_1593522919_43_84946.py",
line 252, in __errorCatcher27
Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
weewx.cheetahgenerator: File "", line 1, in 
Jun 30 18:45:19 PrideWeatherStation weewx[23078] ERROR
weewx.cheetahgenerator:   TypeError: 'TimespanBinder' object is not
callable

On Tue, Jun 30, 2020 at 6:10 PM gjr80  wrote:

> Hi,
>
> Try using:
>
> $day($data_binding='purpleair_binding').pm2_5_atm.maxtime.format($Time)
> $day($data_binding='purpleair_binding').pm2_5_atm.max.nolabel($Count,$NONE
> )
>
> Gary
>
>
> On Tuesday, 30 June 2020 22:32:23 UTC+10, Rahul Bedi wrote:
>>
>> Hi,
>>
>> I have been trying to update the NOAA template to incorporate the air
>> quality data in the monthly report, but when I added the two entries (in
>> red)  in the file  NOAA--MM.txt.tmpl, I an error (attached at the end).
>> Interestingly the same two entries, in the hilo.inc file in the Seasons
>> skin work fine.
>>
>> Even more interestingly, the same two entries placed just before the
>> "MONTHLY ..." line, work just fine.
>>
>> Any idea about what am I doing wrong ?
>>
>> Thanks.
>>
>> - Rahul
>>
>>
>> #errorCatcher Echo
>> #set $YM="%Y %m"
>> #set $D=" %d"
>> #set $M=" %b"
>> #set $Time=" %H:%M"
>> #set $NODAY=" N/A"
>> #set $Temp="%6.1f"
>> #set $Wind="%6.1f"
>> #set $Dir="%6.0f"
>> #set $Count="%6d"
>> #set $NONE="   N/A"
>> #if $unit.unit_type_dict.group_rain == "mm"
>> #set $Rain="%6.1f"
>> #else
>> #set $Rain="%6.2f"
>> #end if
>>
>>
>>MONTHLY CLIMATOLOGICAL SUMMARY for $month_name
>> $year_name
>>
>>
>> NAME: $station.location
>> ELEV: $station.altitudeLAT: $station.latitude[0]-$station.latitude[1]
>> $station.latitude[2]LONG: $station.longitude[0]-$station.longitude[1]
>> $station.longitude[2]
>>
>>
>>TEMPERATURE ($unit.label.outTemp.strip()), RAIN
>> ($unit.label.rain.strip()), WIND SPEED ($unit.label.windSpeed.strip())
>>
>>  HEAT   COOL AVG
>>   MEAN   DEGDEG  WIND
>>DOM
>> DAY   TEMP   HIGH   TIMELOW   TIME   DAYS   DAYS   RAIN  SPEED
>>  HIGH   TIMEDIR
>>
>> ---
>> #for $day in $month.days
>> #if $day.barometer.count.raw
>> $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($Temp,$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('purpleair_binding').pm2_5_atm.maxtime.format($Time)
>> $day('purpleair_binding').pm2_5_atm.max.nolabel($Count,$NONE)
>> #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)
>>
>>
>>
>> Error log:
>>
>> Jun 30 17:55:19 PrideWeatherStation weewx[23078] ERROR
>> weewx.cheetahgenerator: Generate failed with exception '> 'exceptions.TypeError'>'
>> Jun 30 17:55:19 PrideWeatherStation weewx[23078] ERROR
>>