<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<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">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-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;">ny=dims(0)</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;">nx=dims(1)</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=new((/ny,nx/),"float")</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@_FillValue=-999.</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=-999.</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 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;">do ii=1,nx-2</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;"><span class="Apple-converted-space">
</span>do jj=1,ny-2</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;"><span class="Apple-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-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;"><span class="Apple-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-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;"><span class="Apple-converted-space">
</span>b=elevation(jj+1,ii)</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;"><span class="Apple-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-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;"><span class="Apple-converted-space">
</span>d=elevation(jj,ii-1)</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;"><span class="Apple-converted-space">
</span>e=elevation(jj,ii)</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;"><span class="Apple-converted-space">
</span>f=elevation(jj,ii+1)</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;"><span class="Apple-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-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;"><span class="Apple-converted-space">
</span>h=elevation(jj-1,ii)</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;"><span class="Apple-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-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;"><span class="Apple-converted-space">
</span>dzdx=((a+2.*d+g)-(c+2.*f+i))/(8.*800.) ; 800 m PRISM</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;"><span class="Apple-converted-space">
</span>dzdy=((g+2.*h+i)-(a+2.*b+c))/(8.*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;"><span class="Apple-converted-space">
</span>aspect(jj,ii)=57.29578*atan2(dzdy,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;"><span class="Apple-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-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;"><span class="Apple-converted-space">
</span>aspect(jj,ii)=90.-aspect(jj,ii)</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;"><span class="Apple-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-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;"><span class="Apple-converted-space">
</span>aspect(jj,ii)=360.-aspect(jj,ii)+90.</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;"><span class="Apple-converted-space">
</span>else</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;"><span class="Apple-converted-space">
</span>aspect(jj,ii)=90.-aspect(jj,ii)</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;"><span class="Apple-converted-space">
</span>end if</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;"><span class="Apple-converted-space">
</span>end if</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;"><span class="Apple-converted-space">
</span>end if</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;"><span class="Apple-converted-space">
</span>end do</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;">end do</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: mnotaro@wisc.edu<br>
</div>
</div>
</div>
</div>
</body>
</html>