AnsweredAssumed Answered

ArcPy: Finding Local Maxima of Groups in an Attribute Table

Question asked by k_kent1 on Oct 21, 2014
Latest reply on Oct 22, 2014 by k_kent1

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.

Outcomes