The caterpillar was much longer than a normal caterpillar. It seemed to have come out of the hole near it, in photo. Because of the rain the hole was flooded.
In heavy rain I have spotted them sticking out of their holes hanging onto a stick or other leaf litter to keep their head above water. This is interesting, now I think further on it, because caterpillars 'breath' through a series of holes/pores (= spiracles) dotted right along the side of their body.