Re: NAO-Index create time array

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Jul 01 2013 - 08:09:55 MDT

Lena,

Please read the error message carefully. It's telling you that you are subscripting an array as if it's a 2D array, when it is really a 3D array.
I don't see where this is happening inside your own code, so it may be that the arrays you passed to gsn_csm_xy are not the correct size.

I can't tell from the last line what the problem might be, so you should use printVarSummary to look at the variables and make sure you are passing in the right arrays:

> pprintVarSummary(yyyyfrac)
> pprintVarSummary(Delta)

When you create an XY plot, one array must be a subset in size of the other. For example, both your X and Y array can be 1D arrays of the same length.
Or, your X array could be a 1D arrays of "npts" points and your Y array could be 4 x npts 2D array, which would create 4 curves with 10 points each.

Make sure that yyyyfrac and Delta meet these requirements.

--Mary

On Jul 1, 2013, at 2:49 AM, Lena Frey <frey_l@web.de> wrote:

> Hi,
>
> I have calculated the NAO-Index. Now i would like to plot the results. My data range from the year 1978 to 2007. I would like to plot the index for this entire period, but it doesn't work. I use the following configuration and get the error message "2 subscripts used, 3 subscripts expected" for the last line. How can I create the time array for my plot? Thanks.
>
> ;**********************************************************************
> ; calculate sea level pressure
> ;**********************************************************************
> slp = pslec(tm1(:,30,:,:),phis,aps,press(:,30,:,:))
> copy_VarMeta(aps,slp)
> slp@long_name = "Sea Level Pressure"
> printVarSummary(slp)
> slp_flip = lonFlip(slp)
> printVarSummary(slp_flip)
> ;***********************************************************
> ; remove annual cycle
> ;***********************************************************
> slp_ann = rmMonAnnCycTLL(slp_flip)
> ;*****************************************************************
> ; calculate slp for season DJF
> ;****************************************************************
> season = "DJF"
> slp_seas = month_to_season(slp_ann,season)
> nyrs = dimsizes(slp_seas&time)
> printVarSummary(slp_seas)
> ;****************************************************************
> ; select stations
> ;***************************************************************
> ; select northern station
> latS1 = 64
> latN1 = 67
> lonL1 = -18
> lonR1 = -19
> slp1 = slp_seas(time|:,{lat|latS1:latN1},{lon|lonL1:lonR1})
> ; select southern station
> latS2 = 37
> latN2 = 38
> lonL2 = 24
> lonR2 = 26
> slp2 = slp_seas(time|:,{lat|latS2:latN2},{lon|lonL2:lonR2})
>
> ;***************************************************************
> ; calculate the standardize anomlaies for the season DJF
> ;***************************************************************
> slp1_std = dim_standardize_n_Wrap(slp1,1,0)
> slp2_std = dim_standardize_n_Wrap(slp2,1,0)
>
> ;****************************************************************
> ; calculate the difference
> ;****************************************************************
> Delta = slp2_std - slp1_std
> copy_VarCoords(slp1_std, Delta)
>
> if(any(ismissing(Delta))) then
> print("Your data contains some missing values. Beware.")
> end if
> if (any(isnan_ieee(Delta))) then
> value = -1.e34
> replace_ieeenan (Delta, value, 0)
> Delta@_FillValue = value
> end if
> printVarSummary(Delta)
> printMinMax(Delta,0)
>
> ;*****************************************************************
> ; Plot
> ;*****************************************************************
> yrStart = 1978
> yrLast = 2007
> yyyymm = yyyymm_time(yrStart, yrLast, "integer")
> yyyyfrac = yyyymm_to_yyyyfrac(yyyymm,0.0)
>
> wks = gsn_open_wks("pdf","time")
> res = True
> res@trXMinF = yrStart ; starting point along X axis
> res@trXMaxF = yrLast+1 ; ending point along X-axis
> res@vpWidthF = .7 ; stretch the plot to be wider (in NDC units)
> res@vpHeightF = .25 ; and not as tall
> res@vpXF = .15 ; set the start point along the X-axis in NDC units
>
> plot = gsn_csm_xy(wks,yyyyfrac,Delta,res)
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jul 1 08:10:12 2013

This archive was generated by hypermail 2.1.8 : Mon Jul 01 2013 - 12:35:42 MDT