Skip to content

Instantly share code, notes, and snippets.

@dbuscombe-usgs
dbuscombe-usgs / hillshade.py
Created March 27, 2015 12:48
shaded relief algorithm in python
import numpy as np
def cart2pol(x, y):
'''
cartesian to polar coordinates
'''
theta = np.arctan2(y, x)
rho = np.sqrt(x**2 + y**2)
return (theta, rho)