Re: retrieve values of NumInBins

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 19 Jul 2006 09:12:35 -0600 (MDT)

On Wed, 19 Jul 2006, Liangying Zhang wrote:

> It worked with Dennis' solution. But I have a panel with 4 plots, which I
> put them into an array. When I tried
> plot(0) = gsn_histogram(...)
> nBins = plot(0)@NumInBins
> I got error message says:
> fatal:syntax error: line 115 in file plot.GPSpw.seasonalerror.ncl before
> or near @NumInBins
> a = plot(0)@NumInBins
> --------------------------------^
> It gave me syntax error if I add array index
> My solution was to put nBins = plot_at_NumInBins after each plot, it
> works ok, but is there any good way to handle this case?
>
> Thanks,
> Liz
>

Hi Liz,

What you are doing should work perfectly fine. However, if you need
to keep the "NumInBins" values around for some reason, then the best
thing to do is create an array the same size as "plot" that will
hold each of the "NumInBins" values returned by each plot call:

   nBins = new(dimsizes(plot),integer)
   ...
   do i=0,...
     plot(i) = gsn_histogram(...)
     nBins(i) = plot_at_NumInBins
     ...
     a = nBins(i)
     ...
   end do

--Mary

> Dennis Shea wrote:
>
> I believe there is a simple way to retrieve values of attribute
> "NumInBins" from histogram plots. When I just print plot, it only shows
> NumInBins : <ARRAY>
> how to get the exact values?
>
>
> plot = gsn_histogram(...)
>
> nBins = plot_at_NumInBins
>
> good luck
> D
>
>
>
>
>
> --
> ***********************
> Liangying Zhang
> NCAR/ATD
> Email: lzhang_at_ucar.edu
> Phone: 303-497-2025
> Fax : 303-497-8770
> ***********************
>
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 19 2006 - 09:12:35 MDT

This archive was generated by hypermail 2.2.0 : Wed Jul 19 2006 - 09:13:26 MDT