Page 1 of 1

Rounding of pressure values

Posted: Sun 15 Nov 2020 10:49 pm
by Colin99
I saw the thread back in August when freddie asked about webtag output parameters for rounding (viewtopic.php?f=36&t=18402&p=145783&hil ... es#p145783) and note this is not an easy thing to do due to the number of tags. I would though like to try making an argument for one in particular, and that is pressure.

Although my argument applies more widely, I believe pressure is an extreme case. We currently display pressure in both tables and graphs ("trends") to 2 decimal places. I am sure there is some historic reason for this, but my Davis pressure sensor is quoted with an accuracy of +/-1mb, and I am sure this is fairly common. If we regularly calibrate, then maybe we could achieve a bit better than this, but certainly no better than 0.1mb.

I am worried that any users/recipients/subscribers of this data will come to the conclusion from the incredible precision with which we are quoting pressure values that our pressure accuracy is considerably higher than Davis state. We could (and I do) point out the actual accuracy but then it rather calls into question why we are quoting to 2 decimal places.

If there is a sub-waiting-list for specific output parameters I would like to request that pressure goes on it. Alternatively is there anyone out there that could write a script to take the webtag string, convert to decimal, round it, and convert back to a string? I'm not sure what that would do for the graphs though. Ideally the values should be global.

End of argument!

PS have upgraded to release 3.9.1 and it seems all good so far.

Re: Rounding of pressure values

Posted: Sun 15 Nov 2020 11:52 pm
by Mapantz
As a workaround, you could round the pressure value with js or php?

Edit: Just read about needing a script.

I'm pretty sure it's just a simple calc client side?!

For example; I convert all of the webtags I use to php tags and then upload the file.

This would be in a file called php_tagsT.php, CMX does the processing, and uploads it as php_tags.php:

Code: Select all

<?php $press="<#press>";?>
Then, on you webpage:

Code: Select all

<?php echo floor($press);?>
Ah - Or Marks suggestion below :oops:

Re: Rounding of pressure values

Posted: Mon 16 Nov 2020 12:07 am
by mcrossley
Pressure is displayed by default** to 1 dp for mb and Hpa, and 2 dp for kPa and inHg.

** For Davis VP and VP2 stations it is 2dp and 3dp respectively for some historic reason. But by adding a manual setting to Cumulus.ini [Station] section of

DavisIncrementPressureDP=0

Then Davis stations will also use 1dp and 2dp. Not what you are asking for, but half way there!

I do not understand why this is not the default, then all stations would be consistent - apart from the OS stations that only report whole hPa iirc.

To be honest I had forgotten Davis stations used the extra decimal as I switched it off years ago!

The Ini file already has settings for Wind Gust, Wind, Sunshine Hours decimals. So it would make sense to add pressure and temperature as well at some point.

Personally I find the whole unit hPa graphs too "blocky" for my taste, I prefer the smoother curve I get with 1 dp.

Re: Rounding of pressure values

Posted: Mon 16 Nov 2020 12:12 am
by mcrossley
To do the conversion in JS is easy as JS can treat strings as numbers and vice versa...

Code: Select all

var p = (1*<#press>).toFixed(0);

Re: Rounding of pressure values

Posted: Mon 16 Nov 2020 12:45 pm
by Colin99
Hi guys

Thanks for the suggestions. Server-side processing is next on my list but I will need to learn php first. I could possibly get your offering to work with a bit of playing around Mapantz, or your js suggestion Mark, but for now I like the Davis setting option.

I do actually have a VP2 Pro but was getting everything to 2dp. It's odd because the Davis console displays to 1dp. However your Cumulus ini fix works a treat. Now all my pressure tags and past 7 days graph are to 1dp. I cannot see any downside to this method (unless you can)? That will do nicely thanks! :)

Cheers

Re: Rounding of pressure values

Posted: Mon 16 Nov 2020 1:33 pm
by Colin99
mcrossley wrote: Mon 16 Nov 2020 12:07 am ** For Davis VP and VP2 stations it is 2dp and 3dp respectively for some historic reason. But by adding a manual setting to Cumulus.ini [Station] section of

DavisIncrementPressureDP=0

Then Davis stations will also use 1dp and 2dp. Not what you are asking for, but half way there!

I do not understand why this is not the default, then all stations would be consistent - apart from the OS stations that only report whole hPa iirc.

To be honest I had forgotten Davis stations used the extra decimal as I switched it off years ago!

The Ini file already has settings for Wind Gust, Wind, Sunshine Hours decimals. So it would make sense to add pressure and temperature as well at some point.

Personally I find the whole unit hPa graphs too "blocky" for my taste, I prefer the smoother curve I get with 1 dp.
Just to be clear Mark, I assume the above will round values to 1dp and not truncate?

I agree with your other points too.

Thanks

Re: Rounding of pressure values

Posted: Mon 16 Nov 2020 1:55 pm
by mcrossley
Yes, it rounds values.

A few web tags have a truncate option (primarily indices), but everything else is rounded.

Re: Rounding of pressure values

Posted: Mon 16 Nov 2020 2:00 pm
by mcrossley
Colin99 wrote: Mon 16 Nov 2020 12:45 pm I cannot see any downside to this method (unless you can)? That will do nicely thanks! :)
No downside that I can see, like I say that is what I have always run. Personally I think that should be the default setting, and the ini file setting only used if you want the extra decimals for some reason.

The Davis serial protocol uses thousandths of inches for pressure.