我知道這已經被問過很多次在此網站上,但沒有任何解決方案對我有幫助。我運行下面的腳本給我的錯誤標題:AttributeError:'模塊'對象沒有任何屬性'grd'
import numpy as np
import fatiando as ft
shape = (41, 41)
x, y = ft.grd.regular((-10, 10, 30, 50), shape)
height = 800 - 1000*ft.utils.gaussian2d(x, y, 3, 1, x0=0, y0=37)
rel = -7000*ft.utils.gaussian2d(x, y, 3, 5, x0=0, y0=40)
thick = height - rel
dens = 1900*np.ones_like(thick)
data = np.transpose([x, y, height, thick, dens])
with open('layers.txt', 'w') as f:
f.write("# Synthetic layer model of sediments and topography\n")
f.write("# Columns are:\n")
f.write("# lon lat height thickness density\n")
np.savetxt(f, data, fmt='%g')
ft.vis.figure(figsize=(4, 3))
ft.vis.title('Depth of sediments [m]')
ft.vis.axis('scaled')
ft.vis.pcolor(x, y, rel, shape)
ft.vis.colorbar()
ft.vis.savefig('depth.png')
ft.vis.figure(figsize=(4, 3))
ft.vis.title('Topography [m]')
ft.vis.axis('scaled')
ft.vis.pcolor(x, y, height, shape)
ft.vis.colorbar()
ft.vis.savefig('topography.png')
ft.vis.figure(figsize=(4, 3))
ft.vis.title('Thickness of sediment layer [m]')
ft.vis.axis('scaled')
ft.vis.pcolor(x, y, thick, shape)
ft.vis.colorbar()
ft.vis.savefig('thickness.png')
ft.vis.show()
這個腳本是不是我自己的創作,但我已經安裝(Tesseroids)程序,所以我不預先包裝的演示腳本不知道爲什麼我在使用時出現錯誤。我已經安裝了fatiando。
也許fatiando的版本比上面的程序更新或更舊,並且模塊已被重命名。檢查程序是否指定了它需要的fatiando版本。 –
用戶指南沒有指定任何特定的版本,至少可以找到。另一位評論者建議.grd命令已被重命名爲.gridder,但這給了我相同的錯誤。 – Vlad