Sandaysoft

Support forum for Cumulus weather station software
It is currently Fri May 24, 2013 11:06 pm
Please click here before posting. Help me to help you!
Useful Links: Cumulus FAQ • Enhancement requests • Wiki (documentation)
Please put your approximate location into your profile
Add your web site to the Cumulus user map
Vantage Pro2 users with firmware 3.00 should upgrade to fw 3.12 and Cumulus 1.9.4

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Magnetic Bearings
PostPosted: Sun Dec 04, 2011 1:33 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1852
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
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:
<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:
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 !


Top
 Profile  
 
 Post subject: Re: Magnetic Bearings
PostPosted: Sun Dec 04, 2011 2:01 pm 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 2521
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
Now why did I think this post would be about frictionless levitation bearings? :lol:

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
 Post subject: Re: Magnetic Bearings
PostPosted: Sun Dec 04, 2011 2:42 pm 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1852
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
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 !


Top
 Profile  
 
 Post subject: Re: Magnetic Bearings
PostPosted: Sun Dec 04, 2011 9:47 pm 
Offline

Joined: Mon Apr 04, 2011 11:35 pm
Posts: 70
Location: Wellington, NZ
Weather Station: 1-wire Windblown solution
Operating System: Win XP
Quote:
supermagnets (they bite)


They sure do, I've had marks left on fingers to prove it. :roll:

_________________
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group