scripting histogram

Mike Fiorino fiorino at LLNL.GOV
Mon Jan 24 16:54:22 EST 2005


Dear Jean Pierre et al.

see

http://tenkimap.com/grads/udf/grhist.tar

it's a bit of .c that links to .o from the grads source build, so if you
haven't built grads from source, you would need to to use this user defined
function to do histograms.  the tarball includes a sample .gs and data file
and .png of the plot produced by the .gs to verification.

this is NOT a turnkey s/w system, you'll have hack the Makefile and add a
udf entry in your udf table.  If you don't know about udf, then you'll need
to read up on user defined functions in the grads doc.  the code is provided
as is, with no support, but may help you solve your problem.  I have used
this script to locate the "median" model from a set of mdel integrates on a
grid-point basis.

hope it helps.

BR/

Mike


> -----Original Message-----
> From: GRADSUSR at LIST.CINECA.IT
> [mailto:GRADSUSR at LIST.CINECA.IT] On Behalf Of Jean Pierre Arabonis
> Sent: Monday, January 24, 2005 1:23 PM
> To: GRADSUSR at LIST.CINECA.IT
> Subject: scripting histogram
>
> Hi all
>     I'm back to my histogram plotting and after looking at
> various options I returned to the one posted some time back
> on the list, the results looked odd, but the method elegant.
> After taking a deep look at the results I found a problem
> that I cannot fathom, a variable is reassigned and just
> simply does not get re-assigned, I tried to make the variable
> global with no success as well as setting it to a value.
> Below is the offending part as well as output that I receive
> in the console.
>     Please help I'm at my wits end.
>     Thanks
>        Jean Pierre
>
> **************************************************************
> *****************
> *********    Main Loop through Variable values and group into bins
> while (t<=n)
>  'set gxout value'
>  'set t 't
>  'd 'var
> * res=subwrd(result,10)
> res=subwrd(result,4)
> *say 'value is ' res tested thus far and working
>
> **************   Determine which bin location the data is located
>     bin=1
>     say 'mint is : ' mint
> templ = mint
> *temp1 = 2
>     tempu=mint+dx
>
>     say 'Variables are : mint: ' mint ' temp1: ' temp1 ' dx: ' dx '
> tempu: ' tempu
>
>     while (bin <=nbin)
>        say 'old temp1 is : ' temp1 'and dx is : ' dx
>        temp1 = temp1+dx
>        say 'New temp1 is ' temp1
>        tempu=tempu+dx
>        say 'temp u is: ' tempu ' value is: ' res
>        if (t <2); tval.bin=tempu;endif
>        if (res > templ & res < tempu);num.bin=num.bin+1;endif
>        bin=bin+1
>     endwhile
> **************
>
> t=t+1
> endwhile
>
> ***************
>
> Console Output
> mint is the lowest variable value
>
>
>
> This may take a moment.
> dx or increment is 1.116
> mint is : 2
> Variables are : mint: 2 temp1: temp1 dx: 1.116 tempu: 3.116
> old temp1 is : temp1and dx is : 1.116 Non-numeric args to
> numeric operation
>   Error occurred on line 138
>   In file /home/arabonis/pdf2.gs
> ga->\\
>
> --
> Jean Pierre Arabonis
> arabonis at egs.uct.ac.za
> Tel 021 780 1021 cell 084 401 1365
> This email is 100% Microsoft Free
>



More information about the gradsusr mailing list