[ncl-talk] Dimension error in Overlay plot

S Br sbr.climate at gmail.com
Wed Oct 2 09:25:01 MDT 2019


Hi Rick,
Thanks for your quick response. The error message indicates to the
following line.
overlay(plot,plotb)

Both variables has same dimension but don't know why this error appears.
I also checked that individual variables are displaying fine for the line
plot. The error comes when I use overlay.

Best,
SB



On Wed, Oct 2, 2019 at 4:14 PM Rick Brownrigg <brownrig at ucar.edu> wrote:

> Hi,
>
> Impossible to tell -- the script fragment had only 40-some lines, whereas
> the error message points to line #82.  Can you tell us what line that
> corresponds to?  In any case, the error message indicates the problem -
> there's a mismatch between expected dimensionality and the actual
> dimensions that you'll need to address somehow.
>
> Rick
>
>
> On Wed, Oct 2, 2019 at 8:49 AM S Br via ncl-talk <ncl-talk at ucar.edu>
> wrote:
>
>> Hi All,
>> I am trying to prepare a line plot  (having two lines) using Overlay
>> function. Both individual lines are working fine, but I get the following
>> error message when I use the Overlay function.
>>
>> fatal:Number of elements of dimension (0) of argument (0) is (2) in
>> function (overlay), expected (1) elements
>> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 82 in
>> file lineplot.ncl
>>
>> My script and PrintVarSummary are given below.
>>
>> ;create plot
>> ;************************************
>>   wks = gsn_open_wks("x11","lineplot")             ; send graphics to PNG
>> file
>>   plot = new(2,graphic)                         ; create graphic array
>>   times = (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12/)
>>   xlabels = (/"J", "F","M","A","M","J","J","A","S","O","N","D"/)
>>   res                     = True
>>   res at gsnDraw             = False            ; don't draw
>>   res at gsnFrame            = False            ; don't advance frame
>>   res at vpHeightF = 0.40        ; Changes the aspect ratio
>>   res at vpWidthF  = 0.60
>>
>>   res at xyMarkLineMode = "MarkLines"               ; Markers *and* lines
>>   res at xyDashPattern  = 0                         ; Make curves all solid
>>   res at xyLineThicknesses = 3.0          ; make second line thicker
>>   res at xyLineColors      = "black"          ; change line color
>>   res at xyMarkers      = 5               ; 3 different markers
>>   res at xyMarkerSizeF  = 0.015
>>   res at xyMarkerThicknesses = 3
>>
>>   res at tmYROn                = False
>>   res at trYMinF               = 0.              ; Make sure Y axis starts
>> at 0.
>>   res at trYMaxF               = 10.             ; Make sure Y axis starts
>> at 0.
>>   res at trXMinF               = 0.              ; Make sure Y axis starts
>> at 0.
>>   res at trXMaxF               = 13.             ; Make sure Y axis starts
>> at 0.
>>   res at tiYAxisString         = ""
>>   res at gsnCenterString     = "SurTemp (K)"         ; change Center string
>>   res at gsnRightString     = ""         ; change Center string
>> ;************
>>   res at tmXBMode  = "Explicit"
>>   res at tmXBValues      = (/1, 2, 3, 4, 5, 6, 7,8,9,10,11,12/)
>>   res at tmXBLabels = (/"J", "F","M","A","M","J","J","A","S","O","N","D"/)
>> ;************
>>   plot = gsn_csm_xy(wks,times, obssats(:), res)
>> ;  res at xyLineColors      = "red"          ; change line color
>> ;  res at xyMarkerColors    = "red"
>>   plotb = gsn_csm_xy(wks,times, ctrlsats2(:), res)
>>   overlay(plot,plotb)
>>
>>    draw(plot)
>>    frame(wks)
>> end
>> ################################
>>
>> VarSummary of two variables:
>>
>> Variable: obssats
>> Type: float
>> Total Size: 48 bytes
>>             12 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [time | 12]
>> Coordinates:
>>             time: [-657073..-656739]
>> Number Of Attributes: 13
>>   _FillValue : -9.96921e+36
>>   actual_range : ( 0.0005604419, 30.16107 )
>>   parent_stat : Mean
>>   statistic : Long Term Mean
>>   level_desc : Surface
>>   dataset : GPCP Version 2.3 Combined Precipitation Dataset
>>   var_desc : Precipitation
>>   least_significant_digit : 2
>>   precision : 32767
>>   units : mm/day
>>   long_name : Long Term Mean Average Monthly Rate of Precipitation
>>   missing_value : -9.96921e+36
>>   wgt_areaave_op_ncl : Area Average
>>
>>
>> ariable: ctrlsats2
>> Type: float
>> Total Size: 48 bytes
>>             12 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [time | 12]
>> Coordinates:
>>             time: [ 588.. 599]
>> Number Of Attributes: 8
>>   surface : 0
>>   wgt_areaave_op_ncl : Area Average
>>   missing_value : 2e+20
>>   long_name : TOTAL RAINFALL
>>   units : MM/DAY
>>   grid_type : gaussian
>>   lev_type_char : surfa
>>   _FillValue : 2e+20
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191002/d449d0ee/attachment.html>


More information about the ncl-talk mailing list