Select rows within group before condition is met
A single window function in a subquery should do the trick:

SELECT *
FROM  (
   SELECT *, count(*) FILTER (WHERE height = 0)
                      OVER (PARTITION BY traj_id ORDER BY timestamp) AS ct0
   FROM   trajectory_data
   ) sub
WHERE  ct0 = 0;


This counts occurrences of 0 along the timeline per traj_id, and only keeps rows before the first one pops up. Voilá.

db&lt;>fiddle here

Related:


Return counts for multiple ranges in a single SELECT statement
Select longest continuous sequence