I hope this is not a real example you are suggesting - part_per_million would be a concentration, which already has an implied volume component according to whether it is in air, water etc. A unit of part_per_million_per_cubic_meter does not make any sense to me. </pedantic>
On Wednesday, 18 January 2023 at 7:31:52 pm UTC+10 steep...@btinternet.com wrote: > Gary, > Follow up question from me in a similar vein. What is the correct way to > add a completely new measurement group to WeeWX, for example > part_per_million_per_cubic_meter? > Ian > > Sent from my iPad. > > On 17 Jan 2023, at 05:20, gjr80 <gjrod...@gmail.com> wrote: > > If you add a new observation to the database you need to tell WeeWX what > unit group it belongs to in order to be able to effectively use the > formatting and unit conversion capabilities of the WeeWX tag system in > reports. For example, if you add a field that is a pressure once WeeWX > knows the new field is a pressure WeeWX knows what default formatting to > apply, the correct unit label and you can use the formatting and unit > conversion aspects of the tag system to change the format/convert units in > a WeeWX report template. If WeeWX does not know what unit group the > observation belongs to you just get the raw value from the database (which > is typically a float with many decimal places - ie what you are seeing now). > > > There are a number of ways to assign an observation to a unit group. In > your case the easiest approach is to add a few lines of code to > /home/weewx/bin/user/extensions.py (or /usr/share/weewx/user/extensions.py > if you installed WeeWX as a package). Try adding the following to the > bottom of extensions.py: > > import weewx.units > weewx.units.obs_group_dict['waterTemp'] = 'group_temperature' > weewx.units.obs_group_dict['tideHeight'] = 'group_length' > > (group_temperature was the obvious choice for waterTemp; tideHeight could > be group_length, group_altitude, group_rain or group_distance. The > deciding factor here is the available units for each group - if you look at > the Units <http://weewx.com/docs/customizing.htm#units> appendix to the > Customisation Guide you will see what I mean) > > You will need to restart WeeWX for the changes to take effect. The > extensions.py code is run at WeeWX startup and the above lines will make > the appropriate unit group assignments for your new fields. You should now > be able to use tags based on waterTemp and tideHeight in your reports. > You will find some further info on assigning unit groups in the Customising > units and unit groups > <http://weewx.com/docs/customizing.htm#customizing_units> section of the > Customisation Guide. You will also find information on the WeeWX tag system > in the Tags <http://weewx.com/docs/customizing.htm#Tags> section of the > Customisation Guide. > > A couple of notes about units. > > For the WeeWX tag system to correctly and consistently display observation > values and units you need to ensure the data you are adding to the database > is in the correct units. How you do this depends on how you are inserting > data into the database. If you are using a WeeWX service to augment loop > packets (the preferred approach) then your service needs to take cognisance > of the unit system (ie WeeWX field usUnits) of the loop packet being > augmented and add waterTemp and tideHeight to the loop packet using the > appropriate units for the unit group each observation belongs to for the > unit system used by the loop packet. For example, if the loop packet uses > US customary units (ie usUnits = 0) then waterTemp would need to be in > Fahrenheit and tideHeight in inches. Once you do this WeeWX takes care of > everything else. You will find information on the unit systems, unit groups > and units used by WeeWX in the Units > <http://weewx.com/docs/customizing.htm#units> appendix to the > Customisation Guide. > > If you are directly inserting data in the WeeWX database (not the > preferred approach) then it is up to you to ensure that the values are > inserted using units applicable to the database unit system and the unit > group used for each observation. > > Apologies for the long response but the WeeWX tag/unit/formatting system > has a lot of moving parts and you need to have them all correctly > configured or you will have problems. > > Gary > On Tuesday, 17 January 2023 at 07:19:24 UTC+10 ja...@runser.net wrote: > >> Incremental progress. As described above but with the addition of a >> restart I have data in the statistics section but still N/A for Water Temp >> in "Current Conditions". Further, the data in statistics is formatted as >> "00.000000" instead of the hoped-for "00.00 °F". I've walked through the >> template and inc files but still can't find the right building blocks. I >> even tried changing the waterTemp column from a double to a double(4,2) but >> am still getting all the extra zeros. >> >> On Monday, January 16, 2023 at 2:16:12 PM UTC-5 James Runser wrote: >> >>> I'm trying to integrate a home-built tide and temperature monitor into >>> weewx (configured and working without issue with an Acurite Atlas). I'm >>> using a MySQL DB and tried simply inserting my data (waterTemp, tideHeight) >>> into archive. I use current timestamp, usUnits and 10 for the required >>> interval values and let the remaining columns default to null ( except - >>> duh - waterTemp and tideHeight). >>> >>> The data are written without issue but I'm never seeing the results in >>> the Seasons report - I chose waterTemp as the learning value since the >>> skin.conf already had a reference to water temp. >>> >>> My thinking is that my data is not returned by the report engine - >>> based, perhaps - on timestamp? Is there a better way to hook net new data >>> into the flow? I do in fact see the waterTemp tag in the current conditions >>> box that was enabled via current.inc. - the issue is that the value is >>> always N/A. I haven't dug deeply enough to figure out where the actual >>> native Weewx insert is done but am wary of the effort required to >>> piggy-back on that process. >>> >>> Advice or suggestions appreciated but a solid answer would not be kicked >>> out of bed for eating crackers ;) >>> >>> >>> >>> -- > 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 weewx-user+...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/f7048253-f8ff-4c85-a838-369dcd22db25n%40googlegroups.com > > <https://groups.google.com/d/msgid/weewx-user/f7048253-f8ff-4c85-a838-369dcd22db25n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > -- 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 weewx-user+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/c45188de-a33e-4e1a-a994-822d6f826aedn%40googlegroups.com.