Re: Panel plot errors

From: Rick Brownrigg <brownrig_at_nyahnyahspammersnyahnyah>
Date: Mon May 24 2010 - 05:21:16 MDT

Hi,

There are at least two problems that I see:

1. NCL's array indexing is zero-based. Your do_loop indexing is
1-based, ranging from 1-12, indexing into
the arrays "p", "d", "c". You either want something like "do i=0,11"
or "p(i-1,:)=f1->a", etc.

2. On the line that reads "data = new((/3,dim/),"float")", the
variable "dim" has never been created. You have variables "dim1",
"dim2", "dim3"; perhaps one of those was intended?

Its possible that fixing these two issues will clear up the remaining
errors (?) Hope that helps...
Rick

On Sun, 23 May 2010 01:53:10 -0700 (PDT)
  Ibo Ze <ibo85@ymail.com> wrote:
> Hi,
>
> I want to plot standardized anomaly for all months for three
>different regions in a panel plot. Getting following error:
>
> fatal:Subscript out of range, error in subscript #0
> fatal:Execute: Error occurred at or near line 45 in file
>stnd_anomaly.ncl
> fatal:Variable (dim) is undefined
> fatal:Execute: Error occurred at or near line 59 in file
>stnd_anomaly.ncl
> warning:dim_standardize: 1 rightmost sections of the input array
>contained all missing values
> fatal:Assignment type mismatch, right hand side can't be coerced to
>type of left hand side
> fatal:Execute: Error occurred at or near line 64 in file
>stnd_anomaly.ncl
> warning:dim_standardize: 1 rightmost sections of the input array
>contained all missing values
> fatal:Assignment type mismatch, right hand side can't be coerced to
>type of left hand side
> fatal:Execute: Error occurred at or near line 65 in file
>stnd_anomaly.ncl
> warning:dim_standardize: 1 rightmost sections of the input array
>contained all missing values
> fatal:Assignment type mismatch, right hand side can't be coerced to
>type of left hand side
> fatal:Execute: Error occurred at or near line 66 in file
>stnd_anomaly.ncl
> fatal:Undefined identifier: (data) is undefined, can't continue
> fatal:Execute: Error occurred at or near line 88 in file
>stnd_anomaly.ncl
> (0) Error: gsn_panel: all of the plots passed to gsn_panel
>appear to be invalid
>
> *******************************************************************
>
> Please help to rectify this error.
> Thanks. Ibo
> The script i am using is as follows:
>
> 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"
> begin
> do i=1,12
> filename1 = "6104_pk_"+sprinti("%0.2i",i)+"_avg.nc"
> print(filename1)
> filename2 = "6104_ind_"+sprinti("%0.2i",i)+"_avg.nc"
> print(filename2)
> filename3 = "6104_sec_"+sprinti("%0.2i",i)+"_avg.nc"
> print(filename3)
> f1 = addfile(filename1,"r")
> f2 = addfile(filename2,"r")
> f3 = addfile(filename3,"r")
> if (i.eq.1) then
> a1 = f1->a
> a2 = f2->a
> a3 = f3->a
> dim1 = dimsizes(a1)
> dim2 = dimsizes(a2)
> dim3 = dimsizes(a3)
> p=new((/12,dim1/),"float")
> d=new((/12,dim2/),"float")
> c=new((/12,dim3/),"float")
> end if
> p(i,:)=f1->a
> d(i,:)=f2->a
> c(i,:)=f3->a
> delete(f1)
> delete(f2)
> delete(f3)
> end do
> time = ispan(1961,2004,1)
>
> data = new((/3,dim/),"float")
> f1 = dim_standardize_Wrap(p(:,:),1)
> f2 = dim_standardize_Wrap(d(:,:),1)
> f3 = dim_standardize_Wrap(c(:,:),1)
>
> wks = gsn_open_wks("x11","stanom_pic_06") ; open a ps
>plot
> plot = new(12,graphic)
> res = True ;
>make plot mods
> res@gsnDraw = False
> res@gsnFrame = False
> res@xyLineThicknesses = (/2.,2.,2./)
> res@xyLineColors = (/"red","blue","orange"/)
> res@xyDashPatterns = (/0.,0.,0./) ; make
>all lines solid
> res@trYMinF = -5.0 ;
>bring bars down to zero
> res@trYMaxF = 5.0 ;
>adds space on either end
> res@trXMinF = 1960
> res@trXMaxF = 2004
> res@gsnYRefLine = 0. ;
>reference line
> res@tiXAxisString = "Time(years)"
> ; x-axis label
> res@tiYAxisString = "Standardized Anomaly"
> ; x-axis label
> do i=0,11
> data(0,:)=f1(i,:)
> data(1,:)=f2(i,:)
> data(2,:)=f3(i,:)
>
> plot(i) = gsn_csm_xy(wks,time,data,res) ; plot
>correlation
> end do
> gsn_panel(wks,plot,(/4,3/),res) ; plot
>correlation
>
> end
>
>
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon May 24 05:21:21 2010

This archive was generated by hypermail 2.1.8 : Wed May 26 2010 - 10:39:13 MDT