# [ncl-talk] inverse weighted distance

Dennis Shea shea at ucar.edu
Sun Oct 14 17:36:05 MDT 2018

```Distance:
*http://www.ncl.ucar.edu/Document/Functions/Built-in/gc_latlon.shtml*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/gc_latlon.shtml>

On Sat, Oct 13, 2018 at 1:19 AM Kunal Bali <kunal.bali9 at gmail.com> wrote:

> Dear NCL users,
>
> I need to calculate the inverse weighted distance according to the
> attached figure
>
> The formula is
> *xAvg = SUM[X/w]/SUM[1/w]*.  equation (1)
>
> So first I need to calculate the distance from surrounding grid cells to
> the receptor cell
>
> receptor cell coordinates
>   latz = (/23.285/)
>   lonz = (/77.276/)
>
> I don't know how to calculate this distance from single receptor site to
> its surroundings grid cells. Surrounding grid cells spread ~500 km.
>
>
> I have calculated the *X* here (which is a coefficient of divergence)
>
> and the coefficient of divergence is calculated as
>  ;-----calculation of the coefficient of divergence
>    DATA_SINGLE_3D = conform(data_subset, data_single, 0)
>    x1 = (DATA_SINGLE_3D - data_subset)
>    x2 = (DATA_SINGLE_3D + data_subset)
>    CoD1   = (x1/where(x2.ne.0,x2,x2 at _FillValue))^2
>
>    CoD2 = dim_avg_n_Wrap(CoD1, 0)    ; (nlat,mlon)
>    CoD_final = sqrt(CoD2)
>
>
>
>
> So please provide some information on that. I have attached the script
> here.
>
> regards
> ---
> Kunal Bali
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181014/6e8c9b31/attachment.html>
```