<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">I noticed after I sent this that I have placed a project-specific range limit on the longitude (between 90E and 90W).&nbsp;
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Please remove that if-then statement, or turn it into something more general, like:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp; if (lon &gt; -999.) then<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Bart<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> wrf-users-bounces@ucar.edu [mailto:wrf-users-bounces@ucar.edu]
<b>On Behalf Of </b>Bart Brashers<br>
<b>Sent:</b> Thursday, January 26, 2012 9:44 AM<br>
<b>To:</b> wrf-users (wrf-users@ucar.edu)<br>
<b>Subject:</b> Re: [Wrf-users] Grid Magnetic Angle<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Here&#8217;s the subroutine I use to convert to TRUE North (not magnetic North, but maybe you can tweak this for your needs):<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp; subroutine uv2sd(u,v,lon,speed,dir)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">! Converts U and V (vector components) to speed and direction.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">! If lon &gt;= -90., rotate the winds from the local projection to E-N.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp; USE met_fields<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">!-----Vars needed from met_fields:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">!&nbsp;&nbsp;&nbsp;&nbsp; cenlat<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">!&nbsp;&nbsp;&nbsp;&nbsp; conefact<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp; implicit none<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">!-----Variable declaration<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp; real :: u,v,lon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ! Vector components, Longitude<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp; real :: speed,dir&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ! Output speed and direction<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp; real :: lon_diff, sign<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp; &nbsp;&nbsp;real, parameter :: pi = 3.14159265<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp; &nbsp;&nbsp;real, parameter :: d2r = pi/180.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">!-----Entry point<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp; speed = sqrt(u**2 &#43; v**2)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp; dir&nbsp;&nbsp; = atan2(u,v) / d2r ! in degrees, not radians<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp; if (lon &gt;= -90. .and. lon &lt;= 90.) then<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lon_diff = lon - clon<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( lon_diff &gt;&nbsp; 180. ) lon_diff = lon_diff - 360.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( lon_diff &lt; -180. ) lon_diff = lon_diff &#43; 360.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sign = 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ! northern hemisphere<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (cenlat &lt; 0.) sign = -1 ! southern hemisphere<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dir = dir &#43; lon_diff * conefact * sign<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp; end if<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp; if (dir &lt;&nbsp;&nbsp; 0.) dir = dir &#43; 360.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp;&nbsp;&nbsp; if (dir &gt; 360.) dir = dir - 360.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black">&nbsp; end subroutine uv2sd<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Bart Brashers<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> wrf-users-bounces@ucar.edu [mailto:wrf-users-bounces@ucar.edu]
<b>On Behalf Of </b>Jason Padovani Ginies<br>
<b>Sent:</b> Wednesday, January 25, 2012 11:49 PM<br>
<b>To:</b> wrf-users<br>
<b>Subject:</b> [Wrf-users] Grid Magnetic Angle<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Dear all,<br>
<br>
I am to understand that u- and v- wind components in WRF are given with respect to the x and y coordinates respectively according to Grid North. How would I go about converting from Grid north to magnetic North (Grid Magnetic angle) on a Lambert Conformal map?<br>
<br>
Kind regards,<br>
<br>
Jason<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="1" width="100%" noshade="" style="color:#004250" align="center">
</div>
<p class="MsoNormal">This message contains information that may be confidential, privileged or otherwise protected by law from disclosure. It is intended for the exclusive use of the Addressee(s). Unless you are the addressee or authorized agent of the addressee,
 you may not review, copy, distribute or disclose to anyone the message or any information contained within. If you have received this message in error, please contact the sender by electronic reply to
<a href="mailto:email@environcorp.com">email@environcorp.com</a> and immediately delete all copies of the message.
<o:p></o:p></p>
</div>
</div>
<br>
<hr size="1" color="#004250">
This message contains information that may be confidential, privileged or otherwise protected by law from disclosure. It is intended for the exclusive use of the Addressee(s). Unless you are the addressee or authorized agent of the addressee, you may not review,
 copy, distribute or disclose to anyone the message or any information contained within. If you have received this message in error, please contact the sender by electronic reply to email@environcorp.com and immediately delete all copies of the message.
</body>
</html>