On Wednesday, 24 May 2017 07:08:21 UTC+10, Ian Boag wrote:
>
> I have it 95% sorted sorted. I go off to the "weather station" website, 
>> pick up the JSON file, mash it round a bit into what weewx is expecting and 
>> bingo.  It feels a bit odd that I read the info in metric then convert in 
>> to US units so weewx can do the conversion back again.
>>
>
Whilst the double conversion won't be an issue as long as it is done 
correctly, there really is no reason why it has to be done that way. The 
fileparse driver is pretty basic and does no conversion, it defaults to 
outputting a US units based packet, so it needs to be fed with data in US 
units. It can be easily changed to output a METRIC or METRICWX unit system 
based packet by changing the following:

            _packet = {'dateTime': int(time.time() + 0.5),
                       'usUnits': weewx.US}

to 

            _packet = {'dateTime': int(time.time() + 0.5),
                       'usUnits': weewx.METRIC}

or

            _packet = {'dateTime': int(time.time() + 0.5),
                       'usUnits': weewx.METRICWX}
 
Details on what units are used in each of METRIC and METRICWX can be found 
here <http://weewx.com/docs/customizing.htm#units>. Watch out for METRIC 
rain - it uses cm not mm!
 

> Just one glitch - I can pick up current rain OK, but the "total rain 
> today" field stays obstinately at zero.  If you look at ians.avmet,nz you 
> will see what I mean. ians.avmet.nz/munn_data is the json file and 
> ians.avmet.nz/obs_data is the pickup file for weewx. 
>
 
Not exactly sure what you mean here. Yes I see RainHourly and RainDaily in 
your JSON data, not sure what you mean by 'current rain'. I guess it is not 
a weeWX issue but with no more details on how you are converting from JSON 
to input for fileparse it is hard to say much.
 

> Does weewx total hourly stuff or do I need to feed it something.  The 
> field in index.html.tmpl is  $day.rain.sum - I have not been feeding it 
> anything ....
>

The driver feeding weeWX needs to provide, as a minimum, the rainfall over 
the period ie weeWX field rain. If the driver is providing loop packets 
every 2.5 seconds the driver needs to place the amount of rainfall that was 
recorded in the 2.5 seconds covered by the packet in the packets rain 
field. Note that the rain field may need to be calculated from a running 
total of some description if that is all that is provided by the PWS, the 
fileparse driver does not do this calculation. The driver may also provide 
the rainfall rate in the rainRate field which is the rainfall per unit of 
time. This can be in/hr, cm/hr or mm/hr depending on the unit system used 
in the driver output. I said 'may also provide' as if the driver does not 
provide rainRate weeWX is able to derive it from the rainfall data. There 
is no need for any other rain related data to be emitted by the driver, in 
fact on a standard weeWX install any other rain related data eg dayRain 
from the driver will be ignored. Remember, I am talking about driver 
output; depending on the driver it may use some other rain related data to 
determine the two rain fields I mentioned.

Once weeWX has the rain and rainRate data in the database, weeWX will 
calculate (as required) any aggregates from this data eg rain since 
midnight, rain since 1st of the month etc. In the case you cite 
$day.rain.sum comes from the rain summary data that weeWX generates/updates 
each time an archive record is is saved to database.

Gary

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to