[ncl-talk] "bug" in get_ref_line_options v6.4.0

Alan Brammer abrammer at albany.edu
Tue Jan 16 13:52:02 MST 2018


oh my bad, I followed that line incorrectly and got distracted by the line
above.    So it's not an int to float error, it's a float to double
problem.


nref                   = 0
ref_line               = fmsg
...
ref_line = get_res_value_keep(rfres,"trYMinF",min(y))


grep -A 19  "ref_line               = fmsg"
$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl

  ref_line               = fmsg
  ref_line_on            = False
  ref_line_color         = cmsg
  ref_line_pattern       = imsg
  ref_line_thickness     = fmsg
  ref_grtr_curve_fill_on = False
  ref_less_curve_fill_on = False
  ref_fill_color_g       = cmsg   ; greater than
  ref_fill_color_l       = cmsg   ; less than

;
; If neither gsnYRefLine or gsnXRefLine are set, but gsnXYBarChart has
; been set, then assume the user wants a Y reference line, and return
; a default value for Y ref line.
;
  bar_chart        = get_res_value_keep(rfres,"gsnXYBarChart",False)
  bar_outline_only =
get_res_value_keep(rfres,"gsnXYBarChartOutlineOnly",False)
  if(.not.isatt(rfres,"gsnYRefLine").and..not.isatt(rfres,"gsnXRefLine"))
then
    if(reftype.eq."y".and.bar_chart.and..not.bar_outline_only) then
      ref_line = get_res_value_keep(rfres,"trYMinF",min(y))




Code to reproduce the error:

x= fspan(0,10,11)
y = todouble(fspan(0,10,11))

wks = gsn_open_wks("x11","")
res = True
res at gsnXYBarChart = True
plot = gsn_csm_xy(wks, x, y, res)




On Tue, Jan 16, 2018 at 3:27 PM, Mary Haley <haley at ucar.edu> wrote:

> Hi Alan,
>
> I couldn't find the particular line you are referring to. I also grepped
> for "ref_line" and then "0" and don't see a reference to setting ref_line
> to 0.  I do, however, believe this might have been a bug in an older
> version of NCL.
>
> Are you sure this is NCL V6.4.0 where you saw the issue? Here's how I did
> the grep:
>
>  % grep ref_line $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl | grep
> "0"
>
>
> and here are the results that came up:
>
>       ygrtr(i,0:ngrtr(i)-5:5)  = ref_lines(i)
>
>       yless(i,0:nless(i)-5:5) = ref_lines(i)
>
>       yequal(i,0:nequal(i)-1:5) = ref_lines(i)
>
> ;;    return(conform_dims((/nref,4/),ref_line_color(0,:),1))
>
>     ref_line_pattern := rfres@$pattern_res1$(0)
>
>     ref_line_pattern = 0
>
>     ref_line_pattern := 0
>
>     ref_line_thickness = rfres@$thickness_res1$(0)
>
>     ref_line_thickness = 1.0
>
>     ref_line_thickness := 1.0
>
>       ref_line_pattern   := 0
>
>       ref_line           := get_res_value_keep(rfres,"gsn" +
> str_upper(reftype)+"RefLine",0)
>
>   ref_line    := get_res_value_keep(rfres,"gsn" +
> str_upper(reftype)+"RefLine",0)
>
>       yref_line = yref_line_list[0]
>
>       xref_line = xref_line_list[0]
>
> Can you type this on your end and see if you get something different?
>
>
> Thanks,
>
> --Mary
>
>
>
> On Tue, Jan 16, 2018 at 8:34 AM, Alan Brammer via ncl-talk <
> ncl-talk at ucar.edu> wrote:
>
>> NCL devs:
>>
>> Came across a bug in 6.4.0 when plotting a bar chart through gsn_csm_xy()
>> that stems to a call to get_ref_line_options()
>>
>> at line 4588 in gsn_csm.ncl a variable is initialised as
>>       ref_line = 0 ; setting ref_line to be an integer
>>
>> but then a couple lines down on line 4607  there is:
>>     ref_line = get_res_value_keep(rfres,"trYMinF",min(y))
>> but unless y or trYMinF are integers this will fail with an Assignment
>> Type mismatch.
>>
>>
>> Easy fix is to replace = with := on line 4607 in gsn_csm.ncl  (line 23
>> of get_ref_line_options)
>>
>> Function doesn't appear to exist in versions before 6.4.0 so seems like a
>> new problem.
>>
>>
>> Thanks,
>>
>> Alan
>>
>> _______________________________________________
>> 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/20180116/d507ba9a/attachment.html>


More information about the ncl-talk mailing list