Hello,
I have been working on a script based off of this code:
http://www.ncl.ucar.edu/Applications/Scripts/scatter_4.ncl
I am trying to make a scatter plot of monthly mean u-winds in two
different regions, using the ncep/ncar reanalysis and the gsn_csm_xy
function. Whenever I run the script, I get a scatter plot but no best fit
line. Does anyone know what I'm doing wrong here?
The script I am running is below. I also attached a copy of what the
scatter plot looks like when I run the script.
-Gabriel Susca-Lopata
Undergraduate student at SUNY Albany
----------------------------------------------------------------------
begin
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;loop to create an array of the time values to read from
;the uwnd.mon.mean.nc file. Is supposed to pick
;pick DJF over the range of years
a1=new((/189/), integer)
do n = 0,751,12
a2 = (/n+5,n+6,n+7/)
a1(n/4:n/4+2) = a2
end do
;print(a1)
f = addfile("uwnd.mon.mean.nc", "r")
uwind_nhem1 = f->uwnd(a1,8,21:25,26:38) ; DJF,250mb,27.5-37.5N,65-95E
uwind_shem1 = f->uwnd(a1,8,42:46,12:24) ; "","",15-25S,30-60E
;unpack the values
uwind_nhem1d = 202.65 + (ndtooned(uwind_nhem1)*.01)
uwind_shem1d = 202.65 + (ndtooned(uwind_shem1)*.01)
;calculate the correlation
corr = escorc(uwind_nhem1d, uwind_shem1d)
print(corr)
wks = gsn_open_wks("png","regressR1R3")
res = True ; plot mods desired
res@xyMarkLineModes = (/"Markers","Lines"/)
res@xyMarkers = 16 ; choose type of marker
res@xyMarkerColor = "blue" ; Marker color
res@xyMarkerSizeF = 0.001 ; Marker size (default
0.01)
res@xyDashPatterns = 1 ; solid line
res@xyLineThicknesses = (/1,2/) ; set second line to 2
;res@xyCurveDrawOrder = "PostDraw"
;res@xyMonoLineColor = True
;res@xyLineColor = "red"
res@tiMainString = "R1 and R3" ; title
plot = gsn_csm_xy (wks,uwind_shem1d,uwind_nhem1d,res) ; create plot
end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.1.8 : Fri May 13 2011 - 10:21:56 MDT