<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Thank you very much &nbsp;Dennis, your suggestion works.<br><br>Hyacinth<div><br><div><div id="SkyDrivePlaceholder"></div>&gt; Date: Mon, 22 Oct 2012 23:09:21 -0600<br>&gt; From: shea@ucar.edu<br>&gt; To: hyacinth.1@hotmail.com<br>&gt; CC: ncl-talk@ucar.edu<br>&gt; Subject: Re: [ncl-talk] Looping through dtrend function<br>&gt; <br>&gt; [1] dtrend (dtrend_n) returns anomalies. It removes the mean.<br>&gt; <br>&gt; [2] Is 'x' one dimensional<br>&gt;      x(0)=Jan, x(1)=Feb, ... x(11)=Dec, x(12)=Jan_next year , ...<br>&gt; <br>&gt;    x_dtrnd = x                   ; create array including meta data<br>&gt;    do nmo=0,nmos-1<br>&gt;       work = x(nmo::12)          ; every 12-th value<br>&gt;       wavg = avg(work)           ; average<br>&gt;       work = dtrnd(work, False)  ; anomalies<br>&gt;       work = wavg + work         ; add average back in<br>&gt;       x_dtrend(nmo::nmos) = work<br>&gt;    end do<br>&gt; <br>&gt; <br>&gt; <br>&gt; On 10/22/12 9:20 PM, Hyacinth Nnamchi
  wrote:<br>&gt; &gt; Hi;<br>&gt; &gt;<br>&gt; &gt; I am trying to detrend a monthly time series, month by month:<br>&gt; &gt;<br>&gt; &gt; nmos = 12<br>&gt; &gt; ntim  = dimsizes(x)<br>&gt; &gt;<br>&gt; &gt;    do n = 0,ntim-1,nmos<br>&gt; &gt; x_dtrnd = dtrend(x,False)<br>&gt; &gt;    end do<br>&gt; &gt;<br>&gt; &gt; print(x_dtrnd(0:11))<br>&gt; &gt;<br>&gt; &gt; But the result doesn't look correct, looks like deviations from annual<br>&gt; &gt; mean. What could be wrong?<br>&gt; &gt;<br>&gt; &gt; Hyacinth<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; _______________________________________________<br>&gt; &gt; ncl-talk mailing list<br>&gt; &gt; List instructions, subscriber options, unsubscribe:<br>&gt; &gt; http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br>&gt; &gt;<br></div><embed type="application/x-dap-background" id="DAPPlugin" style="visibility: collapse"></div>                                               </div></body>
</html>