wee_import KeyError: 'luminosity'

112 views
Skip to first unread message

an oldman

unread,
Jul 20, 2021, 6:46:07 PM7/20/21
to weewx-user
weewx  rpm
Name        : weewx
Version     : 4.5.1
Release     : 1.el8

os fedora 34

atlas-config.conf attached
wee_import --import-config atlas-import.conf --dry-run
i get this error

Using WeeWX configuration file /etc/weewx/weewx.conf
Starting wee_import...
A CSV import from source file '/tmp/data.csv' has been requested.
Using database binding 'wx_binding', which is bound to database 'weewx.sdb'
Destination table 'archive' unit system is '0x01' (US).
Missing derived observations will be calculated.
All WeeWX radiation fields will be set to None.
This is a dry run, imported data will not be saved to archive.
Starting dry run import ...
Traceback (most recent call last):
  File "/usr/share/weewx/wee_import", line 903, in <module>
    main()
  File "/usr/share/weewx/wee_import", line 833, in main
    source_obj.run()
  File "/usr/share/weewx/weeimport/weeimport.py", line 402, in run
    _mapped_data = self.mapRawData(_raw_data, self.archive_unit_sys)
  File "/usr/share/weewx/weeimport/weeimport.py", line 920, in mapRawData
    weewx.units.obs_group_dict[_field])
  File "/usr/lib64/python3.9/collections/__init__.py", line 941, in __getitem__
    return self.__missing__(key)            # support subclasses that define __missing__
  File "/usr/lib64/python3.9/collections/__init__.py", line 933, in __missing__
    raise KeyError(key)
KeyError: 'luminosity'

if i add luminosity to units.py with group_illuminance it works
if i change luminosity to illuminance in the config file it works but then have to change the database too
i don't thing wee_import is using the in use schema
atlas-import.conf

gjr80

unread,
Jul 20, 2021, 10:14:59 PM7/20/21
to weewx-user
The issue you are seeing is not due to the schema being used by wee_import, rather it is a consequence of some implementation decisions made some time ago when the wview_extended schema was introduced. There has been some off-line discussion earlier this year about a solution; however, a solution has not yet been implemented. I have raised issue #685 to track this. I can't give a timeline for implementation as this will take some discussion with Tom when he is back online.

In terms of your import here and now you probably have a couple of options. Firstly, you could import your data and omit the 'Light Intensity' data for now and later, once the solution is in place, import just the 'Light Intensity' data. Secondly, you could import your entire data set now using your units.py change to set luminosity to group_illuminance, I don't think this will necessitate future changes to your data but it is possible you may have to move your luminosity data to another column/rename the luminosity column. Finally, of course any changes to units.py will likely not survive an upgrade, should not be a problem in this case though as any upgrade will likely implement the solution to this issue (whatever that may be).

Gary

an oldman

unread,
Jul 20, 2021, 11:01:51 PM7/20/21
to weewx-user
thanks for the quick reply
it's no trouble for me to import the data.  just testing fedora 34 and weex 4.5.1 before updating working system, normally i just copy my data base from my working weewx system, but i thought i read in the docs about wee_import using the in use database schema thought i would try it out is all.
thank you again for the reply, and weewx
Reply all
Reply to author
Forward
0 new messages