Re: histogram problem

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Sun Feb 24 2013 - 22:49:33 MST

Hi Dave,

As far as I can tell, the plot is correct. By using gsnHistogramDiscreteBinValues, you are telling the histogram program to count the number of values *exactly* equal to 30, 60, ..., 360. All other values that are not equal to these values will not be counted.

If you write a do loop and count the number "day" values that are equal to each of your bin values:

  do i=0,dimsizes(res@gsnHistogramDiscreteBinValues)-1
    print("num values = " + res@gsnHistogramDiscreteBinValues(i) + \
          " is " + num(day.eq.res@gsnHistogramDiscreteBinValues(i)))
  end do

 you get:

(0) num values = 30 is 1
(0) num values = 60 is 1
(0) num values = 90 is 0
(0) num values = 120 is 1
(0) num values = 150 is 0
(0) num values = 180 is 0
(0) num values = 210 is 0
(0) num values = 240 is 0
(0) num values = 270 is 0
(0) num values = 300 is 1
(0) num values = 330 is 2
(0) num values = 360 is 1

The histogram plot is showing exactly the above values.

What were you expecting to get? Did you perhaps mean to use gsnHistogramBinIntervals?

--Mary

On Feb 24, 2013, at 8:28 PM, David Adams wrote:

> Hi all,
> I am try to create histogram of number of convective events for each month of the year.
> The input file is simply the integer value of the day of the year for the reported convective event. However, the plots are incorrect.
> My version of ncl is NCAR Command Language Version 6.0.0
> Any suggestions?
>
> thanks,
> Dave Adams
>
> ; test.ncl
> ; This ncl program reads in integer days of the year
> ; for for convective events to make a
> ; histogram of monthly convective events.
>
> load "/usr/local/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "/usr/local/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "/usr/local/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "/$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
> begin
> ncol1 = 1
> nlvl = 278
>
> seasonal_data = asciiread("Seasonal_dates_convective_events.dat",(/nlvl,ncol1/), "integer")
> day = seasonal_data(:,0)
>
> wks = gsn_open_wks("pdf", "Time_local_hour_event_histogram")
>
> res = True
> res@gsnDraw = False
> res@gsnFrame = False
>
> res@gsnHistogramDiscreteBinValues = ispan(30,360,30)
>
> plot = gsn_histogram(wks,day,res)
>
> delete(res@gsnDraw)
> delete(res@gsnFrame)
>
> res@tmXBMode = "Explicit" ; Define tick mark labels.
> res@tmXBValues = plot@MidBarLocs
> res@tmXBLabels = (/"J","F","M","A","M","J","J","A","S","O","N","D"/)
> plot=gsn_histogram(wks,day,res) ; create histogram
>
> draw(plot)
> end
> ~
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> <Seasonal_dates_convective_events.dat><test.ncl>_______________________________________________
> 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 Sun Feb 24 22:49:42 2013

This archive was generated by hypermail 2.1.8 : Thu Feb 28 2013 - 14:47:31 MST