Question: How to extract positive items from list of elements that have units

I have a solution to a physics free-fall problem:

times := -2.019619977*Unit('s'), 2.019619977*Unit('s')

I would like to extract the positive values.

After some tinkering, I came up with this solution:

sol:=[][]:
for i in times do:
    val := Split(i, output = coefficient):
    if 0 <= val then:
        sol := sol, val*Unit('s'):
    end if:
end do:
evalf(sol,3)

2.02 s

This works, but is inelegant and requires many expressions.

Is there a simpler way, possibly a single-line expression, to accomplish this?

Please Wait...