Hello Tom, On Sunday, March 8, 2020 at 10:33:06 PM UTC-4, Tom Keffer wrote: > > All units within a packet must use one of the three weewx unit systems, > US, METRIC, or METRICWX. You can change from packet to packet, but not > within a packet. >
Yes, that's what I understand from looking at many drivers. > > You could emit a different packet for each observation type, but you could > miss out on some calculations. For example, to calculate dewpoint, you need > outside temperature plus outside humidity. If they are in separate packets, > StdWXCalculate can't perform the calculation. > Thanks for mentioning that. The way the station supports changing units is only for one unit type, not generally for individual fields. Here's a screen shot of the units selection admin screen: So for example, if temperature is changed to degrees C, then all temperature fields with return that unit. Here's a list of all the possible units available: - Rain: inches or mm - Temperature: degrees F or degrees C - Wind speed: mph, kph, meters/second, knots - Pressure: inches Hg, Millibar, Kilopascals, Hectopascals - Altitude: feet or meters - Visibility: miles, meters, kilometers, feet - Rain rate: inches/hour or mm/hour Based on the different metric units this station returns, it looks like the METRICWX type is better most of the time. An exception would be wind in kph would best use the METRIC unit type. > Make sure you read the section *Porting to new hardware > <http://www.weewx.com/docs/customizing.htm#porting>* in the Customization > Guide. > Thanks for mentioning that page. I had reviewed it several times before I started work on the driver but there were a few things I'd missed. -Bill > -tk > > On Sun, Mar 8, 2020 at 12:57 PM Bill Burton <[email protected] > <javascript:>> 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 [email protected] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/weewx-development/1142ae3a-c6c4-47d6-af01-33de21b2d5fd%40googlegroups.com >> >> <https://groups.google.com/d/msgid/weewx-development/1142ae3a-c6c4-47d6-af01-33de21b2d5fd%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/a9527845-51df-4645-9e85-cb357f8d61a6%40googlegroups.com.
