<div dir="ltr"><div>[1] The script you sent should *not* work at all. It looks like you caut and pasted from several different<br></div><div> example scripts and expected it to work.<br><br></div><div>[2] If it did work, you would not have "annual means". .... yould would have "anomalies"<br> x_ave = rmMonAnnCycTLL(x)<br></div><div> would not create an "ave" (average). It creates "anomalies" from an average<br><br></div><div>[3] The following would also fail<br> data1(1,:) = rc*(x-rc@xave) + rc@yave</div><div><br></div><div>You sent<br></div><div>==<br><div>x_ave = rmMonAnnCycTLL(x)<br>
y = rmMonAnnCycTLL(y)<br><br></div><div>Then you use 'y_ave' which you have not created.<br></div>
<div> </div>
<div>x_ave_new = dim_avg_n(x_ave,(/1,2/))</div>
<div>y_ave_new = dim_avg_n(y_ave,(/1,2/)) ; <== you have not computed y_ave<br><br></div><div>The script should fail here.<br>==<br><br></div><div>Assuming, <br><br> y = rmMonAnnCycTLL(y)<br><br></div><div>should be<br><br> y_ave = rmMonAnnCycTLL(y)<br><br>==<br></div>Now you use<br><br></div><div><div><div>x_ave_new = dim_avg_n(x_ave,(/1,2/)) ; ===> x_ave_new(ntim)</div>
<div>y_ave_new = dim_avg_n(y_ave,(/1,2/)) ; ===> y_ave_new(ntim)<br><br></div><div>rc = regline(x_ave_new,y_ave_new)</div>
<div>print(rc)<br><br></div>
<div>x = x_ave_new ; <******* this should fail here <br>
y = y_ave_new</div>
<div>data1 = new((/2,dimsizes(y)/), typeof(y))<br><br><div>By default, NCL does not allow a one-dimensional array [ x_ave_new, y_ave_new ]<br></div><div>to overwrite a three-dimensional array [ x(ntim,nlat,mlon), y(ntim,nlat,mlon) ]<br></div>unless special NCL syntax := is used. This syntax is available from 6.1.1 onward.<br><br></div>Please clean up your script and send something that 'kinda' works.<br></div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 12, 2014 at 6:07 AM, Lena Frey <span dir="ltr"><<a href="mailto:Frey_L@web.de" target="_blank">Frey_L@web.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:Verdana;font-size:12.0px"><div>Hi all!</div>
<div> </div>
<div>I am trying to make as scatter plot. I have monthly data, the dimensions of the variables x and y are time,lat,lon.</div>
<div>I would like to have scatter plots for different regions and to have monthly data de-seasonalized.</div>
<div>The script is working, but it seems like I have annual means.</div>
<div>Here is my script:</div>
<div> </div>
<div>
<div>in_x = addfile("~/DATA/<a href="http://x.nc" target="_blank">x.nc</a>","r")<br>
x = in_x->x(:,{-10:-20},{180:190})</div>
<div>in_y = addfile("~/DATA/<a href="http://y.nc" target="_blank">y.nc</a>","r")<br>
y = in_y->y(:,{-10:-20},{180:190})</div>
<div> </div>
;*********************************************************************************
<div>; remove annual cycle<br>
;*********************************************************************************</div>
<div>x_ave = rmMonAnnCycTLL(x)<br>
y = rmMonAnnCycTLL(y)</div>
<div> </div>
<div>;********************************************************************************<br>
; calculate average LON LAT<br>
;********************************************************************************</div>
<div>x_ave_new = dim_avg_n(x_ave,(/1,2/))</div>
<div>y_ave_new = dim_avg_n(y_ave,(/1,2/))</div>
<div> </div>
<div>;********************************************************************************<br>
; regression line<br>
;********************************************************************************</div>
<div>rc = regline(x_ave_new,y_ave_new)</div>
<div>print(rc)</div>
<div> </div>
<div>;********************************************************************************<br>
; create array<br>
;********************************************************************************</div>
<div>x = x_ave_new<br>
y = y_ave_new</div>
<div>data1 = new((/2,dimsizes(y)/), typeof(y))</div>
<div><br>
data1(0,:) = y</div>
<div>data1(1,:) = rc*(x-rc@xave) + rc@yave</div>
<div> </div>
<div> </div>
<div><br>
;*********************************************************************************<br>
; plotting parameters<br>
;*********************************************************************************</div>
<div>wks = gsn_open_wks("pdf","scatter")</div>
<div>res = True<br>
;res@gsnMinimize = True</div>
<div>...</div>
<div> </div>
<div>plot = gsn_csm_xy (wks,x,data1,res)</div>
<div> </div>
<div>end</div>
<div>;********************************************************************</div>
<div> </div>
<div> </div>
<div>Thanks.</div>
<div>Best regards,</div>
<div>Lena</div>
</div></div></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>