Calculate average values from observations within a distance weighted by the square of the inverse distance

7691
22
Jump to solution
06-02-2016 10:54 PM
ZHIZUO
by
Deactivated User


I have a shape file for U.S. county centroid, and another shape file for temperature point observations across the U.S.

I'd like to calculate the average temperature for each of the county centroid, from the temperature observations within a certain distance of the centroid, weighted by the square of the inverse distance. Could anyone let me know which tool(s) should I use to get this outcome? Thanks very much in advance.

Alec

0 Kudos
22 Replies
ZHIZUO
by
Deactivated User

That is very much appreciated.

0 Kudos
AbdullahAnter
Honored Contributor

The model is ready.

Just you should add field for average temperature to county centroid shape file before use the model.

you can download the model in attachment

and the picture below for model design

Export Graphic.png

0 Kudos
ZHIZUO
by
Deactivated User

Hi Abdullah, thank you so much for this. I will try this next Monday. Will let you know how it goes.

AbdullahAnter
Honored Contributor

You will find two model

First for none weighted Just( mean temperature)

Second for weighted by the square of the inverse distance with the following equation:

                      Sqr (1 / Distance ) * temperature value




 
 
 
 
 
 
 
 
 
 
 




0 Kudos
ZHIZUO
by
Deactivated User

I think the model is working. It has been a few hours and it is still running. I have over 4000 temperature points and over 3000 county centroids. This is probably why it takes so long.

And just to make sure, the second is weighted by the inverse of  distance squared -- (1/distance*distance), not the inverse of square root of distance -- 1/sqrt(distance), right? I saw you had them both above.

0 Kudos
AbdullahAnter
Honored Contributor

The number of temperature points will not cause any problem, but 3000 county centroid is mean 3000 iterations in model.

and it will take long time.

the two equation above is same.

The first equation for VB in field calculator and it give the same result of the second manual equation  .

If you want other one please write it in manual form . thanks

0 Kudos
DanPatterson_Retired
MVP Emeritus

I think the confusion is arising because the thread title says ... square of the inverse distance... whereas it appears he wants based upon inverse distance squared, perhaps the desired incarnation needs to be specified.  For some variants... you can add your own

>>> import math
>>> distance = 4
>>> 1.0/(distance*distance)   # inverse distance squared
0.0625
>>> math.sqrt(1.0/distance)   # square root of the inverse distance
0.5
>>> math.pow((1.0/distance),2) # alternate
0.0625
>>>
0 Kudos
ZHIZUO
by
Deactivated User

Okay, I think the weighting in Abdullah's model is not what I meant then. I wanted to use either row 03 or row 07 in Dan's response. Could you let me know how to edit the model? Thank you very much.

0 Kudos
AbdullahAnter
Honored Contributor

I updated the model  as row 03 in Dan reply.

I think that what you want, isn't that?

you can download it in attachments.

ZHIZUO
by
Deactivated User

Thank you so much! Yes, this is what I want.