bellrichm / weewx-aqi-xtype

A WeeWX XType to calclulate AQI.
GNU Affero General Public License v3.0
1 stars 0 forks source link

AQI Type Error in WeeWx 5.0 #7

Open dshanske opened 7 months ago

dshanske commented 7 months ago

an 15 19:58:21 weewxd[1195199]: CRITICAL main: Traceback (most recent call last): Jan 15 19:58:21 weewxd[1195199]: CRITICAL main: File "/usr/share/weewx/weewx/xtypes.py", line 86, in get_scalar Jan 15 19:58:21 weewxd[1195199]: CRITICAL main: ** return xtype.get_scalar(obs_type, record, db_manager, option_dict) Jan 15 19:58:21 weewxd[1195199]: CRITICAL main: File "/etc/weewx/bin/user/aqitype.py", line 347, in get_scalar Jan 15 19:58:21 weewxd[1195199]: CRITICAL main: aqi = self.aqi_fields[obs_type]['calculator'].calculate(db_manager, record['dateTime'], record[dependent_field], aqi_type) Jan 15 19:58:21 weewxd[1195199]: CRITICAL main: File "/etc/weewx/bin/user/aqitype.py", line 168, in calculate Jan 15 19:58:21 weewxd[1195199]: CRITICAL main: concentration = self.calculate_concentration(db_manager, time_stamp) Jan 15 19:58:21 weewxd[1195199]: CRITICAL main: File "/etc/weewx/bin/user/aqitype.py", line 139, in calculate_concentration Jan 15 19:58:21 weewxd[1195199]: CRITICAL main: min_value = min(data[0]) Jan 15 19:58:21 weewxd[1195199]: CRITICAL main: TypeError: '<' not supported between instances of 'NoneType' and 'NoneType' Jan 15 19:58:21 weewxd[1195199]: CRITICAL main:

dshanske commented 7 months ago

This may be related to the fact my AQI sensor got so soaked in a rainstorm it shorted out, so no data is available, and the has_data issue previously raised.

The replacement parts are en route.

bellrichm commented 7 months ago

In python the min (and max) cannot have ’None’ in the list. The lists returned from get_series will need to be processed to remove these items.

dshanske commented 7 months ago

How?

bellrichm commented 7 months ago

Sorry, that comment was meant for me. I did some initial triage and didn't want to lose it. Once I finish migrating to WeeWX I'll get on this.

dshanske commented 7 months ago

Tell me if there is anything on this or your other project I can test.

The new air quality sensor's arrival from the manufacturer is imminent.

bellrichm commented 7 months ago

Latest commit removes any ‘None’ values prior to calculating NowCast AQI. Could you try it against real data?

Also, just curious, did this just start with upgrade to WeeWX V5? If so, any chance you also upgraded python?

Thanks

dshanske commented 7 months ago

Sensor installed. No luck...keeps crashing with the error.

bellrichm commented 7 months ago

I’ll add some debug logging so we can see what the data really looks like.

bellrichm commented 7 months ago

Additional debug logging in latest commit. It will show the inputs to the NowCast calculations.

Also, did this just start with upgrade to WeeWX V5? If so, any chance you also upgraded python?

dshanske commented 7 months ago

I'm not sure because of the gap caused by the hardware failure, but I never noticed it before the upgrade.

No recent python version changes...

dshanske commented 6 months ago

Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: Evaluation of template /etc/weewx/skins/Seasons/index.html.tmpl failed with exception '<class 'weewx.CannotCalculate'>' Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: Ignoring template /etc/weewx/skins/Seasons/index.html.tmpl Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: Reason: pm2_5_aqi Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: Traceback (most recent call last): Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: File "/usr/share/weewx/weewx/cheetahgenerator.py", line 334, in generate Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: unicode_string = compiled_template.respond() Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: File "_etc_weewx_skins_Seasons_index_html_tmpl.py", line 219, in respond Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1708, in _handleCheetahInclude Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: self._CHEETAH__cheetahIncludes[_includeID].respond(trans) Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: File "_etc_weewx_skins_Seasons_current_inc.py", line 197, in respond Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1446, in getVar Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: return valueFromSearchList( Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: ^^^^^^^^^^^^^^^^^^^^ Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: File "/usr/lib/python3/dist-packages/Cheetah/NameMapper.py", line 291, in valueFromSearchList Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: return _valueForName(namespace, name, Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: File "/usr/lib/python3/dist-packages/Cheetah/NameMapper.py", line 231, in _valueForName Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: nextObj = getattr(obj, key) Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: ^^^^^^^^^^^^^^^^^ Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: File "/usr/share/weewx/weewx/tags.py", line 389, in has_data Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: val = weewx.xtypes.has_data(self.obs_type, self.timespan, db_manager) Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: File "/usr/share/weewx/weewx/xtypes.py", line 156, in has_data Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: vt = xtype.get_aggregate(obs_type, timespan, 'not_null', db_manager) Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: File "/usr/share/weewx/weewx/xtypes.py", line 942, in get_aggregate Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: value = get_scalar(obs_type, record, db_manager)[0] Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: File "/usr/share/weewx/weewx/xtypes.py", line 86, in get_scalar Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: return xtype.get_scalar(obs_type, record, db_manager, option_dict) Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: ** ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: File "/etc/weewx/bin/user/aqitype.py", line 342, in get_scalar Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: raise weewx.CannotCalculate(obs_type) Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: weewx.CannotCalculate: pm2_5_aqi Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: Evaluation of template /etc/weewx/skins/Seasons/rss.xml.tmpl failed. Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: Ignoring template /etc/weewx/skins/Seasons/rss.xml.tmpl Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: Reason: cannot find 'dateTime' Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: To debug, try inserting '#errorCatcher Echo' at top of template

bellrichm commented 6 months ago
  1. Can you post the changes you had to make to seasons skin? Or even zip that directory.
  2. Make sure you are running with the latest commit of weewx-aqi-xtype. Let me know if you need a release made.

Thanks

dshanske commented 6 months ago

I am...and just added the types to observation stats.

bellrichm commented 6 months ago

Interesting, I’m seeing a blank line at

Feb 03 22:38:16 ozonepark weewxd[2499406]: ERROR weewx.cheetahgenerator: **** File "/etc/weewx/bin/user/aqitype.py", line 342, in get_scalar

At this time, since debug =1 is broken in v5 it doesn’t really matter. I’m trying to determine if it is base WeeWX or this xtype. I’ll let you know when I know more.

bellrichm commented 6 months ago

The error in seasons skin should be fixed in next WeeWX release. See 929 for details. I hope the rss error is a side effect because that error has no information related to weewx-aqi-xtype.