Unlocking the mysteries of ripples and dunes