# Re: [idvusers] Help with Averaging NexRad scans over time.

```Ben-

Ben Kamen wrote:
```
```Anyone? Little help?
```
```
Sorry, I thought you had it down.

```
```Ben Kamen wrote:
```
```ok - so then let me know if this is possible:

I assume we are agreed on what a "gate" is....
```
```
In my world a gate is the where the radar value at a particular
range, azimuth and elevation angle (tilt) is taken.

```
```Set up two arrays of two dimensions each (az, ra). Range wants to be
even km for REF, of course. Az can be any resolution. Even degrees
(0-359) is convenient and is assumed below. The two arrays hold the
data for averaging one elevation for >1 scan (so two dimensions are
enough, but that is a detail).

SumZ    Holds the sum of Z (not dBZ) for all gates and portions of gates
```
that fall in that azimuth and range.
```
what is Z?

N       Holds the number of gates that
```
```have contributed to SumZ. This is not usually an integer.
```
```
This will be tricky to calculate.

```
```Most Nexrad gates will have azimuths that are not even integers. (An
azimuth such as 15.000 degrees is an edge case in the coding.) The
procedure is to convert each range gate's dBZ value to Z and compute
what two SumZ azimuths it overlaps. Then run along the ranges. Add
z*p and z*(1-p) to the two elements of SumZ. Add p and (1-p) to the
two elements of N.

After all the desired scans have been summed in this way, divide SumZ
by N to get average Z and convert to dBZ for displaying.

Can that be done in IDV?
```
```
It would take some non-trivial Jython or a Java program to do all
what you've asked, but conceivably, yes.  You'd have to deconstruct
each of the sweeps (elevation scan) to get the range and azimuth

Good luck!

Don
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************

```