Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

PressTrendVal and PHP question

Discussion and questions about Cumulus weather station software version 1. This section is the main place to get help with Cumulus 1 software developed by Steve Loft that ceased development in November 2014.
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: PressTrendVal and PHP question

Post by mcrossley »

Actually I don't think any of them are correct!

Using the original logic you get an asymmetry between positive and negative values (example using 1dp)....

Code: Select all

 6.0 ... +999 = Rising Very Rapdily
 3.6 ...  5.9 = Rising Quickly
 1.6 ...  3.5 = Rising
 0.2 ...  1.5 = Rising Slowly
 0.1 ...  0.0 = Steady
-0.1 ... -1.4 = Falling Slowly
-1.5 ... -3.4 = Falling
-3.5 ... -5.9 = Falling Quickly
-6.0 ... -999 = Falling Very Rapidly
I think the most understandable way of writing this logic that would also work with 1dp or more would be (using the definitions I found on the Met Office)*...

Code: Select all

$weather_trend = ret_value("presstrend") * 3;
$pressure_trend_text = ($weather_trend >= 0.1) ? 'Rising' : ($weather_trend <= -0.1) ? 'Falling' : '';
$weather_trend = abs($weather_trend);
if ($weather_trend > 6.0)
	$pressure_trend_text .= ' Very Rapidly';
elseif ($weather_trend > 3.5)
	$pressure_trend_text .= ' Quickly';
elseif ($weather_trend > 1.6)
	// Rising or Falling
elseif ($weather_trend >= 0.1)
	$pressure_trend_text .= ' Slowly';
else
	$pressure_trend_text = 'Steady';


*http://www.metoffice.gov.uk/weather/mar ... ssary.html

Rising (or falling) slowly
- Pressure change of 0.1 to 1.5 hPa in the preceding three hours

Rising (or falling)
- Pressure change of 1.6 to 3.5 hPa in the preceding three hours

Rising (or falling) quickly
- Pressure change of 3.6 to 6.0 hPa in the preceding three hours

Rising (or falling) v. rapidly
- Pressure change of more than 6.0 hPa in the preceding three hours

Which is ambiguous if you use more than 1dp, what is +1.52 'Rising Slowly' or 'Rising'? I have assumed that >n.5 jumps to the next higher category.
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: PressTrendVal and PHP question

Post by steve »

Yes, I'd realised that there was an asymmetry to the code in Cumulus if the values were exactly on the boundary values. But it's not really a serious issue, particularly as Cumulus is doing floating point comparisons, so the figures are highly unlikely to actually fall exactly on a boundary (internally). It does perhaps look a little odd externally after rounding. It's the kind of thing that you-know-who might start a very long thread about. Or several threads...
Steve
RayProudfoot
Posts: 3602
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: PressTrendVal and PHP question

Post by RayProudfoot »

Afternoon chaps. Back home after a walk in Lyme Park. :)

Mark, although the Met Office 'rules' are the official ones I much prefer Steve's as they leave less room for ambiguity and have more stages. Also, there's no point in me coding it differently in PHP unless Steve does the same in Cumulus and I don't think he either wants or needs to.

There should be a symmetry and we have that. As you both said it was just the wording that needed changing in my original to make it match Cumulus.

I hope I haven't opened a can of worms. :( There should be a good chance of the code being tested in the next 96 hours with 2 deep depressions moving in with probable big changes up and down in pressure.

I have changed the code now so it should be easy to spot if it agrees with Cumulus.
Cheers,
Ray, Cheshire.

Image
Post Reply