I think one important point to keep in mind is that the units used to store the 
observational data in the database and the 'default' units displayed by a skin 
are completely separate. Hold that thought.

The 'default skin units' is perhaps not as obvious or clear cut concept as you 
may think. I would guess that in the vast majority of cases the units used by a 
skin are those specified in skin.conf (nearly every skin.conf I have seen has a 
[Units] [[Groups]] stanza, if not in the skin.conf then overridden from 
weewx.conf). In such cases a tag like $current.outTemp will display the 
temperature in units specified in the [Units] [[Groups]] stanza. Some folks 
might call this a default. If you strip the skin.conf down to nothing (unit 
groups wise) then the default units are US customary, so $current.outTemp will 
display F (this may seem to be a bug, perhaps not for those in the US :) but I 
don't think it is). Some other folks might call this the true default. At the 
end of the day the default probably depends on your point of view.

Now go back to that first thought, the database units. Notice that the defaults 
I just mentioned have nothing to do with the database unit system. So weeWX 
could store temperature in apples but your stripped back default would be F. 
The apples are irrelevant to the presentation layer.

It sounds to me like you are using weeWX to generate a data file that is used 
by an android app to display weather data. It seems to me you have a couple of 
options.

- Generate a fixed units data file and have the user select their units in your 
app. Obviously this has implications for your app but makes the weeWX side of 
things as simple as possible.

- Have weeWX generate the data file in user selectable units. This keeps things 
simple for your app, but complicates the weeWX side of things. At the moment 
the accepted way for users to change units in an extension packaged skin is to 
get the user to override the skin units from weewx.conf (this is largely to 
prevent the user from losing any customisations to the extension when upgrading 
to a new version of the extension). This is the approach taken by my 
SteelSeries skin installer. Ideally the user should be interrogated by the 
extension installer ( ie install.py) as to what units to use (perhaps in the 
same way the user is asked what unit system to display when installing weeWX) 
but install.py is not capable of doing that. Of course another approach is the 
multiple extensions you have created.

Obviously your decision, but if you take the multiple extensions route do you 
then develop an extension for each possible combination of units? I know you 
said it was a workaround so I guess that means multiple extensions is not your 
final solution. I think there is an expectation that a weeWX user will have the 
skills to edit a config file (I think it's up front in the User Manual or on 
the weeWX home page), if that is not what you want to do then I think you need 
to go down the path of the first option.

Gary

Reply via email to