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

MX SQL query

From build 3044 the development baton passed to Mark Crossley. Mark has been responsible for all the Builds since. He has made the code available on GitHub. It is Mark's hope that others will join in this development, but at the very least he welcomes your ideas for future developments (see Cumulus MX Development suggestions).

Moderator: mcrossley

sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: MX SQL query

Post by sfws »

I seem to have stirred up an issue here. But I am left even more confused.
It is windy here, and I'm not climbing up a ladder to disconnect my anemometer for a test.
I have archived off my Cumulus 1 files, so I cannot easily look for past evidence of '---' usage, although I remain positive I saw this.
In the database daily summary table for my old home, 10 Nov 2015 seems to be only day with zero bearings (and '---' direction), but that is not proof as an ex beteljuice function is used by the PHP that loaded the table to convert bearing to direction.
In my MX log for this month, the bearing does go to zero at various times when the wind speed was zero. But I admit I can't spot any 360 bearing.
Maybe Freddie's investigation of the code will resolve this later.
mcrossley wrote: Sun 12 Apr 2020 10:20 pm Must be because the Davis station uses zero for calm anyway?
The Fine Offset console does not contain bearings, it supplies compass direction (but as a number), and Cumulus converts this direction into a bearing. So the station cannot tell Cumulus whether to use 0 or the returned direction for calculating degrees, Cumulus looks at the wind speed to decide that, or it did in Cumulus 1.

In terms of the question that started this topic, the bearings I can have are only 0 and multiples of 22.5, so that simplifies the function Mark proposed in his first post!
laulau wrote: Sun 12 Apr 2020 8:47 pmSome options
Yes, that includes the option Freddie & I were discussing.
mcrossley wrote: Sun 12 Apr 2020 10:20 pm I *thought* I had that option enabled, but I don't, however the bearing definitely goes to zero when calm...
Sounding like the action of the parameter has been reversed.
Mapantz wrote: Sun 12 Apr 2020 8:52 pm I have never seen any dashes. I used to have that option enabled, but I don't anymore.
Suggesting the option has no effect whatsoever.
Mapantz wrote: Sun 12 Apr 2020 10:40 pm It's logging 'N' as it's calm.
So the option being off now does have an effect, but not same as for Mark?
freddie
Posts: 2870
Joined: Wed 08 Jun 2011 11:19 am
Weather Station: Davis Vantage Pro 2 + Ecowitt
Operating System: GNU/Linux Ubuntu 24.04 LXC
Location: Alcaston, Shropshire, UK
Contact:

Re: MX SQL query

Post by freddie »

sfws wrote: Sun 12 Apr 2020 8:31 pm
freddie wrote: Sun 12 Apr 2020 7:38 pm In fact, I will look at the source code tomorrow and come up with a patch for Mark.
Thank you.
Done!
sfws wrote: Sun 12 Apr 2020 8:31 pmAnyway, please no ongoing arguments, we are friends not foes!
I don't see it as an argument - more of a debate. It's how differences get solved. I apologise if I came across as argumentative - I am very passionate about "getting things meteorologically correct" so will always state my case when I think something doesn't quite follow the rules/guidance.
Freddie
Image
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: MX SQL query

Post by mcrossley »

Iirc the "use zero for calm" option was for stations that did not implement that themselves - like the Fine Offset. I do not think its logic has been reversed.

In my log file, the bearing is recorded as zero when the wind speed drops to zero. Note that this is only the average speed and bearing.
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: MX SQL query

Post by sfws »

It is calm this morning. MX is recording a bearing of zero, but direction is displayed as 'N' not as '---' as I saw with Cumulus 1.

Incidentally, N is neither the recent direction, nor the direction my vane is currently pointing (SW my console and look out the window confirm), so Cumulus MX IS DOING PROCESSING on raw data.
To confirm that, I disabled "Use bearing zero when Calm" and then Cumulus MX, my console and my look out of the window all indicated 'WSW'. I enabled it again and MX 3.5.1 went back to 'N'.

I stopped MX, copied data folder of MX back into data folder of Cumulus 1, edited the date formats in today.ini into year last (instead of ISO as used by MX), started Cumulus 1 and there the direction is "---", but all other readings are same. Freddie - I said I remembered seeing '---' in Cumulus 1, well I have just confirmed my elderly memory is still proving reliable.

Did I go back to MX? - that does not matter, but we will see when Freddie's modification to MX is released whether all contributors to this topic start showing unknown direction in calm. And equally importantly, as Freddie said in his proposal for the function change, assign (for those weather stations that report bearings) small non-zero bearings of 1,2, 3, 4, 5, to 'North'.

In the beteljuice supplied function (I looked it up and he attributes it to beeker425 at http://www.weather-watch.com/smf/index. ... 097.0.html), I use with my web pages, a modification I made was to specifically test for zero bearing and assign '---' for that. His original would indeed use 'North' for 0 degrees.

Code: Select all

function windDirVerbose($windBear)
	{ 
		if(!$windBear)return '---'; // added by SFWS
		// user language e.g.North-Northwest
		# Take wind direction value, return the VERBOSE text label based upon 16 point compass -- function by beeker425
		#  see http://www.weather-watch.com/smf/index.php/topic,20097.0.html
		$langWindVerbose = [ // can be used in text for wind direction 
			"North", "North-North-east", "North-east", "East-North-east",
			"East", "East-South-east", "South-east", "South-South-east",
			"South", "South-South-west", "South-west", "West-South-west",
			"West", "West-North-west", "North-west", "North-North-west","True North"];
		return $langWindVerbose[floor((($windBear + 11) / 22.5) % 16 )];  //  beteljuice uses +11 to put in centre of compass range (the .25 of the true value 11.25 would be removed by the floor operation anyway)
	}   // END function windDirVerbose
mcrossley wrote: Mon 13 Apr 2020 12:41 pm Iirc the "use zero for calm" option was for stations that did not implement that themselves - like the Fine Offset. I do not think its logic has been reversed.

In my log file, the bearing is recorded as zero when the wind speed drops to zero. Note that this is only the average speed and bearing.
Just to say, that in Cumulus 1, both average speed and gust directions get reported as '---' in a calm, as well as both bearings going to zero.
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: MX SQL query

Post by mcrossley »

So!....

I'll modify the compass direction to return "-" when the direction is zero as provided by freddie. That will sort the average and gust compass direction.

I found with the WLL, that if the average is > 0, but the latest wind is zero, the station code was returning zero for the direction (the WLL actually sends a null value when calm), but because I did not have the "Use zero when calm" option enabled, this got translated to 360, so it displayed as "N". Enabling the Use zero option also makes the latest direction = 0 when the latest wind = 0.
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: MX SQL query

Post by mcrossley »

OK, ver 3.5.2 is released which has the new compass direction of "-" for bearing zero.

It also implements two new web tags for today/yesterday high gust direction in compass ordinals.
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: MX SQL query

Post by sfws »

mcrossley wrote: Tue 14 Apr 2020 12:20 pm OK, ver 3.5.2 is released which has the new compass direction of "-" for bearing zero.

It also implements two new web tags for today/yesterday high gust direction in compass ordinals.
Thank you for all those.
freddie
Posts: 2870
Joined: Wed 08 Jun 2011 11:19 am
Weather Station: Davis Vantage Pro 2 + Ecowitt
Operating System: GNU/Linux Ubuntu 24.04 LXC
Location: Alcaston, Shropshire, UK
Contact:

Re: MX SQL query

Post by freddie »

mcrossley wrote: Tue 14 Apr 2020 12:20 pm OK, ver 3.5.2 is released which has the new compass direction of "-" for bearing zero.
It's working well - my current conditions page shows this nicely.
calm.png
(not to mention in the banner below - at the time of posting, of course :) )
You do not have the required permissions to view the files attached to this post.
Freddie
Image
sfws
Posts: 1183
Joined: Fri 27 Jul 2012 11:29 am
Weather Station: Chas O, Maplin N96FY, N25FR
Operating System: rPi 3B+ with Buster (full)

Re: MX SQL query

Post by sfws »

freddie wrote: Wed 15 Apr 2020 6:12 amIt's working well - my current conditions page shows this nicely.
I just noticed that on the user interface I still see 'N' for bearing 0.
But yes Freddie, your mod is working well on my snapshot web page.
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: MX SQL query

Post by mcrossley »

sfws wrote: Wed 15 Apr 2020 6:20 am I just noticed that on the user interface I still see 'N' for bearing 0.
On the "Now" page? - Noted...
Post Reply