相关的依赖库在我的github网站上
首先贴出代码:
import solar
from gradient import *
from shadows import *
import numpy as np
import matplotlib.pyplot as plt # plt 用于显示图片
import matplotlib.image as mpimg # mpimg 用于读取图片
# dem
import srtm
if __name__ == '__main__':
'''
# 另一种从网上直接下载DEM数据
geo_elevation_data = srtm.get_data()
image = geo_elevation_data.get_image((500, 500), (45, 46), (13, 14), 300)
# the image s a standard PIL object, you can save or show it:
image.show()
image = np.asarray(image)
print(image.shape)
'''
# 读入高程信息
filename = 'dempyrenees.asc'
dem = np.loadtxt(filename,skiprows=6,delimiter=' ')
# 高程信息的维度
# print(dem)
print(dem.shape)
# 定义一个光线向量<