Because tilt can be a negative number I think we have to rule out group_direction which I think has a range of 0 to 360. Not sure about group_angle, do you know if it allows for positive and negative angles?
Craig On Saturday, September 23, 2023 at 6:30:28 PM UTC+12 gjr80 wrote: > Remember, unit groups are for picking an appropriate unit for a > field/observation (including allowing for conversion between applicable > units) and providing a suitable format and label. Your description brings > to mind two possible suitable unit groups; group_direction and group_angle. > Both of these unit groups support fields/observations in degrees ( > degree_compass for group_direction and degree_angle for group_angle. Both > provide (default) unit labels of the degree symbol, both offer similar > (default) formats (%03.0f v %02.0f). group_angle facilitates unit > conversion between degrees and radians, which may or may not be something > you use now or in the future, group_direction does not support this > conversion. > > We tend to re-use unit groups where we can, only creating new unit groups > where there is no other suitable unit group. Remember, default unit group > formats and labels are only defaults and can be altered or overridden in a > tag using .format() (eg for tilt you might want to always display a sign > and format to one decimal place so you might decide to alter the default or > override the default format using .format() with the format string '%+02.1 > '). > > Gary > On Saturday, 23 September 2023 at 14:40:36 UTC+10 craig.y...@gmail.com > wrote: > >> Signal4 and Signal 5 are sensor tilt measurements in degrees. For >> example, if the sensor is tilted 1.5 degrees in the N/S direction the value >> for Signal4 = 1.5 degrees. Looking at units.py and defaults.py I see >> groups for degrees temperature, degrees direction, but not degrees tilt. >> Should a new group "group-tilt" be added through the driver or should this >> be added to weewx files to be made available to everyone? >> >> On Saturday, September 23, 2023 at 4:06:25 PM UTC+12 Craig Young wrote: >> >>> I will add the assignments in the driver. >>> >>> On Saturday, September 23, 2023 at 12:38:22 PM UTC+12 Tom Keffer wrote: >>> >>>> Good advice! >>>> >>>> On Fri, Sep 22, 2023 at 5:35 PM gjr80 <gjrod...@gmail.com> wrote: >>>> >>>>> The other other variation on Tom's advice to use extensions.py, >>>>> particularly if you are (still keen on) writing your own driver, is to >>>>> include the unit group assignments in the driver file. They statements >>>>> only >>>>> need to be somewhere where they are executed each time WeeWX starts. If >>>>> the >>>>> fields are inextricably linked to the driver having everything in one >>>>> place >>>>> can be of benefit. I've used this approach with some of the drivers I >>>>> have >>>>> written. >>>>> >>>>> Gary >>>>> >>>>> On Saturday, 23 September 2023 at 10:11:16 UTC+10 tke...@gmail.com >>>>> wrote: >>>>> >>>>>> Exactly. >>>>>> >>>>>> Or, alternatively, you can assign them to appropriate unit groups >>>>>> <http://www.weewx.com/docs/customizing.htm#Assigning_a_unit_group> >>>>>> in the file user/extensions.py: >>>>>> >>>>>> *import weewx.units* >>>>>> >>>>>> *weewx.units.obs_group_dict['signal1'] = 'group_radiation'* >>>>>> *weewx.units.obs_group_dict['signal2'] = 'group_temperature'* >>>>>> *weewx.units.obs_group_dict['signal3'] = 'group_radiation'* >>>>>> >>>>>> >>>>>> Then you would not need to specify a format and label. It would also >>>>>> allow you to do things like >>>>>> >>>>>> *The temperature is $current.signal2.degree_C >>>>>> ($current.signal2.degree_F)* >>>>>> >>>>>> >>>>>> to publish the temperature in both ºC and ºF. >>>>>> >>>>>> -tk >>>>>> >>>>>> On Fri, Sep 22, 2023 at 4:38 PM Craig Young <craig.y...@gmail.com> >>>>>> wrote: >>>>>> >>>>>>> Thanks Tom. Signal1 for my station is the signal voltage from a >>>>>>> pyrgometer. Signal2 is the temperature of the pyrgometer sensor (C) >>>>>>> and >>>>>>> Signal3 is the long wave intensity (W/m2) calculated by the datalogger. >>>>>>> So >>>>>>> if I understand correctly, the weewx engine will pass these values >>>>>>> untouched through the various services and add to the DB as real >>>>>>> numbers. >>>>>>> I can then deal with them manually when creating the report. >>>>>>> >>>>>>> On Saturday, September 23, 2023 at 11:00:54 AM UTC+12 Tom Keffer >>>>>>> wrote: >>>>>>> >>>>>>>> Signals are for ill-defined measurements. >>>>>>>> >>>>>>>> Unit groups exist for two reasons: >>>>>>>> >>>>>>>> 1. To pick an appropriate unit for a type of measurement. For >>>>>>>> example, ºC for temperatures. >>>>>>>> 2. To pick an appropriate format and label. >>>>>>>> >>>>>>>> Signals don't fit neatly into these reasons. They don't take a >>>>>>>> unit, and it's not obvious what format and what label they should use. >>>>>>>> So, >>>>>>>> they were left out of units.py and defaults.py. >>>>>>>> >>>>>>>> You can use the signal types without adding them to a unit group. >>>>>>>> You just won't be able to convert them to a different unit (which they >>>>>>>> don't have anyway), and there will be no automatic formatting and >>>>>>>> labelling. If you need a format, use a .format() suffix. If you need a >>>>>>>> format, just add it on. For example: >>>>>>>> >>>>>>>> *$current.signal1.format("%d") widgets* >>>>>>>> >>>>>>>> >>>>>>>> Alternatively, if your signal is actually some kind of counter, you >>>>>>>> could assign them to group_count. Then they would use "%d" for the >>>>>>>> format, >>>>>>>> and an empty string for the label. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Fri, Sep 22, 2023 at 3:22 PM Craig Young <craig.y...@gmail.com> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> In the wview_extended.py schema there is a group of types for >>>>>>>>> signals (signal1, signal2, .. signal8) and stored in the DB as reals. >>>>>>>>> I >>>>>>>>> looked in units.py but did not see signals listed. >>>>>>>>> >>>>>>>>> On Saturday, September 23, 2023 at 9:40:17 AM UTC+12 Craig Young >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> What units group do the observation type Signals fall under? >>>>>>>>>> Or, if I use a signal do I need to update a configuration file to >>>>>>>>>> place it >>>>>>>>>> into a units group. >>>>>>>>>> >>>>>>>>> -- >>>>>>>>> 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/b9fa5024-38c9-4d95-8e4b-5c9bb4f0ddb8n%40googlegroups.com >>>>>>>>> >>>>>>>>> <https://groups.google.com/d/msgid/weewx-user/b9fa5024-38c9-4d95-8e4b-5c9bb4f0ddb8n%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/2dd9fe34-ffde-4e8f-aaf6-b205009b76a7n%40googlegroups.com >>>>>>> >>>>>>> <https://groups.google.com/d/msgid/weewx-user/2dd9fe34-ffde-4e8f-aaf6-b205009b76a7n%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/bfef0c77-5e59-4d78-b1a8-f557b0dddaa6n%40googlegroups.com >>>>> >>>>> <https://groups.google.com/d/msgid/weewx-user/bfef0c77-5e59-4d78-b1a8-f557b0dddaa6n%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/e13fd40d-e185-410a-853e-70eb1d2f02acn%40googlegroups.com.