Re: (no subject)

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Sep 24 2013 - 07:53:09 MDT

Melissa ...

[1] **You should always include a 'Subject'**
     It is both a curtesy and necessary for issue tracking.
     What if 25 people sent blank Subject lines? How would
     ncl-talk know how to answer?

[2] **I think you must think a bit more about your code.**
     Further ncl-talk needs/wants *clean* code. The following looks like
     you 'stuck' my sample code back into your script. You have

> x=lon(locmax@xi) ; get lat/lon points of maxima
[snip]
> print(x)
[snip]
> ; your data
> x = (/ 43.5, 37.5, 37.5, 51, 46.5,30, 22.5, 52.5, 28.5/)
[snip]
         The last would overwrite x=lon(locmax@xi).
         I think they are the same but ....

[3] Have no idea what a '.odg' file is. Send png or jpeg ....

[3] Have you tried to debug? Consider

     plot2 = gsn_csm_xy (wks,pr2&lon,data,res)

     before this line did you try adding

     printVarSummary(pr2&lon) ; The size is 37

     printVarDummary(data) : The sies are (2,9)

     Perhaps you need

     plot2 = gsn_csm_xy (wks,x(ii),data,res)

On 9/24/13 3:36 AM, Melissa Lazenby wrote:
> ;*************************************************
> ; regline.ncl
> ;
>
> ;*************************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
>
> begin
> ;************************************************
> ; Read in Precip Data.
> ;************************************************
> fili = "/mnt/nfs2/geog/ml382/melphd/regressionline/siczoutputprregline/pr_Amon_ACCESS1-0_historical_safrica_climDJF1.nc" ; data
>
> f = addfile (fili , "r") ; add file
> lat = f->lat ; get lat
> lon = f->lon ; get lon
> time = f->time ; get time
> level = f->z ; get level
> pr = f->pr
> pr1 = pr(:,0,:,:) ; get precip
> pr2 = pr(0,0,:,:) ; ignore level&time, just want lat, lon
>
> printVarSummary(pr2)
>
>
> locmax = local_max(pr2,False,0.)
> x=lon(locmax@xi) ; get lat/lon points of maxima
> y=lat(locmax@yi)
> z=locmax@maxval
>
> print(locmax)
> print(y)
> print(x)
> print(z)
>
> ; your data
> x = (/ 43.5, 37.5, 37.5, 51, 46.5,30, 22.5, 52.5, 28.5/)
> y = (/-26.25, -23.25, -20.25, -17.2, -14.25, -12.75 \
> ,-11.25, -11.25, -3.75/)
>
> ii = dim_pqsort_n(x,1,0) ; indices of ascending x
> print(ii+" "+x(ii)+" "+y(ii))
> print("========================")
>
> rc = regline(x(ii),y(ii))
> print(rc)
>
> ;************************************************
> ; Create an array to hold both the original data
> ; and the calculated regression line.
> ;************************************************
> data = new ( (/2,dimsizes(y(ii))/), typeof(y(ii)))
> data(0,:) = y(ii)
> ; y = mx+b
> ; m is the slope: rc returned from regline
> ; b is the y intercept: rc@yave attribute of rc returned from regline
>
> data(1,:) = rc*(x(ii)-rc@xave) + rc@yave
>
>
> ;************************************************
> ; plotting parameters
> ;************************************************
> wks = gsn_open_wks("X11","ACCESS1-0_regline") ; specifies a ps plot
>
> res = True ; plot mods desired
> ;res@gsnAddCyclic = False
> res@gsnMaximize = True ; maximize plot in frame
> res@xyMarkLineModes = (/"Markers","Lines"/) ; choose which have markers
> res@xyMarkers = 16 ; choose type of marker
> res@xyMarkerColor = "red" ; Marker color
> res@xyMarkerSizeF = 0.01 ; Marker size (default 0.01)
> res@xyDashPatterns = 1 ; solid line
> res@xyLineThicknesses = (/1,2/) ; set second line to 2
>
> res@tiMainString = "Regline" ; title
>
> plot2 = gsn_csm_xy (wks,pr2&lon,data,res) ; create plot
> end
>
>
> Variable: pr2
> Type: float
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 24 07:53:16 2013

This archive was generated by hypermail 2.1.8 : Tue Oct 01 2013 - 14:41:43 MDT