# [GRASSLIST:7052] Re: calculating center of intensity

Tue Jun 7 08:04:48 EDT 2005

```Chuck,

I pretty much figured that was the case. If Jason is doing what I think
he is doing, namely, to track storm cell life cycles & movement in order
to develop statistics and an algorithm for predictive purposes, he's
going to need to process a huge volume of data. So, the manual steps of
identifying individual cells and zooming in will be extremely tedious.
He needs something to automate the process.

BTW, last I remember (years ago), you moved to NYC -- so I guess you're
back in the midwest?

Regards,
Tom

Charles Ehlschlaeger wrote:

> Tom,
>
> I purposely threw in that caveat because I assumed that a human would
> have to decide what a storm pattern was. If an algorithm automatically
> found storm cells of contiguous positive rainfall values, there might
> be splinter cells a meteorologist would consider part of the same
> pattern. Ergo, I would expect the user to zoom to a region with a
> single rain event and mask out any areas they didn't consider part of
> that storm. Then, a variation of the procedure below would do the
> trick. As Hamish suggests, r.univar is probably better than r.volume.
>
> sincerely, chuck
>
>
>> Chuck,
>>
>> Does this assume you only have one raster map cell shape? What if
>> there are multiples, which is what I think Jason has? I think, then,
>> you would get a single center of mass for the cluster of separate cells.
>>
>> Tom
>>
>>
>> Charles Ehlschlaeger wrote:
>>
>>> I don't have GRASS working on my computer to check this out,
>>> however, here is a procedure to calculating the center of a shape:
>>>
>>> Assume you have a raster map "shape" where the value of 0 is at all
>>> places w/out the shape and a positive value where the shape is
>>> located at.
>>>
>>> 1) Find the total volume of the shape w/:
>>>
>>> 1a) r.mapcalc command function:
>>> one = "1"
>>>
>>> 1b) r.volume d=shape clump=one
>>>
>>> (There should be a better way of doing this.)
>>>
>>> 2) Calculate volumeOnAxis of shape in North-South dimension with the
>>> r.mapcalc command:
>>>
>>> NSvolumeOn = shape * y()
>>>
>>> 3) Calculate massOnAxis of shape in East-West dimension with the
>>> r.mapcalc command:
>>>
>>> EWvolumeOn = shape * x()
>>>
>>> 4) Find the total volume of NSvolumeOn with:
>>>
>>> r.volume d= NSvolumeOn clump=one
>>>
>>> 5) Find the total volume of EWvolumeOn with:
>>>
>>> r.volume d= NSvolumeOn clump=one
>>>
>>> 6) The coordinates of the center will be
>>> east = total volume of EWvolumeOn / volume of shape
>>> north = total volume of NSvolumeOn / volume of shape
>>>
>>> A little csh and awk programming could replicate Idrisi's center
>>> program.
>>>
>>> <INSERT DISCLAIMERS ABOUT USING AT OWN RISK...>
>>>
>>> sincerely, chuck
>>>
>>> Markus Neteler wrote:
>>>
>>>>On Thu, Jun 02, 2005 at 03:42:36PM -0400, Jason Horn wrote:
>>>>
>>>>
>>>>>Does anyone know of a way to calculate the center of a shape in a
>>>>>raster file based on shape and pixel values?  For example, imagine a
>>>>>NEXRAD RADAR image showing a storm cloud.  Could GRASS be used to
>>>>>calculate the center of the cloud?  I'm not having any luck finding a
>>>>>grass raster function to do this.
>>>>>
>>>>>
>>>>
>>>>I did a quick google search for
>>>>or
>>>>which a couple of hits. Some programming might
>>>>be needed. I don't know if these algorithms are freely
>>>>available.
>>>>
>>>>Markus
>>>>
>>>>
>>>>
>>>
>>>
>>>--
>>>Chuck Ehlschlaeger, Associate Professor & GIS Center Director
>>>Department  of  Geography,      Western  Illinois  University
>>>306C Tillman Hall,  1 University Circle,  Macomb,  IL   61455
>>>cre111 at wiu.edu,    phone: 309-298-1841,     fax: 309-298-3003
>>>
>>
>>--
>>National Weather Service
>>Ohio River Forecast Center
>>1901 South State Route 134
>>Wilmington, OH 45177
>>
>>
>>VOICE:	937-383-0528
>>FAX:	937-383-0033
>>
>
>
>--
>Chuck Ehlschlaeger, Associate Professor & GIS Center Director
>Department  of  Geography,      Western  Illinois  University
>306C Tillman Hall,  1 University Circle,  Macomb,  IL   61455
>cre111 at wiu.edu,    phone: 309-298-1841,     fax: 309-298-3003
>

--
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177