<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Thanx very much!</p>
    <p>That works!</p>
    <p>Sri<br>
    </p>
    <div class="moz-cite-prefix">On 12.06.20 14:06, Rashed Mahmood
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOmfQPpEhqfDXJx7uPy+tpJ+GLeiqwY89EwQ+WOufS=b13YuSQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Please add ncl-talk in subsequent messages...</div>
        <div><br>
        </div>
        <div>In that case, my suggestion in previous message should
          work.</div>
        <div><br>
        </div>
        <div>Rashed.<br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Fri, Jun 12, 2020 at 1:55
          PM Sri nandini <<a href="mailto:bax8609@uni-hamburg.de"
            moz-do-not-send="true">bax8609@uni-hamburg.de</a>> wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div>
            <p>Thank you.</p>
            <p>I wish to remove the ensemble mean from each
              corresponding time of each ensemble.</p>
            <p>Sri<br>
            </p>
            <div>On 12.06.20 13:48, Rashed Mahmood wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div>If you just want to remove ensemble mean then you
                  could do the following:</div>
                <div><br>
                </div>
                <div>x_new      = x</div>
                <div> ens_mean = dim_avg_n_Wrap(x,1) <br>
                </div>
                <div>do n=0,nens-1</div>
                <div>   x_new(:,n,:,:) = x(:,n,:,:) - ens_mean <br>
                </div>
                <div>end do</div>
                <div><br>
                </div>
                <div>However, please make sure that this is what you
                  want!, it is up to you to decide and know what you are
                  trying to accomplish here. Your variable names suggest
                  that there could be some confusion...</div>
                <div><br>
                </div>
                <div>Cheers,</div>
                <div>Rashed<br>
                </div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div><br>
                </div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Fri, Jun 12, 2020
                  at 12:50 PM Sri nandini via ncl-talk <<a
                    href="mailto:ncl-talk@mailman.ucar.edu"
                    target="_blank" moz-do-not-send="true">ncl-talk@mailman.ucar.edu</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px 0.8ex;border-left:1px solid
                  rgb(204,204,204);padding-left:1ex">Hello dear
                  ncl-users,<br>
                  <br>
                  I want to know the best way to remove the ensemble
                  mean from the <br>
                  corresponding time of each ensemble member. Can
                  someone tell me if the <br>
                  following code is correct? i do not get any error but
                  i wanted to be <br>
                  sure of the method.<br>
                  <br>
                  Thanx in advance<br>
                  <br>
                  Sri<br>
                  <br>
;==================================================================<br>
                  ;  Remove the ensemble mean from each ensemble member<br>
;==================================================================<br>
                      dimx = dimsizes(x)<br>
                      ntim = dimx(0)          ; 240<br>
                      nens = dimx(1)          ; 100<br>
                      nlat = dimx(2)          ; 45<br>
                      mlon = dimx(3)          ; 90<br>
                  <br>
                      nmos = 12<br>
                      nyrs = ntim/nmos         ; 21<br>
                  <br>
                      printVarSummary(x)       ;[time | 240] x [ens |
                  100] x [lat | 45] x [lon | 90]<br>
                      ens_mean=dim_avg_n_Wrap(x,1)<br>
                      printVarSummary(ens_mean);[time | 240]  x [lat |
                  45] x [lon | 90]<br>
                  <br>
                       detrended_x = x<br>
                       do nt=0,ntim-1<br>
                         nmo = nt%12<br>
                        do ne=0,nens-1<br>
                           detrended_x(nt,ne,:,:) = (/ x(nt,ne,:,:) -
                  ens_mean(nmo,:,:) /) ; detrended array<br>
                        end do<br>
                      end do<br>
                      detrended_x@long_name = “Ensemble mean removed”<br>
                  <br>
                      printVarSummary(detrended_x)<br>
                     [time | 240] x [ens | 100] x [lat | 45] x [lon |
                  90]<br>
                  <br>
                  _______________________________________________<br>
                  ncl-talk mailing list<br>
                  <a href="mailto:ncl-talk@mailman.ucar.edu"
                    target="_blank" moz-do-not-send="true">ncl-talk@mailman.ucar.edu</a><br>
                  List instructions, subscriber options, unsubscribe:<br>
                  <a
                    href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote>
              </div>
            </blockquote>
          </div>
        </blockquote>
      </div>
    </blockquote>
  </body>
</html>