Re: Number of subscripts do not match number of dimensions of variable

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Aug 04 2011 - 08:15:36 MDT

Wei,

You are passing 3D arrays to gsn_csm_xy, which is expecting either 1D arrays (for a single line), or 2D arrays (for multiple lines).

The printVarSummary indicates that you have a staggered grid. You probably should unstagger it with wrf_user_unstagger:

http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_unstagger.shtml

I believe this will also reduce your 3D arrays to 2D arrays.

--Mary
 

On Aug 4, 2011, at 4:44 AM, wei huang wrote:

> Dear Respected Dennis and Mary, thank you very much for your help, however, now there is another problem which is given below. Kindly could you give me more clues about it? The code and its printVarSummary is given below.
> Thanks again
> ***********************************
> 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"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
> ;
> begin
> ;
> a = addfile("wrfout_00.nc","r")
>
> t = 0
> n = (/32,73/) ; lat index values of the points you want
> m = (/52,105/) ; lon
> w = wrf_user_getvar(a,"W",-1) ; relative humidity
> p = wrf_user_getvar(a, "pressure",-1)
> x = w(t,:,n,m)
> y = p(t,:,n,m)
> printVarSummary(x)
> printVarSummary(y)
> ;exit
> ;************************************
> wks = gsn_open_wks("x11","plt")
>
> resxy = True ; plot mods desired
> resxy@gsnXRefLine = 0.0 ; draw ref line
> resxy@trYReverse = True ; reverse Y-axis
> resxy@xyLineThicknesses = 2
> resxy@xyLineColors = (/"blue"/) ; change line colors
> resxy@trYMinF = 0.0
> resxy@trYMaxF = 1000.0
>
> resxy@pmLegendDisplayMode = "Always" ; turn on legend
> resxy@trXMinF = -10
> resxy@trXMaxF = 10
> resxy@pmLegendSide = "Top" ; Change location of
> resxy@pmLegendParallelPosF = .65 ; move units right
> resxy@pmLegendOrthogonalPosF = -0.75 ; move units down
> resxy@lgPerimOn = False
> resxy@pmLegendWidthF = 0.12 ; Change width and
> resxy@pmLegendHeightF = 0.12 ; height of legend.
> resxy@lgLabelFontHeightF = .015 ; change font height
> plt = gsn_csm_xy (wks,x,y, resxy)
>
> end
>
>
> Variable: x
> Type: float
> Total Size: 640 bytes
> 160 values
> Number of Dimensions: 3
> Dimensions and sizes: [bottom_top_stag |27] x [south_north | 2] x [west_east | 2]
> Coordinates:
> Number Of Attributes: 6
> FieldType : 104
> MemoryOrder : XYZ
> description : z-wind component
> units : m s-1
> stagger : Z
> coordinates : XLONG XLAT
>
>
> Variable: y
> Type: float
> Total Size: 624 bytes
> 156 values
> Number of Dimensions: 3
> Dimensions and sizes: [bottom_top | 27 x [south_north | 2] x [west_east | 2]
> Coordinates:
> Number Of Attributes: 6
> FieldType : 104
> MemoryOrder : XYZ
> description : Pressure
> units : hPa
> stagger :
> coordinates : XLONG XLAT
> fatal: Number of subscripts do not match number of dimensions of variable,(2) Subscripts used, (3) Subscripts expected
> fatal:Execute: Error occurred at or near line 4047 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl
>
> fatal:Execute: Error occurred at or near line 41 in file rh.ncl
>
>
> On Thu, Aug 4, 2011 at 5:17 AM, Mary Haley <haley@ucar.edu> wrote:
> Further info: you can use wrf_user_ll_to_ij to get the ij indexes of the lat/lon values you want.
>
> http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_ll_to_ij.shtml
>
> --Mary
>
> On Aug 3, 2011, at 12:05 PM, Dennis Shea wrote:
>
> > You already have the vertical velocity (w, not omega).
> > At each grid point, you have or can calculate the pressure levels
> > (bottom_top_stag) ... call it p(Time,bottom_top_stag,south_north,west_east)
> >
> > You can not use the {...} syntax because the grid is curvilinear and not
> > rectilinear, You must use standard indexing.
> >
> > t = 5
> > n = (/32, 73/) ; lat index values of the points you want
> > m = (/52, 105/) ; lon
> >
> > x = w(t,:,n,m)
> > p = p(t,:,n,m)
> >
> > plt = gsn_csm_xy (wks,x,p,resxy)
> >
> >
> > On 8/3/11 11:06 AM, wei huang wrote:
> >> Hi, could anyone give me some help to modifying the code (omega_1.ncl
> >> <http://www.ncl.ucar.edu/Applications/Scripts/omega_1.ncl>) for using
> >> the WRF output. Iím interested to plot the vertical profile like this
> >> omega plot. The wrf variable print is as follows:
> >> thanks and regards
> >>
> >> Variable: w
> >>
> >> Type: float
> >>
> >> Total Size: 130572000 bytes
> >>
> >> 32643000 values
> >>
> >> Number of Dimensions: 4
> >>
> >> Dimensions and sizes:[Time | 48] x [bottom_top_stag | 27] x [south_north
> >> | 100] x [west_east | 80]
> >>
> >> Coordinates:
> >>
> >> Number Of Attributes: 6
> >>
> >> coordinates : XLONG XLAT
> >>
> >> stagger :Z
> >>
> >> units :m s-1
> >>
> >> description : z-wind component
> >>
> >> MemoryOrder : XYZ
> >>
> >> FieldType :104
> >>
> >>
> >>
> >> _______________________________________________
> >> 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
>
>
> _______________________________________________
> 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 Thu Aug 4 08:15:42 2011

This archive was generated by hypermail 2.1.8 : Fri Aug 05 2011 - 14:53:55 MDT