ArcPy: Finding Local Maxima of Groups in an Attribute Table

1515
2
10-21-2014 02:10 PM
kevinkent
New Contributor

I'm still a beginner with ArcPy and I'm wondering how I can write a script that can iteratate through a table and find the LOCAL maxima of each group

I've spent a lot of time looking into the arcpy.da.UpdateCursor module but I can't figure out how to go group by group and look at values in more than one row at a time. 

Can this even be done? I've also looked at converting the table into a NumPy array but I am also lost there.

I've included this example to illustrate what I'm looking for. I am thinking using the update cursor to change the values of Field 03 from 0 to 1 for the records that represent local maxima would be helpful but I'm sure there are other ways to go about this.

Field 01: Group(Integer)

Field 02: Length(Double)

Field 03: For Flagging desired fields(integer)

ID     Field 01  Field 02     Field 03

01     10          07.0               0

02     10          09.0               0

03     10          03.0               0

04     10          11.0               0

05     12          18.0               0

06     12          16.0               0

07     12          02.0               0

08     12          07.0               0

09     12          04.0               0

Results would be:

ID     Field 01  Field 02      Field 03

02     10          09.0               1

04     10          11.0               1

05     12          18.0               1

08     12          07.0               1

Thank you for any help.

0 Kudos
2 Replies
DallasShearer
Occasional Contributor

the summary statistics tool may be the easiest for you to implement.

ArcGIS Help 10.1

0 Kudos
kevinkent
New Contributor

Thanks for the suggestion but as far as I know summary statistics would only work if there was one maximum for each group. Some groups have multiple local maxima that I need to find also.

0 Kudos