Skip to content

Instantly share code, notes, and snippets.

@john-science
Last active August 29, 2015 14:18
Show Gist options
  • Save john-science/25720b9e4660cc10705e to your computer and use it in GitHub Desktop.
Save john-science/25720b9e4660cc10705e to your computer and use it in GitHub Desktop.
How far can you see?
'''
How far away is the horizon?
How far away is that mountain?
How far away can something (on the Earth) be that I can still see it?
All good questions. Let's answer them.
'''
from math import sqrt
# reference: http://en.wikipedia.org/wiki/Earth_radius
EARTH_RADIUS = {'km': 6378.1370 'miles': 3963.1906}
def distance_to_horizon(elevation, units='km', refraction=True):
'''From basic geometry, you can calculate the distance to the
horizon, based on your elevation.
Source: http://www-rohan.sdsu.edu/~aty/explain/atmos_refr/horizon.html
'''
r = EARTH_RADIUS[units] * ((7.0/6) if refraction else 1.0)
return sqrt(2.0 * r * elevation + elevation ** 2)
'''
All right, we can calculate the distance to the horizon. But how far away
is that mountain? How far away could the mountain be that we could still
see it? Or...
But how far can we see?
'''
def max_distance_you_can_see(elevation1, elevation2, units='km', refraction=True):
'''The furthest distance you can see is the sum of your horizon distance
and the horizon distance for the object you are looking at.
'''
return distance_to_horizon(elevation1, units, refraction) +
distance_to_horizon(elevation2, units, refraction)
'''
Now that we have our math, let's see how much more we know about the world.
QUESTION: How far can you see on the open ocean?
ANSWER:
I will assume you are 6 feet tall.
5.2 km (3.2 miles)
QUESTION: I live in the US (lower 48 states), what is the
farthest distance I can hope to see?
ANSWER:
The tallest thing in the lower 48 states is Mount Whitney
at 14,505 feet (4.221 km). If you stood at the top and
looked out at a mountain nearly as high, you could see:
318.7 miles (512.8 km)
QUESTION: What's the farthest distance I could see on the Earth?
ANSWER:
Mount Everest is the tallest mountain on Earth at
8.848 km (29,029 ft or 5.5 miles). If you stood at the top and
looked out at a mountain nearly as high, you could see:
725.7 km (450.9 miles)
QUESTION: I live near San Francisco and there's always this
mountain off in the distance. I can even see it from Sacramento
and San Jose. How far away CAN I see this mountain?
ANSWER:
That mountain is Mount Diablo. It is so prominent that the
city of Mountain View is named after it. The taller of its
dual peaks is 3,848 feet (1.17 km) tall.
Let's assume you can get up 100 feet or so, just to get a
clear view over the trees and buildings. From such a vantage
you could see Mount Diablo from:
95.3 miles (153.3 km)
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment