How to select a mesh peaks and troughs
Face normals, Edge angles, and link edges count.

In your screenshot the peaks and troughs are extrusions which have a vertex edge count of 5, which is a simple test.

Can also look at the signed edge angle to find peaks and troughs. I've used 50 degrees.

And also look at face normals vs an up vector. (A simple z axis to test)

Test script run in edit mode.

import bpy
import bmesh
from math import radians
from mathutils import Vector

ob = bpy.context.object
me = ob.data
bm = bmesh.from_edit_mesh(me)

up = Vector((0, 0, 1))

#  because its an extrusion select on link edges 
for v in bm.verts:
    v.select = len(v.link_edges) == 5

test_angle = radians(50)
# select edges on face angle
for e in bm.edges:
    if e.is_boundary:
        continue
    # hills 
    e.select = ( e.calc_face_angle_signed() &gt; test_angle    
    # troughs
    or e.calc_face_angle_signed() &lt; test_angle

for f in bm.faces:
    f.select =  f.normal.angle(up) &gt; test_angle


Some combination of any or all of the tests above should cover most cases.