<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div><br><br>Sent from my iPhone</div><div><br>Begin forwarded message:<br><br></div><blockquote type="cite"><div><b>From:</b> Michael Notaro <<a href="mailto:mnotaro@wisc.edu">mnotaro@wisc.edu</a>><br><b>Date:</b> March 14, 2018 at 2:11:53 PM MDT<br><b>To:</b> Dennis Shea <<a href="mailto:shea@ucar.edu">shea@ucar.edu</a>><br><b>Subject:</b> <b>Re: [ncl-talk] Computing Aspect</b><br><br></div></blockquote><blockquote type="cite"><div>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">



<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Dennis, thanks for your feedback and suggestions.</p>
<p style="margin-top:0;margin-bottom:0">I believe the code below works.  I tried different</p>
<p style="margin-top:0;margin-bottom:0">configurations of simple models, facing N, NE, E, SE, S,</p>
<p style="margin-top:0;margin-bottom:0">SW, W, NW, and it looked right each time.  </p>
<p style="margin-top:0;margin-bottom:0">Michael</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">; a b c</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">; d e f</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">; g h i</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); min-height: 19px;">
<span style="font-variant-ligatures: no-common-ligatures;"></span><br>
</p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">a=5000.</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">b=3000.</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">c=1000.</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">d=5000.</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">e=3000.</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">f=1000.</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">g=5000.</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">h=3000.</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">i=1000.</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); min-height: 19px;">
<span style="font-variant-ligatures: no-common-ligatures;"></span><br>
</p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">dx=800.</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">dy=800.</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); min-height: 19px;">
<span style="font-variant-ligatures: no-common-ligatures;"></span><br>
</p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">dzdy=((a+2.*b+c)-(g+2.*h+i))/(2.*dy)</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">dzdx=((c+2.*f+i)-(a+2.*d+g))/(2.*dx)</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">aspect=180.+57.29578*atan2(dzdx,dzdy)</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); min-height: 19px;">
<span style="font-variant-ligatures: no-common-ligatures;"></span><br>
</p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">print(dzdy)</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">print(dzdx)</span></p>
<p style="margin: 0px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 16px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<span style="font-variant-ligatures: no-common-ligatures;">print(aspect)</span></p>
<br>
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" style="font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: Calibri, Arial, Helvetica, sans-serif, Helvetica, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
Michael Notaro<br>
<div>Associate Director<br>
</div>
<div>Nelson Institute Center for Climatic Research<br>
</div>
<div>University of Wisconsin-Madison<br>
</div>
<div>Phone: (608) 261-1503<br>
</div>
<div>Email: <a href="mailto:mnotaro@wisc.edu">mnotaro@wisc.edu</a><br>
</div>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Dennis Shea <<a href="mailto:shea@ucar.edu">shea@ucar.edu</a>><br>
<b>Sent:</b> Wednesday, March 14, 2018 9:29 AM<br>
<b>To:</b> Michael Notaro<br>
<b>Subject:</b> Re: [ncl-talk] Computing Aspect</font>
<div> </div>
</div>
<div>
<div dir="ltr">Sigh ...  offline ...<br>
<br>
atan2 has angles  -180 to 180 degrees with those 2 values relative to the x- axis (mathematical)<br>
<br>
In arcmap
<p>aspect is < 90 then .... direction=90-aspect         which is an azimuth<strong> with respect to North</strong> from 0-360</p>
<p>aspect is > 90 then .... direction = 360-aspect     ditto</p>
<p><br>
</p>
<p>You may have to play with this.</p>
<p><br>
</p>
<p>---</p>
<p>When you get a function that works, send it to me and I'll make a funcytion out of it.</p>
<p><br>
</p>
<p>Cheers</p>
<p>D<br>
</p>
</div>
<div class="x_gmail_extra"><br>
<div class="x_gmail_quote">On Tue, Mar 13, 2018 at 11:27 PM, Dennis Shea <span dir="ltr">
<<a href="mailto:shea@ucar.edu" target="_blank" id="LPlnk66355" previewremoved="true">shea@ucar.edu</a>></span> wrote:<br>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<br>
</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<br>
</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
I think this:</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<br>
</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
dzdx = ( (c + 2*f + i) - (a + 2*d + g))/(2*dx)   ; right - left<br>
</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
----</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
dzdy = ( (a + 2*b + c) - (g + 2*h + i))/(2*dy)   ; top - bottom<br>
</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
----</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
aspect = <span style="">57.29578*atan2(dzdy,dzdx)   <br>
</span></p>
<span class="">
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><br>
</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">if (aspect.lt.0) then</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">    aspect = 90 - aspect</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">end if</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><br>
</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">---</span></p>
</span>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">This link has a formula that uses atan ,,, not atan2</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><br>
</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><a href="http://www.spatialanalysisonline.com/HTML/index.html?gradient__slope_and_aspect.htm" target="_blank" id="LPlnk790243" previewremoved="true">http://www.<wbr>spatialanalysisonline.com/<wbr>HTML/index.html?gradient__<wbr>slope_and_aspect.htm</a><span class="x_HOEnZb"><font color="#888888"><br>
</font></span></span></p>
<span class="x_HOEnZb"><font color="#888888">
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><br>
</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
D<br>
</p>
</font></span></div>
<div class="x_HOEnZb">
<div class="x_h5">
<div class="x_gmail_extra"><br>
<div class="x_gmail_quote">On Tue, Mar 13, 2018 at 10:51 PM, Dennis Shea <span dir="ltr">
<<a href="mailto:shea@ucar.edu" target="_blank" id="LPlnk783571" previewremoved="true">shea@ucar.edu</a>></span> wrote:<br>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div>Hi Mike,<br>
<br>
</div>
Maybe a minus sign in the 2nd argument of atan2? <br>
<div><br>
Given your:<span><br>
<br>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">; a b c</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">; d e f</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">; g h i<br>
</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<br>
</p>
</span>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
dzdx = ( (c + 2*f + i) - (a + 2*d + g))/dx</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
----</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
dzdy = ( (a + 2*b + c) - (g + 2*h + i))/dy</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<br>
</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
or, maybe, not sure of sign convention<br>
</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<br>
</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
dzdy = ( (g + 2*h + i) - (a + 2*b + c))/dy</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
----<br>
</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
Your code may need a minus sign before the 2nd argument:<br>
</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<br>
</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
aspect = <span style="">57.29578*atan2(dzdy,-dzdx)   ; <=== minus sign ???</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><br>
</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">if (aspect.lt.0) then</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">    aspect = 90 - aspect</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">end if</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><br>
</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">------------------<br>
</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<br>
<span style=""><span style="">if (aspect(jj,ii).le.0.) then</span> </span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463gmail-m_919916421783336330gmail-m_-4762187390746946064Apple-converted-space">       
</span>aspect(jj,ii)=90.-aspect(jj,ii<wbr>)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">end if<br>
</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">--<br>
</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><br>
</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">If you use a minus sign, maybe you do not need other 'if' blocks?<br>
</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""></span></p>
</div>
</div>
<div class="x_gmail_extra"><br>
<div class="x_gmail_quote">
<div>
<div class="x_m_-3031227936262426802h5">On Mon, Mar 12, 2018 at 3:27 PM, Michael Notaro
<span dir="ltr"><<a href="mailto:mnotaro@wisc.edu" target="_blank" id="LPlnk877684" previewremoved="true">mnotaro@wisc.edu</a>></span> wrote:<br>
</div>
</div>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div class="x_m_-3031227936262426802h5">
<div dir="ltr">
<div id="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0; margin-bottom:0">I used the following to compute terrain aspect based</p>
<p style="margin-top:0; margin-bottom:0">on elevation.  But it seems the values are possibly not</p>
<p style="margin-top:0; margin-bottom:0">quite right, since they disagree with another aspect </p>
<p style="margin-top:0; margin-bottom:0">dataset I have.  Does anyone see something wrong below?</p>
<p style="margin-top:0; margin-bottom:0">Michael</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">ny=dims(0)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">nx=dims(1)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">aspect=new((/ny,nx/),"float")</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">aspect@_FillValue=-999.</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">aspect=-999.</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255); min-height:19px">
<span style=""></span><br>
</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">; a b c</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">; d e f</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">; g h i</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255); min-height:19px">
<span style=""></span><br>
</p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">do ii=1,nx-2</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space"> 
</span>do jj=1,ny-2</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">   
</span>if (.not.ismissing(elev(jj,ii))) then</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>a=elevation(jj+1,ii-1)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>b=elevation(jj+1,ii)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>c=elevation(jj+1,ii+1)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>d=elevation(jj,ii-1)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>e=elevation(jj,ii)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>f=elevation(jj,ii+1)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>g=elevation(jj-1,ii-1)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>h=elevation(jj-1,ii)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>i=elevation(jj-1,ii+1)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>dzdx=((a+2.*d+g)-(c+2.*f+i))/(<wbr>8.*800.) ; 800 m PRISM</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>dzdy=((g+2.*h+i)-(a+2.*b+c))/(<wbr>8.*800.)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>aspect(jj,ii)=57.29578*atan2(d<wbr>zdy,dzdx)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>if (aspect(jj,ii).le.0.) then</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">       
</span>aspect(jj,ii)=90.-aspect(jj,ii<wbr>)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>else if (aspect(jj,ii).gt.90.) then</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">       
</span>aspect(jj,ii)=360.-aspect(jj,i<wbr>i)+90.</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>else</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">       
</span>aspect(jj,ii)=90.-aspect(jj,ii<wbr>)</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>end if</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">     
</span>end if</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space">   
</span>end if</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style=""><span class="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Apple-converted-space"> 
</span>end do</span></p>
<p style="margin:0px; font-style:normal; font-variant:normal; font-weight:normal; font-size:16px; line-height:normal; font-family:Menlo; color:rgb(0,0,0); background-color:rgb(255,255,255)">
<span style="">end do</span></p>
<span class="x_m_-3031227936262426802m_-4744649809809268463HOEnZb"><font color="#888888"><br>
<p></p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<div id="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374Signature">
<div id="x_m_-3031227936262426802m_-4744649809809268463m_-8038621355348424374divtagdefaultwrapper" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif,Helvetica,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
Michael Notaro<br>
<div>Associate Director<br>
</div>
<div>Nelson Institute Center for Climatic Research<br>
</div>
<div>University of Wisconsin-Madison<br>
</div>
<div>Phone: <a href="tel:(608)%20261-1503" value="+16082611503" target="_blank" id="LPlnk531712" previewremoved="true">
(608) 261-1503</a><br>
</div>
<div>Email: <a href="mailto:mnotaro@wisc.edu" target="_blank" id="LPlnk782209" previewremoved="true">
mnotaro@wisc.edu</a><br>
</div>
</div>
</div>
</font></span></div>
</div>
<br>
</div>
</div>
______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank" id="LPlnk479767" previewremoved="true">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank" id="LPlnk271112" previewremoved="true">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a>
<div id="LPBorder_GT_15210582958760.03183135440282037" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_15210582958740.798592915598751" role="presentation" cellspacing="0" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="TextCell_15210582958750.5487548067575043" colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;">
<div id="LPRemovePreviewContainer_15210582958750.33352381304204703"></div>
<div id="LPTitle_15210582958750.4969867151525442" style="top: 0px; color: rgb(153, 0, 0); font-weight: 400; font-size: 21px; font-family: wf_segoe-ui_light, "Segoe UI Light", "Segoe WP Light", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_15210582958750.04537965413287903" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank" style="text-decoration: none;">ncl-talk Info Page - University Corporation for ...</a></div>
<div id="LPMetadata_15210582958750.986605220485973" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 14px;">
<a href="http://mailman.ucar.edu">mailman.ucar.edu</a></div>
<div id="LPDescription_15210582958760.26554879118925023" style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
This email list is for NCL users to exchange information, ask questions, and report bugs on NCL or other related software if appropriate. It is also for the ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>


</div></blockquote></body></html>