[GRASSLIST:7009] Re: calculating center of intensity
Martin du Saire
mdusaire at umn.edu
Fri Jun 3 17:07:30 EDT 2005
Would the following r.mapcalc command generate a map of the x-coordinates
for the cells in a raster map?
x_coordinates=x()
If so, do the same for the y_coordinates and then calculate the center of
mass "by hand" with the help of the r.stats module (because it doesn't
appear that r.mapcalc has a sum() function).
Tedious, but I thought I would throw it out there.
Martin
At 02:29 PM 6/3/2005, you wrote:
>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
>>> nexrad storm cell identification
>>>or
>>> nexrad SCIT
>>>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
>><mailto:cre111 at wiu.edu>cre111 at wiu.edu, phone: 309-298-1841, fax:
>>309-298-3003
>
>
>--
>Thomas E Adams
>National Weather Service
>Ohio River Forecast Center
>1901 South State Route 134
>Wilmington, OH 45177
>
>EMAIL: <mailto:thomas.adams at noaa.gov>thomas.adams at noaa.gov
>
>VOICE: 937-383-0528
>FAX: 937-383-0033
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20050603/f099b427/attachment.html
More information about the grass-user
mailing list