Unit conversion rule in conf file

60 views
Skip to first unread message

engolling

unread,
Oct 10, 2019, 6:26:59 PM10/10/19
to weewx-user
Hello,

I'm stuck at a relativley simple problem of unit conversion in combination with the used neowx skin.

In the weewx.conf the standard report section is looking like this:
    [[StandardReport]]
       
# See the customizing guide to change the units, plot types and line
       
# colors, modify the fonts, display additional sensor data, and other
       
# customizations. Many of those changes can be made here by overriding
       
# parameters, or by modifying templates within the skin itself.
       
       
# The StandardReport uses the 'Standard' skin, which contains the
       
# images, templates and plots for the report.
        skin
= neowx
       
[[[Units]]]
           
[[[[Groups]]]]
                group_altitude
= meter
                group_speed2
= km_per_hour2
                group_pressure
= mbar
                group_rain
= mm
                group_rainrate
= mm_per_hour
                group_temperature
= degree_C
                group_degree_day
= degree_C_day
                group_speed
= km_per_hour
   

and in the skin.conf like this:
    [[Groups]]
       
# For each group of measurements, this section sets what units to
       
# use for it.
       
# NB: The unit is always in the singular. I.e., 'mile_per_hour',
       
# NOT 'miles_per_hour'

        group_altitude    
= meter                # Options are 'foot' or 'meter'
        group_degree_day  
= degree_C_day         # Options are 'degree_F_day' or 'degree_C_day'
        group_direction    
= degree_compass
        group_moisture    
= centibar
        group_percent      
= percent
        group_pressure    
= hPa                  # Options are 'inHg', 'mmHg', 'mbar', or 'hPa'
        group_radiation    
= watt_per_meter_squared
        group_rain        
= mm                   # Options are 'inch', 'cm', or 'mm'
        group_rainrate    
= mm_per_hour          # Options are 'inch_per_hour', 'cm_per_hour', or 'mm_per_hour'
        group_speed        
= km_per_hour          # Options are 'mile_per_hour', 'km_per_hour', 'knot', or 'meter_per_second'
        group_speed2      
= km_per_hour2         # Options are 'mile_per_hour2', 'km_per_hour2', 'knot2', or 'meter_per_second2'
        group_temperature  
= degree_C             # Options are 'degree_F' or 'degree_C'
        group_uv          
= uv_index
        group_volt        
= volt
        group_length      
= cm

       
# The following are used internally and should not be changed:
        group_count        
= count
        group_interval    
= minute
        group_time        
= unix_epoch
        group_elapsed      
= second

   
[[StringFormats]]
       
# This section sets the string formatting for each type of unit.

        centibar          
= %.0f
        cm                
= %.2f
        cm_per_hour        
= %.2f
        degree_C          
= %.1f
        degree_F          
= %.1f
        degree_compass    
= %.0f
        foot              
= %.0f
        hPa                
= %.1f
        hour              
= %.1f
        inHg              
= %.3f
        inch              
= %.2f
        inch_per_hour      
= %.2f
        km_per_hour        
= %.0f
        km_per_hour2      
= %.1f
        knot              
= %.0f
        knot2              
= %.1f
        mbar              
= %.1f
        meter              
= %.0f
        meter_per_second  
= %.1f
        meter_per_second2  
= %.1f
        mile_per_hour      
= %.0f
        mile_per_hour2    
= %.1f
        mm                
= %.2f
        mmHg              
= %.1f
        mm_per_hour        
= %.1f
        percent            
= %.0f
        second            
= %.0f
        uv_index          
= %.1f
        volt              
= %.1f
        watt_per_meter_squared
= %.0f
        NONE              
= "   N/A"

   
[[Labels]]
       
# This section sets a label to be used for each type of unit.

        centibar          
= " cb"
        cm                
= " cm"
        cm_per_hour      
= " cm/h"
        degree_C          
=  " °C"
        degree_F          
=  " °F"
        degree_compass    
=  " °"
        foot              
= " feet"
        hPa              
= " hPa"
        inHg              
= " inHg"
        inch              
= " in"
        inch_per_hour    
= " in/h"
        km_per_hour      
= " km/h"
        km_per_hour2      
= " km/h"
        knot              
= " knots"
        knot2            
= " knots"
        mbar              
= " mBar"
        meter            
= " meter"
        meter_per_second  
= " m/s"
        meter_per_second2
= " m/s"
        mile_per_hour    
= " mph"
        mile_per_hour2    
= " mph"
        mm                
= " mm"
        mmHg              
= " mmHg"
        mm_per_hour      
= " mm/h"
        percent          
= "  %"
        volt              
= " V"
        watt_per_meter_squared
= " W/m²"
        day              
= " Tag",    " Tage"
        hour              
= " Stunde",   " Stunden"
        minute            
= " Minute", " Minuten"
        second            
= " Sekunde", " Sekunden"
        NONE              
= ""

   
[[TimeFormats]]
       
# This section sets the string format to be used for each time scale.
       
# The values below will work in every locale, but may not look
       
# particularly attractive. See the Customization Guide for alternatives.

        day        
= %X
        week      
= %X (%A)
        month      
= %x %X
        year      
= %x %X
        rainyear  
= %x %X
        current    
= %x %X
        ephem_day  
= %X
        ephem_year
= %x %X

   
[[Ordinates]]
       
# The ordinal directions. The last one should be for no wind direction
        directions
= N, NNO, NO, ONO, O, OSO, SO, SSO, S, SSW, SW, WSW, W, WNW, NW, NNW, N/A

   
[[DegreeDays]]
       
# This section sets the base temperatures used for the calculation
       
# of heating and cooling degree-days.

       
# Base temperature for heating days, with unit:
        heating_base
= 65, degree_F
       
# Base temperature for cooling days, with unit:
        cooling_base
= 65, degree_F

   
[[Trend]]
        time_delta
= 10800  # 3 hours
        time_grace
= 300    # 5 minutes

###############################################################################

It's the normal neowx skin conf a bit extended and translated to German.

If I look at the output page here http://wetter2.kuntn-forum.de/index.html the wind speed is still in m/s but I want it to be in km/h - I checked the .confs twice  - I don't find my mistake.
Overiding the unit with .km_per_hour in the template works.

Does anybody have an idea what could be wrong?

Beste regards,
engolling

gjr80

unread,
Oct 10, 2019, 7:14:17 PM10/10/19
to weewx-user
The other side of the coin is the actual tag that is used in the template. For example, $current.windSpeed will show the current archive record wind speed formatted/converted as per weewx.conf and skin.conf but $current.windSpeed.knot will always display the current archive record wind speed in knots. It would be unusual to find such a tag with hard coded units in a properly developed customisable skin but who knows.

WeeWX 3.9.0 introduced the [StdReport] [[Defaults]] stanza and defaults.py for setting default units (and formats and other things) but in your case since you have an appropriate override in [StdReport] [[StandardReport]] this should not be the cause of your problem.

Gary

engolling

unread,
Oct 11, 2019, 12:17:34 PM10/11/19
to weewx-user
Hallo Gary,

thank you very much.
As so often you are my last hope. The last point that WeeWx 3.9.0. introduced the new settings was the right hint. I compared my WeeWx conf files with the newest once and I saw this was missing. I probably have made something wrong when updating the software.

Now I fixed it and it works as expected :)

Best regards,
Stefan
Reply all
Reply to author
Forward
0 new messages