Since you are writing the driver, have you considered performing the necessary conversions so that the driver returns US or metric (i.e., one or the other, not a mix)?
> On Mar 8, 2020, at 12:57 PM, Bill Burton <bburton...@gmail.com> wrote: > > > Hello, > > I'm implementing a driver for the Columbia Weather Systems MicroServer that > supports a variety of their weather stations including the Pulsar 600. So far > I have the driver polling the station reliably under WeeWX 3.9.2 under Python > 2.7 and 4.0.0b13 under Python 3.6. > > However, the issue I'm trying to resolve is the station can return a mix of > US and metric units for the different fields yet a loop packet can only > return one unit type. So, what is the best way to return a record that could > be a mix of unit types? Note that I'm requesting the extended XML format > which returns the unit type for each field. The following are examples of > these records, first US/Imperial followed by an all metric record: > > <oriondata version='1.1' station='US Units 1 formatted'> > <meas name='mtSampTime'>2020/02/18 03:17:09</meas> > <meas name='mtTemp1' unit='degreeF' >7.7</meas> > <meas name='mtWindChill' unit='degreeF' >7.7</meas> > <meas name='mtHeatIndex' unit='degreeF' >8.0</meas> > <meas name='mtDewPoint' unit='degreeF' >0.4</meas> > <meas name='mtDegreeDay' unit='degreeF' >5237.3</meas> > <meas name='mtDensityAltitude' unit='feetAlt' >-3759</meas> > <meas name='mtAvgTempToday' unit='degreeF' >9.0</meas> > <meas name='mtWetBulbGlobeTemp' unit='degreeF' >26.4</meas> > <meas name='mtSaturatedVaporPressure' unit='inchesHg' >0.06</meas> > <meas name='mtVaporPressure' unit='inchesHg' >0.05</meas> > <meas name='mtDryAirPressure' unit='inchesHg' >30.05</meas> > <meas name='mtDryAirDensity' unit='poundsPerFt3' >0.0853</meas> > <meas name='mtAbsoluteHumidity' unit='poundsPerFt3' >0.0001</meas> > <meas name='mtAirDensityRatio' unit='percent' >1</meas> > <meas name='mtAdjustedAltitude' unit='feetAlt' >-3298</meas> > <meas name='mtSAECorrectionFactor'>0.908</meas> > <meas name='mtWetAirDensity' unit='poundsPerFt3' >0.0854</meas> > <meas name='mtWetBulbTemp' unit='degreeF' >7.7</meas> > <meas name='mtEvapotranspiration' unit='inchesRain' >0.0049</meas> > <meas name='mtRelHumidity' unit='percent' >71</meas> > <meas name='mtWindSpeed' unit='mph' >0.4</meas> > <meas name='mtRawWindDir' unit='degrees' >0</meas> > <meas name='mtAdjWindDir' unit='degrees' >0</meas> > <meas name='mt3SecRollAvgWindSpeed' unit='mph' >0.4</meas> > <meas name='mt3SecRollAvgWindDir' unit='degrees' >0</meas> > <meas name='mt2MinRollAvgWindSpeed' unit='mph' >0.6</meas> > <meas name='mt2MinRollAvgWindDir' unit='degrees' >346</meas> > <meas name='mt10MinRollAvgWindSpeed' unit='mph' >0.8</meas> > <meas name='mt10MinRollAvgWindDir' unit='degrees' >31</meas> > <meas name='mt60MinRollAvgWindSpeed' unit='mph' >0.9</meas> > <meas name='mt60MinRollAvgWindDir' unit='degrees' >60</meas> > <meas name='mt60MinWindGustDir' unit='degrees' >244</meas> > <meas name='mt60MinWindGustSpeed' unit='mph' >3.0</meas> > <meas name='mt60MinWindGustTime'>2020/02/18 02:46:45</meas> > <meas name='mt10MinWindGustDir' unit='degrees' >134</meas> > <meas name='mt10MinWindGustSpeed' unit='mph' >1.8</meas> > <meas name='mt10MinWindGustTime'>2020/02/18 03:11:33</meas> > <meas name='mt2MinWindGustDir' unit='degrees' >294</meas> > <meas name='mt2MinWindGustSpeed' unit='mph' >1.4</meas> > <meas name='mt2MinWindGustTime'>2020/02/18 03:16:01</meas> > <meas name='mtRainToday' unit='inchesRain' >0.0000</meas> > <meas name='mtRainThisWeek' unit='inchesRain' >0.0031</meas> > <meas name='mtRainThisMonth' unit='inchesRain' >0.6756</meas> > <meas name='mtRainThisYear' unit='inchesRain' >3.0556</meas> > <meas name='mtRainRate' unit='inchesPerHour' >0.0000</meas> > <meas name='mtRainLastHr' unit='inchesPerHour' >0.0000</meas> > <meas name='mtPrecipType'>0.000</meas> > <meas name='mtRawBaromPress' unit='inchesHg' >30.09</meas> > <meas name='mtAdjBaromPress' unit='inchesHg' >30.09</meas> > <meas name='mtPressureTendency' unit='unitless_0' >0</meas> > <meas name='mtTemp_2' unit='degreeF' >32.8</meas><!-- water temp --> > </oriondata> > > <oriondata version='1.1' station='Metric Units 1 formatted'> > <meas name='mtSampTime'>2020/02/18 03:19:25</meas> > <meas name='mtWindChill' unit='degreeC' >-17.8</meas> > <meas name='mtDegreeDay' unit='degreeC' >2891.8</meas> > <meas name='mtAvgTempToday' unit='degreeC' >-12.8</meas> > <meas name='mtEvapotranspiration' unit='mmRain' >-0.041</meas> > <meas name='mtWindSpeed' unit='kmPerHour' >2.8</meas> > <meas name='mtRawWindDir' unit='degrees' >101</meas> > <meas name='mtAdjWindDir' unit='degrees' >101</meas> > <meas name='mt3SecRollAvgWindSpeed' unit='kmPerHour' >2.7</meas> > <meas name='mt3SecRollAvgWindDir' unit='degrees' >98</meas> > <meas name='mt2MinRollAvgWindSpeed' unit='kmPerHour' >1.5</meas> > <meas name='mt2MinRollAvgWindDir' unit='degrees' >155</meas> > <meas name='mt10MinRollAvgWindSpeed' unit='kmPerHour' >1.4</meas> > <meas name='mt10MinRollAvgWindDir' unit='degrees' >80</meas> > <meas name='mt60MinRollAvgWindSpeed' unit='kmPerHour' >1.5</meas> > <meas name='mt60MinRollAvgWindDir' unit='degrees' >62</meas> > <meas name='mt60MinWindGustDir' unit='degrees' >100</meas> > <meas name='mt60MinWindGustSpeed' unit='kmPerHour' >2.8</meas> > <meas name='mt60MinWindGustTime'>2020/02/18 03:19:25</meas> > <meas name='mt10MinWindGustDir' unit='degrees' >100</meas> > <meas name='mt10MinWindGustSpeed' unit='kmPerHour' >2.8</meas> > <meas name='mt10MinWindGustTime'>2020/02/18 03:19:25</meas> > <meas name='mt2MinWindGustDir' unit='degrees' >100</meas> > <meas name='mt2MinWindGustSpeed' unit='kmPerHour' >2.8</meas> > <meas name='mt2MinWindGustTime'>2020/02/18 03:19:25</meas> > <meas name='mtRainToday' unit='mmRain' >0.000</meas> > <meas name='mtRainThisWeek' unit='mmRain' >0.000</meas> > <meas name='mtRainThisMonth' unit='mmRain' >17.018</meas> > <meas name='mtRainThisYear' unit='mmRain' >77.470</meas> > <meas name='mtRainRate' unit='mmPerHour' >0.000</meas> > <meas name='mtRainLastHr' unit='mmPerHour' >0.000</meas> > <meas name='mtPressureTendency' unit='unitless_0' >0</meas> > </oriondata> > > My first inclination is to split up the fields into separate loop packets - > one packet for US/Imperial measurements and a second packet for metric > measurements then yield each one depending on availability. Does this sound > like a reasonable approach or is there a better one? > > However, some conversions will be required for metric as some measurements > such as wind speed can be returned in different units being one of kph or > meters per second. Otherwise, wind speed could be returned as mph or knots. > > One issue is I haven't been able to find any definitive documentation as to > all the fields a driver is supposed to output and what units are expected for > US vs. metric packets. So any pointers on fields and their definitions would > be helpful. > > If there are any existing drivers that handle a mixture of units in a similar > way that I could reference, that would be very helpful to know. > > Thanks for any input, > -Bill > -- > You received this message because you are subscribed to the Google Groups > "weewx-development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to weewx-development+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-development/1142ae3a-c6c4-47d6-af01-33de21b2d5fd%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "weewx-development" group. To unsubscribe from this group and stop receiving emails from it, send an email to weewx-development+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/AA641F13-A3D0-43B3-9D27-8FA89E15CBB9%40johnkline.com.