Hi Gary, You got my point and you are also right that “hardcoding” will be probably the best option. Since I am not using default unit I would have to anyway format string and take it out with split() for example but it’s not worth of it.
Sent from my iPhone > On 30 Nov 2021, at 02:34, gjr80 <[email protected]> wrote: > > Because the unit group being applied to snow, group_rain, is set to ‘mm’ > (presumably so that rain appears in the correct/preferred default units) so > $unit.label.snow will result in ‘mm’. > > Gary > >> On Tuesday, 30 November 2021 at 11:12:06 UTC+10 [email protected] wrote: >> That makes sense, but then why not just use $unit.label.snow? >> >>> On Mon, Nov 29, 2021 at 4:57 PM gjr80 <[email protected]> wrote: >> >>> I think, reading between the lines, the issue may be that the OP wants to >>> include something like snow in a WeeWX generated data file to be used by >>> Highcharts, but using cm instead of mm as (seemingly) used for rain. I >>> would expect that instead of passing something like '23 cm' in a single >>> field Highcharts would want the value 23 in one field and 'cm' in another. >>> The former can be obtained (for example) via $day.snow.cm.raw or >>> $day.snow.cm.format(add_label=False) but there is no tag to get the unit >>> label for 'cm' when your default unit for group_rain is mm. The only >>> solution I can think of short of digging into the WeeWX internals is some >>> in-line python code that parses the result of $day.snow.cm. Or hardcoding >>> cm, but that is rather limiting. >>> >>> Gary >>>> On Tuesday, 30 November 2021 at 10:20:02 UTC+10 [email protected] wrote: >>>> Not understanding your question. The $unit tag is designed to retrieve the >>>> reporting unit being used by an observation type. Why would you want to >>>> retrieve something different? >>>> >>>> If you want the value of a type in a different unit, you can do something >>>> like: >>>> >>>> $day.rain.sum.cm >>>> >>>> This will give the rain since midnight in cm. Is this what you are looking >>>> for? >>>> >>>> -tk >>>> >>>> >>>>> On Mon, Nov 29, 2021 at 8:46 AM František Slimařík <[email protected]> >>>>> wrote: >>>> >>>>> Hello, >>>>> >>>>> I have question regarding tag $unit. When I have for example tag >>>>> $unit.label.rain it will show me " mm". Is there any way how to show >>>>> different type of unit in case I want to show snow in my highchart graph >>>>> and use this tag option? Like $unit.label.rain.cm? >>>>> >>>>> Thanks for answer. >>>> >>>>> -- >>>>> 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 [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/weewx-user/6ef88b26-06fb-464f-bee1-0968a91234a4n%40googlegroups.com. >>> >>> -- >>> 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 [email protected]. >> >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/weewx-user/2726ca14-e831-4f1e-9da3-bebebb251df4n%40googlegroups.com. > > -- > You received this message because you are subscribed to a topic in the Google > Groups "weewx-user" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/weewx-user/-cuLPU-mSxM/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/94d6c41a-0657-4eca-a5a8-c34d4c9512e7n%40googlegroups.com. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/B412AA20-B3CC-4AC4-A307-159DD8C17C6E%40gmail.com.
