In /usr/share/weewx/weewx/units.py the wetbulb temperature is defined as 
outWetbulb instead of wetbulbTemp.

Remy LAVABRE schrieb am Sonntag, 17. September 2023 um 16:55:03 UTC+2:

> Hello and thank you for your answer.
> By adding the line weewx.units.obs_group_dict['wetbulbTemp'] = 
> 'group_temperature' to the /usr/share/weewx/user/extensions.py file, the 
> wetbulbTemp field is now imported correctly.
> Thank you for your help !
>
> However, I have a new question as I haven't been able to understand 
> exactly the weewx documentation on this subject. I clearly saw that the 
> case of adding electricity consumption to the database had been processed 
> but I did not understand the entire explanation given.
>
> To put it simply, I retrieve data in CSV format which I integrate at 
> regular intervals into the weewx database using wee_import.py (my weather 
> station does not have a USB output and the data is retrieved from AWEKAS).
> To the weather data, I would have liked to add for the period considered:
> - CPU load data (unitless)
> - The total and used memory of the Raspberry (kB unit)
> - The total and used capacity of the SSD (Gb unit)
> - Power consumption (Watt unit)
> - Water consumption (unit per liter)
>
> I created the fields I needed in the existing WeeWX database without 
> problem with wee_database
>
> What I couldn't do:
> - Create a new base group (for example group_memory with the new Kb and Gb 
> units). What file exactly should be modified or created and where is it 
> located?
>
> Compared to the documentation, I would tend to make a file 
> "/usr/share/weewx/user/memory.py" with in it:
>
>
>
>
>
>
>
>
>
> *import weewx.unitsweewx.units.obs_group_dict['rocketForce'] = 
> 'group_memory'weewx.units.USUnits['group_memory'] = 
> 'byte'weewx.units.MetricUnits['group_memory'] = 
> 'byte'weewx.units.MetricWXUnits['group_memory'] = 
> 'byte'weewx.units.default_unit_format_dict['byte'] = 
> '%.1f'weewx.units.default_unit_label_dict['byte'] = ' byte'*
>
> Is my approach correct? How to create the units kB and gB?
>
>
> - For data that is unitless such as charge1, charge5 and charge15 
> (assuming that the field names of the weewx.sdb database are 
> charge1,charge5,charge15 and that the names of the header fields of the CSV 
> file to import are charge1, charge5 and charge15), will the import be done 
> by putting in the CSV import configuration file for wee_import.py:
> source = CSV
>
> [CSV]
> ....
>     [[FieldMap]]
>         dateTime    = dateTime, unix_epoch
> ....
>         charge1    = charge1
>         charge5    = charge5
>         charge15   = charge15
>
> Thank you for your help because I have my data in a CSV file but am a 
> little lost importing it into the weewx database...
>
> *Rémy LAVABRE*
>
>
> Le sam. 29 juil. 2023 à 13:33, gjr80 <gjrod...@gmail.com> a écrit :
>
>> Should have spelt out the full path/file:
>>
>> /usr/share/weewx/user/extensions.py
>>
>> Didn’t say the WeeWX daemon has anything to do with your issue, was 
>> pointing out that for WeeWX to pickup the new settings (eg for reports, 
>> services etc) you need to restart the daemon. This is SOP for changes to 
>> .py files. For wee_import you do not need to restart. 
>>
>> Gary
>> On Saturday, 29 July 2023 at 09:47:31 UTC+1 remy.l...@gmail.com wrote:
>>
>>> Thanks Gary for your response.
>>> I added :
>>>
>>>
>>> import weewx.units
>>> weewx.units.obs_group_dict['wetbulbTemp'] = 'group_temperature'
>>>
>>> in file /usr/share/weewx/weecfg/extension.py
>>>
>>> It didn't change anything about the problem when using wee_import.py, I 
>>> still get the same error.
>>> I specify that I did not create a field ['wetbulbTemp'] in the WeeWX 
>>> database but simply renamed ['heatindex1'] to ['wetbulbTemp'].
>>>
>>> The WeeWX daemon does not enter (in my opinion) into the problem since 
>>> to use the wee_import.py utility it is strongly advised to stop it... What 
>>> I do.
>>>
>>> I saw in the documentation what you are talking about where it is a 
>>> question of creating a user/electricity.py service, but unfortunately did 
>>> not quite understand where this electricity.py file went... :-(
>>>
>>> *Rémy LAVABRE*
>>>
>>>
>>> Le sam. 29 juil. 2023 à 10:04, gjr80 <gjrod...@gmail.com> a écrit :
>>>
>>>> Your problem is that wee_database --add_column/--rename_column makes 
>>>> all necessary changes to the database, but it does not make any change to 
>>>> the WeeWX unit system; in other words WeeWX knows there is a field 
>>>> wetbulbTemp in the database but does not know if it is a temperature, 
>>>> wind speed or rainfall. To fix this you need to add wetbulbTemp to the 
>>>> WeeWX unit system, the usual approach for this is to add a couple of lines 
>>>> of code to user/extensions.py (refer to Assigning a unit group 
>>>> <http://weewx.com/docs.html/latest/customizing.htm#Assigning_a_unit_group> 
>>>> in the Customization Guide 
>>>> <http://weewx.com/docs.html/latest/customizing.htm>), in your case 
>>>> something like the following should work (untested):
>>>>
>>>> import weewx.units
>>>> weewx.units.obs_group_dict['wetbulbTemp'] = 'group_temperature'
>>>>
>>>> For the WeeWX daemon this will take effect when WeeWX is restarted, but 
>>>> for the purposes of wee_import it should work straight away.
>>>>
>>>> Gary
>>>> On Saturday, 29 July 2023 at 08:36:33 UTC+1 remy.l...@gmail.com wrote:
>>>>
>>>>> *Good morning,*
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *My WeeWX.sdb database works perfectly. I removed all unnecessary 
>>>>> fields with sudo wee_database --drop-columns=XXX,YYY,ZZZ which worked 
>>>>> perfectly.I renamed the field "heatindex1", from the base to 
>>>>> "wetbulbTemp" 
>>>>> with the command: sudo wee_database --rename-column=heatindex1 
>>>>> --to-name=wetbulbTemp. Flawless.The problem is when I try to insert CSV 
>>>>> data into the database using the wee_import.py utility.All fields work on 
>>>>> import except the one renamed to "wetbulbTemp"...If I remove the 
>>>>> wetbulbTemp field from the import configuration file (*.conf), the import 
>>>>> is done without any problem.With the field renamed "wetbulbTemp", I get 
>>>>> the 
>>>>> following message:*
>>>>>
>>>>> Using WeeWX configuration file /etc/weewx/weewx.conf
>>>>> Starting wee_import...
>>>>> A CSV import from source file 
>>>>> '/home/pi/Documents/Bresser7in1/data5.csv' has been requested.
>>>>> The following options will be used:
>>>>>       config=/etc/weewx/weewx.conf, 
>>>>> import-config=/home/pi/Documents/Bresser7in1/csv-Bresser.conf
>>>>>       source=/home/pi/Documents/Bresser7in1/data5.csv, from=None, 
>>>>> to=None
>>>>>       dry-run=True, calc_missing=True, ignore_invalid_data=True
>>>>>       slice=250, interval=conf, date/time_string_format=%Y-%m-%d 
>>>>> %H:%M:%S
>>>>>       delimiter=',', rain=cumulative, wind_direction=[0.0, 360.0]
>>>>>       UV=True, radiation=True
>>>>> 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.
>>>>> This is a dry run, imported data will not be saved to archive.
>>>>> Starting dry run import ...
>>>>> Obtaining raw import data for period 1 ...
>>>>> The following imported field-to-WeeWX field map will be used:
>>>>>       source field 'dateTime' in units 'unix_epoch' --> WeeWX field 
>>>>> 'dateTime'
>>>>>       source field 'barometer' in units 'hPa' --> WeeWX field 
>>>>> 'barometer'
>>>>>       source field 'inTemp' in units 'degree_C' --> WeeWX field 
>>>>> 'inTemp'
>>>>>       source field 'outTemp' in units 'degree_C' --> WeeWX field 
>>>>> 'outTemp'
>>>>>       source field 'inHumidity' in units 'percent' --> WeeWX field 
>>>>> 'inHumidity'
>>>>>       source field 'outHumidity' in units 'percent' --> WeeWX field 
>>>>> 'outHumidity'
>>>>>       source field 'windSpeed' in units 'km_per_hour' --> WeeWX field 
>>>>> 'windSpeed'
>>>>>       source field 'windDir' in units 'degree_compass' --> WeeWX field 
>>>>> 'windDir'
>>>>>       source field 'windGust' in units 'km_per_hour' --> WeeWX field 
>>>>> 'windGust'
>>>>>       source field 'rainRate' in units 'mm_per_hour' --> WeeWX field 
>>>>> 'rainRate'
>>>>>       source field 'rain' in units 'mm' --> WeeWX field 'rain'
>>>>>       source field 'dewpoint' in units 'degree_C' --> WeeWX field 
>>>>> 'dewpoint'
>>>>>       source field 'windchill' in units 'degree_C' --> WeeWX field 
>>>>> 'windchill'
>>>>>       source field 'radiation' in units 'watt_per_meter_squared' --> 
>>>>> WeeWX field 'radiation'
>>>>>       source field 'UV' in units 'uv_index' --> WeeWX field 'UV'
>>>>>       source field 'extraTemp1' in units 'degree_C' --> WeeWX field 
>>>>> 'extraTemp1'
>>>>>       source field 'extraTemp2' in units 'degree_C' --> WeeWX field 
>>>>> 'extraTemp2'
>>>>>       source field 'extraTemp3' in units 'degree_C' --> WeeWX field 
>>>>> 'extraTemp3'
>>>>>       source field 'extraTemp4' in units 'degree_C' --> WeeWX field 
>>>>> 'extraTemp4'
>>>>>       source field 'extraHumid1' in units 'percent' --> WeeWX field 
>>>>> 'extraHumid1'
>>>>>       source field 'extraHumid2' in units 'percent' --> WeeWX field 
>>>>> 'extraHumid2'
>>>>>       source field 'extraHumid3' in units 'percent' --> WeeWX field 
>>>>> 'extraHumid3'
>>>>>       source field 'extraHumid4' in units 'percent' --> WeeWX field 
>>>>> 'extraHumid4'
>>>>>       source field 'wetbulbTemp' in units 'degree_C' --> WeeWX field 
>>>>> 'wetbulbTemp'
>>>>> Raw import data read successfully for period 1.
>>>>> Mapping raw import data for period 1 ...
>>>>> Traceback (most recent call last):
>>>>>    File "/usr/share/weewx/wee_import", line 900, in <module>
>>>>>      hand()
>>>>>    File "/usr/share/weewx/wee_import", line 830, in main
>>>>>      source_obj.run()
>>>>>    File "/usr/share/weewx/weeimport/weeimport.py", line 421, in run
>>>>>      _mapped_data = self.mapRawData(_raw_data, self.archive_unit_sys)
>>>>>    File "/usr/share/weewx/weeimport/weeimport.py", line 981, in 
>>>>> mapRawData
>>>>>      weewx.units.obs_group_dict[_field])
>>>>>    File "/usr/lib/python3.9/collections/__init__.py", line 941, in 
>>>>> __getitem__
>>>>>      return self.__missing__(key) # support subclasses that define 
>>>>> __missing__
>>>>>    File "/usr/lib/python3.9/collections/__init__.py", line 933, in 
>>>>> __missing__
>>>>>      raiseKeyError(key)
>>>>> *KeyError: 'wetbulbTemp'*
>>>>>
>>>>>
>>>>>
>>>>> *I couldn't find any help in the WeeWX documentation on this.What is 
>>>>> happening with this renamed field and what is the solution to integrate 
>>>>> the 
>>>>> CSV data of this field into my modified weewx.sdb database?*
>>>>>
>>>>> Thank you...
>>>>>
>>>> -- 
>>>> 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+...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/weewx-user/dbf90df9-0cee-465d-89b1-86b2c77076ebn%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/weewx-user/dbf90df9-0cee-465d-89b1-86b2c77076ebn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>> 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+...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/weewx-user/43f0c3c7-27aa-4f9f-b8bf-d9e9b911b779n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/weewx-user/43f0c3c7-27aa-4f9f-b8bf-d9e9b911b779n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/6a5aed83-da2d-4e0d-b23b-7904f87469fan%40googlegroups.com.

Reply via email to