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