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

Magnetic Bearings

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Magnetic Bearings

Post by beteljuice »

The beteljuice is not going to get involved with any arguments but ........

Weather data (direction) should always be reported in degrees true.
Some of you have a desire / need to report wind direction degrees MAGNETIC - this shouldn't really be 'published' or on a 'weather' page.

So, for those with a need to create some sort of MAGNETIC direction 'advisory', and have their wind vane aligned 'true North', and are using <#webtags> in their 'advisory' template .....

In the <head> section of your <#webtags> Template page:

Code: Select all

<script type="text/javascript">
var mag_deviation = 24;      // difference between 'local' 360 TRUE North and MAGNETIC North
                             // +ve for True is East of Mag N, -ve for True is West of Mag N

// function to convert degrees True to degrees MAGNETIC
 function toMAG(deg, subvert){
	newDeg = deg - mag_deviation;
	if(newDeg < 1){ newDeg = newDeg +360;} // will happen with +ve mag_deviation
	if(newDeg > 360){newDeg = newDeg -360;} // will happen with -ve mag_deviation
// cosmetic 'default' - ANY (logical true) value for 'subvert' will return a number for further processing
	if(!subvert) {newDeg += "&deg;M";} // may be commented out if not required
	
	return newDeg;
} // END function toMAG
</script>
Example html:

Code: Select all

Current wind direction is <script>document.write(toMAG(<#bearing));</script><noscript><#bearing>&deg; true</noscript>
Say the current wind direction is 45 true, the above example would output:

Current wind direction is 21°M (JavaScript enabled browser)

Current wind direction is 45° true (JavaScript DISabled browser)

An advanced codester may wish to use the above simple function together with some sort of ajax routine using realtime.txt or whatever - you're on your own :lol:

Some interesting reading on MAGNETIC North:

http://en.wikipedia.org/wiki/North_Magnetic_Pole
http://en.wikipedia.org/wiki/Magnetic_declination
Image
......................Imagine, what you will KNOW tomorrow !
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: Magnetic Bearings

Post by mcrossley »

Now why did I think this post would be about frictionless levitation bearings? :lol:
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Magnetic Bearings

Post by beteljuice »

Funnily enough the beteljuice experimented with supermagnets (they bite) and Diamagnetic Levitation some years ago - still got the magnets - great fun.

Especially with todays body piercings :mrgreen: :clap:
Image
......................Imagine, what you will KNOW tomorrow !
41south
Posts: 70
Joined: Mon 04 Apr 2011 11:35 pm
Weather Station: 1-wire Windblown solution
Operating System: Win XP
Location: Wellington, NZ
Contact:

Re: Magnetic Bearings

Post by 41south »

supermagnets (they bite)
They sure do, I've had marks left on fingers to prove it. :roll:
Image
Post Reply