Last post about topos and piles forever.. Hopefully..
EDIT: I've edited this post to reflect some changes done to my original script and that units handling in Dynamo has changed (for the better.) The script is way easier now. Among other things I recommend using the topography handling provided in the spring nodes package.
Here is the light version of the script. Selecting the piles in question is a matter of choice. I went for the simplest in the example.