[Radiance-general] calculating percentages of a given value in a
.dat / .ok file
Andrew Mcneil
amcneil at lbl.gov
Wed Mar 10 19:09:50 PST 2010
Oops! Lars you're right. I should have looked closer at the emails Nick
referenced.
Nick, you'll need some of what I gave you to get from rtrace output to
illuminance:
rtrace ... | rcalc -e '$1=($1*0.265+$2*0.670+$3*0.065)*179' > test.dat
Then what Lars gave to calculate the percent of points above a threshold.
On Wed, Mar 10, 2010 at 5:31 PM, Lars O. Grobe <grobe at gmx.net> wrote:
> Hi,
>
> I am not sure whether Nick wants to find out the fraction of the required
> illuminance level each point achieves (that is what Andrew calculates) or
> the fraction of (the amount of) points that meet the criteria. For the
> second you have three steps involved:
>
> 1) filter the input according to you treshold (300lx)
> 2) count the value meeting the criteria
> 3) divide by the total number of points and multiply by 100 to get a
> percentage
>
> This can be translated like into:
>
> cat test.dat | rcalc -e '$1=1; $2=if($1-299,1,0)' | total | rcalc -e
> '$1=100*$2/$1'
>
> The first step, rcalc, takes one column (you can adapt this according to
> your input file) and writes out two columns. The first is set to 1 for any
> input, the second is set to one for inputs > 2990 and to 0 for anything
> below.
>
> The second step, total, sums up the result of the first step. You get the
> sums of two columns - two numbers, the first being the amount of original
> input values, the second the amount of values that are above 299.
>
> The third step, rcalc again, divides the number of points meeting the
> criteria by the total number of values and multiplies this by 100. This
> results in the percentage of values meeting the criteria.
>
> There are quicker ways to achieve this, but I wanted a transparent format
> that one can explain. Hope this helps, cheers
>
> Lars.
>
>
> _______________________________________________
> Radiance-general mailing list
> Radiance-general at radiance-online.org
> http://www.radiance-online.org/mailman/listinfo/radiance-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://radiance-online.org/pipermail/radiance-general/attachments/20100310/48383e87/attachment-0001.htm
More information about the Radiance-general
mailing list