<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div>hi Sri,<div class=""><br class=""></div><div class="">in general terms, when you have an ensemble, you can do one of two things to compute EOFs:</div><div class=""><br class=""></div><div class="">1) compute EOFs on the ensemble mean, which is what you do here, since you used “dim_avg_n_Wrap” on your variable. In this case the two dimensions that the EOF routine sees are space [lat x lon] and time</div><div class="">2) compute EOFs on the “total variance”, in which case you would want your two dimensions to be space [lat x lon] and [time x ens member]. If so, then the "time series” would be the concatenation of the time series of each ensemble member. In order to get that, you need to combine time and ens member dimensions into one.</div><div class=""><br class=""></div><div class="">You may want to look up papers that discuss characterizations of total, forced and internal variance.</div><div class="">Here (1) gives you a characterization of “forced” variance, to the extent that the ensemble mean represents it.</div><div class="">(2) gives you a characterization of “total” variance.</div><div class="">And if you subtracted the ensemble mean from each ensemble member, and then proceeded as in (2), you would get the internal variance.</div><div class=""><br class=""></div><div class="">Here are some examples from a google scholar search:</div><div class=""><br class=""></div><div class=""><div tabindex="0" class="gs_citr">Harzallah, A. and Sadourny, R., 1995. 
Internal versus SST-forced atmospheric variability as simulated by an 
atmospheric general circulation model. <i class="">Journal of climate</i>, <i class="">8</i>(3), pp.474-495.</div></div><div class=""><a href="https://journals.ametsoc.org/doi/abs/10.1175/1520-0442(1995)008%3C0474:IVSFAV%3E2.0.CO;2" class="">https://journals.ametsoc.org/doi/abs/10.1175/1520-0442(1995)008%3C0474:IVSFAV%3E2.0.CO;2</a></div><div class=""><br class=""></div><div class=""><div tabindex="0" class="gs_citr">Ting, M., Kushnir, Y., Seager, R. and Li, C., 2009. Forced and internal twentieth-century SST trends in the North Atlantic. <i class="">Journal of Climate</i>, <i class="">22</i>(6), pp.1469-1481.</div></div><div class=""><a href="https://journals.ametsoc.org/doi/full/10.1175/2008JCLI2561.1" class="">https://journals.ametsoc.org/doi/full/10.1175/2008JCLI2561.1</a></div><div class=""><br class=""></div><div class=""><div tabindex="0" class="gs_citr">Venzke, S., Allen, M.R., Sutton, R.T. 
and Rowell, D.P., 1999. The atmospheric response over the North Atlantic
 to decadal changes in sea surface temperature. <i class="">Journal of Climate</i>, <i class="">12</i>(8), pp.2562-2584.</div></div><div class=""><a href="https://journals.ametsoc.org/doi/full/10.1175/1520-0442%281999%29012%3C2562%3ATAROTN%3E2.0.CO%3B2" class="">https://journals.ametsoc.org/doi/full/10.1175/1520-0442%281999%29012%3C2562%3ATAROTN%3E2.0.CO%3B2</a></div><div class=""><br class=""></div><div class="">Reasons why things don’t match could also include whether you have subtracted the climatology or not</div><div class=""><br class=""></div><div class="">Hope this helps!</div><div class="">alessandra</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">— <br class="">Alessandra Giannini<br class="">IRI for Climate and Society - The Earth Institute at Columbia University<br class="">P.O. Box 1000, Palisades NY 10964-8000, U.S.A.</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br class="">currently at:<br class="">LMD - École Normale Supérieure <br class="">24, Rue Lhomond 75231 PARIS CEDEX 05, France<br class=""></div></div></div>
</div>

<div><br class=""><blockquote type="cite" class=""><div class="">On May 22, 2020, at 1:01 AM, Sri nandini via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class="">
  
  <div class=""><p class="">Dear all,</p><p class="">I tried the below code for performing EOF on model ensemble data,
      with plot attached, but it doesn't match the EOF found in
      publications since i believe i averaged the ensemble dimension
      instead of including the signal from it. Can someone point me in
      the right direction?</p><p class=""><br class="">
      ;==============================================================<br class="">
      ; Open the file: Read only the user specified period <br class="">
      ; =============================================================<br class="">
      <br class="">
        latS   =  20.<br class="">
        latN   =  80. <br class="">
        lonL   = -70.<br class="">
        lonR   =  40.<br class="">
      <br class="">
        ;yrStrt = 1986<br class="">
        ;yrLast = 2005<br class="">
      <br class="">
        season = "DJF"    ; choose Dec-Jan-Feb seasonal mean<br class="">
        ; season = "JJA"   <br class="">
      <br class="">
        neof   = 3        ; number of EOFs<br class="">
        optEOF = True       <br class="">
        optEOF@jopt = 0   ; This is the default; most commonly used; no
      need to specify.<br class="">
      <br class="">
      ; =============================================================<br class="">
         f     = addfile ("anom_hist_zo_slr.nc", "r")<br class="">
         x=f->hist_anom                                 ;[time | 240]
      x [ens | 100] x [lat | 45] x [lon | 90]<br class="">
         printVarSummary(x)    <br class="">
         slp=dim_avg_n_Wrap(x,1)                 <br class="">
         printVarSummary(slp)                           <br class="">
         printMinMax(slp,0)<br class="">
      <br class="">
      ; ==============================================================<br class="">
      ; compute desired global seasonal mean: month_to_season
      (contributed.ncl) <br class="">
      ; The first average (DJF=JF) and the last average (NDJ=ND) are
      actually two-month averages.<br class="">
      ; So make climatology and extract the months needed.<br class="">
      ; ==============================================================<br class="">
        SLP    = month_to_season (slp, season)<br class="">
        ;      uClm = clmMonTLLL( u )<br class="">
        nyrs   = dimsizes(SLP&time)<br class="">
        printVarSummary(SLP)<br class="">
      <br class="">
      ;
      =================================================================<br class="">
      ; create weights:  sqrt(cos(lat))   [or sqrt(gw) ]<br class="">
      ;
      =================================================================<br class="">
        rad    = 4.*atan(1.)/180.<br class="">
        lat = f->lat<br class="">
         if (typeof(lat).eq."double") then<br class="">
             clat = sqrt( cos(rad*tofloat(lat)) )<br class="">
         else<br class="">
             clat = sqrt( cos(rad*lat) )<br class="">
         end if<br class="">
         copy_VarCoords(lat, clat) ; contributed<br class="">
         printVarSummary(clat) <br class="">
      <br class="">
      ;
      =================================================================<br class="">
      ; weight all observations <br class="">
      ;
      =================================================================<br class="">
        wSLP   = SLP  ; type float<br class="">
        wSLP   = SLP*conform(SLP, clat, 1)<br class="">
        printVarSummary(wSLP)                      <br class="">
                <br class="">
      ;
      =================================================================<br class="">
      ; Reorder (lat,lon,time) the *weighted* input data<br class="">
      ; Access the area of interest via coordinate subscripting<br class="">
      ;
      =================================================================<br class="">
        xw     = wSLP({lat|latS:latN},{lon|lonL:lonR},time|:)<br class="">
        x      = wSLP(time|:,{lat|latS:latN},{lon|lonL:lonR})  <br class="">
       <br class="">
        xw= dtrend(xw(lat|:,lon|:,time|:),False)<br class="">
        printVarSummary(xw)<br class="">
    </p><p class=""><br class="">
        eof      = eofunc_Wrap(xw, neof, optEOF)  <br class="">
        eof_ts   = eofunc_ts_Wrap (xw, eof, optETS)<br class="">
      <br class="">
        printVarSummary( eof )                         ; examine EOF
      variables<br class="">
        printVarSummary( eof_ts )<br class="">
      ;
      =================================================================<br class="">
      ; Normalize time series: Sum spatial weights over the area of used<br class="">
      ;
      =================================================================<br class="">
        eof_ts = dim_standardize_n( eof_ts, 0, 1)      <br class="">
        printVarSummary(eof_ts)<br class="">
      <br class="">
;====================================================================<br class="">
      ;my code: Regress<br class="">
;======================================================================<br class="">
      <br class="">
        eof_regres=eof  ;create an array with meta data<br class="">
        ;eof_ts(0,:)=-eof_ts(0,:)<br class="">
        do ne=0,neof-1<br class="">
        eof_regres(ne,:,:)=(/ regCoef(eof_ts(ne,:), xw) /)<br class="">
        end do<br class="">
        printVarSummary(eof_regres)<br class="">
      <br class="">
       ; eof_regres=-eof_regres<br class="">
      <br class="">
      ;=================================================================<br class="">
        yyyymm = cd_calendar(eof_ts&time,-2)/100  <br class="">
      ;============================================================<br class="">
      <br class="">
        wks = gsn_open_wks("pdf","hist_SSH_EOF2")<br class="">
      <br class="">
        plot                    = new(neof,graphic) ; create graphic
      array; only needed if paneling<br class="">
        res                     = True         <br class="">
        res@mpProjection        = "LambertConformal"; choose
      projection         <br class="">
        res@gsnDraw             = False           ; don't draw<br class="">
        res@gsnFrame            = False           ; don't advance frame<br class="">
      <br class="">
        res@cnFillOn            = True            ; turn on color<br class="">
        res@cnLinesOn   = False                       ; turn off the
      contour lines<br class="">
      <br class="">
        res@mpDataBaseVersion   = "MediumRes"                <br class="">
        res@cnLineLabelsOn      = False    ; turn off contour line
      labels<br class="">
        <br class="">
        res@cnFillDrawOrder     = "PreDraw"       ; draw contours before
      continents<br class="">
        res@cnFillPalette = "BlRe"<br class="">
        ;res@cnLineThicknessF = 2<br class="">
        ;res@cnLineColor = 0<br class="">
      <br class="">
        res@mpMinLatF            = latS           ; zoom in on map<br class="">
        res@mpMaxLatF            = latN<br class="">
        res@mpMinLonF            = lonL<br class="">
        res@mpMaxLonF            = lonR<br class="">
        ;res@mpFillOn             = False              ; turn on map
      fill<br class="">
        res@mpOutlineOn = True                        ; turn the map
      outline on<br class="">
      <br class="">
        res@cnLevelSelectionMode = "ManualLevels"     ; manual set
      levels<br class="">
        res@cnMinLevelValF       = -0.5<br class="">
        res@cnMaxLevelValF       = 0.5<br class="">
        res@cnLevelSpacingF      = .1                 ; 20 contour
      levels   <br class="">
      <br class="">
        res@lbLabelBarOn         = False              ; turn off
      individual lb's<br class="">
        res@lbBoxEndCapStyle     = "TriangleBothEnds" ; Added in NCL
      V6.4.0<br class="">
        res@lbLabelAutoStride    = True               ; Control labelbar
      spacing<br class="">
        res@gsnMaximize          = True               ; large format in
      landscape<br class="">
        res@gsnAddCyclic         = False              ; plotted dataa
      are not cyclic<br class="">
        res@gsnMaskLambertConformal = True            ; turn on lc
      masking<br class="">
      <br class="">
      ;=============================panel plot only resources<br class="">
        resP                     = True         ; modify the panel plot<br class="">
        resP@gsnMaximize         = True         ; large format<br class="">
        resP@gsnPanelLabelBar    = True         ; add common colorbar<br class="">
      ; now change the size of the label bar labels<br class="">
        resP@lbLabelFontHeightF = 0.017<br class="">
      <br class="">
      ;====================Create (but don't draw) both plots<br class="">
         do n=0, neof -1<br class="">
           res@gsnLeftString  = "SSH DJF EOF "+(n+1)<br class="">
           res@gsnRightString = sprintf("%5.1f", eof_regres@pcvar(n))
      +"%"<br class="">
           plot(n)=gsn_csm_contour_map(wks,eof_regres(n,:,:),res)<br class="">
         end do<br class="">
      <br class="">
      <br class="">
        gsn_panel(wks,plot,(/neof,1/),resP)     ; now draw as one plot<br class="">
    </p><p class=""><br class="">
    </p><p class="">The EOF1 should resemble EOF3 pattern instead, as per previous
      literature for sea surface height.<br class="">
    </p><p class="">Can someone help me with this?</p><p class="">Sri</p><p class=""><br class="">
    </p><p class=""><br class="">
    </p>
    <div class="moz-cite-prefix">On 21.05.20 17:18, Sri nandini via
      ncl-talk wrote:<br class="">
    </div>
    <blockquote type="cite" cite="mid:cf28d538-08f8-40bf-e712-700c8bcc4710@uni-hamburg.de" class="">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" class=""><p class="">Thank you.</p><p class="">The idea is that SSH variability is computed over the ensemble
        dimension, rather than the traditional time-dimension- i.e
        computing EOF across individual ensemble member at each time
        step with looping, in which case the below would not make sense
        .i.e averaging the ensemble dimension?</p><p class="">Perhaps i should perform the EOF on both the time and
        ensemble dimension as variations across time and ensemble are
        supposed to be the same after detrending, the more samples the
        more robust the EOF is?<br class="">
      </p><p class="">Best</p><p class="">Sri</p><p class=""><br class="">
      </p>
      <div class="moz-cite-prefix">On 21.05.20 05:09, Dennis Shea wrote:<br class="">
      </div>
      <blockquote type="cite" cite="mid:CAOF1d_4fk_f_AG_in010AJuXPFxwDkVJ_wvhobb+Jhw9tGc0Uw@mail.gmail.com" class="">
        <meta http-equiv="content-type" content="text/html;
          charset=UTF-8" class="">
        <div dir="ltr" class="">
          <div class="">At each time stelp,and lat/lon location all 100 ensembel 
            members</div>
          <div class=""> <br class="">
          </div>
          <div class=""><br class="">
          </div>
          <div class="">ssh_ens_mean = <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_n_Wrap.shtml" moz-do-not-send="true" class=""><b class="">dim_avg_n_Wrap</b></a>(ssh,1)  ;
            average <br class="">
          </div>
          <div class=""> printVarSummary(ssh_ens_mean)</div>
          <div class=""> printMinMax(ssh_ens_mean,0)</div>
          <div class=""><br class="">
          </div>
          <div class="">--</div>
          <div class="">Input  'ssh_ens_mean'  as you would any other variable  
            to the eof function<br class="">
          </div>
           </div>
        <br class="">
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Wed, May 20, 2020 at 7:29
            AM Sri nandini via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" moz-do-not-send="true" class="">ncl-talk@ucar.edu</a>>
            wrote:<br class="">
          </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 fellow ncl
            users,<br class="">
            <br class="">
            I have been analyzing and plotting the standard EOF with
            success. Now i <br class="">
            wish to proceed onto model ensemble EOF but having problems
            <br class="">
            understanding this coding.<br class="">
            <br class="">
            My original data is in this format: SSH=   [time | 240] x
            [ens | 100] x <br class="">
            [lat | 45] x [lon | 90]<br class="">
            How can i modify the standard EOF script on the NCL page to
            perform it <br class="">
            on model ensemble of 100 members?e.g through looping it?<br class="">
            <br class="">
            Would be grateful for an example.<br class="">
            <br class="">
            best<br class="">
            <br class="">
            sri<br class="">
            <br class="">
            <br class="">
            <br class="">
            _______________________________________________<br class="">
            ncl-talk mailing list<br class="">
            <a href="mailto:ncl-talk@ucar.edu" target="_blank" moz-do-not-send="true" class="">ncl-talk@ucar.edu</a><br class="">
            List instructions, subscriber options, unsubscribe:<br class="">
            <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank" moz-do-not-send="true" class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote>
        </div>
      </blockquote>
      <br class="">
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
ncl-talk mailing list
<a class="moz-txt-link-abbreviated" href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>
List instructions, subscriber options, unsubscribe:
<a class="moz-txt-link-freetext" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></pre>
    </blockquote>
  </div>

<span id="cid:F7818BFC-72F8-426F-937D-97D3C041CE50"><SSH_historical_DJF_EOF.pdf></span>_______________________________________________<br class="">ncl-talk mailing list<br class=""><a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class="">List instructions, subscriber options, unsubscribe:<br class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</div></blockquote></div><br class=""></div></body></html>