[ncl-talk] wind vector query

Karin Meier-Fleischer meier-fleischer at dkrz.de
Thu May 21 07:18:16 MDT 2015


Hi Kunal,

the error message tells you exactly what the problem is:

--> in line 12 you are using 3 dimensions but the variable
       seems to have only 2 dimensions.

You are using:
    u = a->U(0,:,:)     but it seems to be    u = a->U(:,:)
    v = a->V(0,:,:)     but it seems to be    v = a->V(:,:)

Do the following printVarSummary calls to see the number of
dimensions of the variables:
    printVarSummary(a->U)
    printVarSummary(a->U)

Bye,
Karin

Am 21.05.15 um 14:37 schrieb Kunal Bali:
> Dear NCL users
>
>
> i am trying to plot the wind vector data using attached script but 
> getting errors (below the scripts )
>
> variables are U and V
>
> ;----------------------------------------------------------------------
>
> load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "/usr/local/lib/ncl/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
> begin
> ;---Read data
>   a   = addfile("/home/kunal/Pictures/NCL_Scripts/plot/wind.nc 
> <http://wind.nc>","r")
>
> ;---Read in zonal [u] and meridional [v] winds
>    u = a->U(0,:,:)
>    v = a->V(0,:,:)
>
>
> ;---Create plot
>   wks_type = "pdf"
>   wks_type at wkPaperSize = "A4"
>   wks = gsn_open_wks(wks_type, "wind")
>
>   cmap = read_colormap_file("BlAqGrYeOrReVi200")
>
>   res                                  = True
>   res at vcMinFracLengthF    = 1.0                 ;-- length of min 
> vector as
>   res at vcRefMagnitudeF      = 3.0                 ;-- make vectors larger
>   res at vcRefLengthF          = 0.045               ;-- ref vec length
>   res at vcGlyphStyle            = "CurlyVector"       ;-- turn on curly 
> vectors
>   res at vcMinDistanceF        = 0.01              ;-- thin out vectors
>   res at tiMainString               = "DKRZ NCL Workshop: vector curly"
>
>
>   plot=gsn_csm_vector(wks,u,v,res)  ; create plot
>
>
> end
>
>
>
>
> *fatal:Number of subscripts do not match number of dimensions of 
> variable, (3) subscripts used, (2) subscripts expected
> fatal:["Execute.c":8567]:Execute: Error occurred at or near line 12 in 
> file wind.ncl
>
>
> *
> *Kunal Bali*

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150521/052508e0/attachment.html 


More information about the ncl-talk mailing list