gkit是一套处理地理数据集的实用工具。

gkit的Python项目详细描述


吉比特

GitHub licensehttps://img.shields.io/badge/python-3-brightgreen.svghttps://img.shields.io/pypi/v/gkit.svg

GKIT是一套处理地理数据集的实用程序,允许您 操作光栅数据集,如np.maskedarray

gkit支持python3和所有可以安装numpy、matplotlib和 格达尔。

在python2中,可能有不可预知的错误。

文件:https://titorx.github.io/gkit/html/

简单示例

下面是gkit提供的一些基本特性的示例。

importnumpyasnpimportgkitasgk# Read the first band from .tifr=gk.read("lst.tif")# You could also specific point out which band you want to loadr=gk.read("lst.tif",2)# gk.read returns a Raster classtype(r)# Output:# gkit.core.Raster# Open an interactive window display raster using matplotlib(call plt.show)r.show()

截图:

https://raw.githubusercontent.com/TitorX/gkit/master/docs/imgs/lst_plot.png
# Only draw raster without calling plt.show.importmatplotlib.pylabaspltr.plot()plt.xlabel("Lon")plt.ylabel("Lat")plt.title("LST(K)")plt.colorbar()plt.savefig("raster_plot.png")

截图:

https://raw.githubusercontent.com/TitorX/gkit/master/docs/imgs/raster_plot.png
# Raster class inherits from np.ma.MaskedArray.# It has all features which MaskedArray has.r# Output:# masked_array(data =#  [[-- -- -- ..., -- -- --]#  [-- -- -- ..., -- -- --]#  [-- -- -- ..., -- -- --]#  ...,#  [242.5966339111328 242.6825408935547 242.79612731933594 ...,#   243.512451171875 243.46498107910156 243.45751953125]#  [241.1952667236328 241.18592834472656 241.19235229492188 ...,#   241.02757263183594 241.04196166992188 241.0919189453125]#  [241.97023010253906 242.03948974609375 242.05393981933594 ...,#   241.8543243408203 241.85800170898438 241.80813598632812]],#              mask =#  [[ True  True  True ...,  True  True  True]#  [ True  True  True ...,  True  True  True]#  [ True  True  True ...,  True  True  True]#  ...,#  [False False False ..., False False False]#  [False False False ..., False False False]#  [False False False ..., False False False]],#        fill_value = 1e+20)# Doing operation like common numpy masked array.tmp=(r-273.15)**3/4tmp=np.cos(r)tmp=np.abs(r)tmp=np.sqrt(r)print(r.shape)print(r.mean())print(r.max())print(r.min())# convert data typetmp=r.astype(np.float64)# Save to filer.save("out_file.tif")# Create a raster from numpy arrayimportnumpyasnpx,y=np.mgrid[-1:1:100j,-2:2:200j]array=np.sqrt(x**2+y**2)print(array.shape)# Output:# (100, 200)transform=[-100,0.1,0,0,0,-0.1]raster=gk.Raster(array,transform)raster.show()

截图:

https://raw.githubusercontent.com/TitorX/gkit/master/docs/imgs/array_plot.png

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
JavaPax考试:从非标准Maven存储库解析Karaf特性存储库(XML文件)   java Spring启动Bean创建异常   java中将ArrayList转换为数组的方法   Android Studio的java Unity插件。   java在CheckStyle中从方法计数中排除getter和setter   HibernateJava。sql。SQLSyntaxErrorException:表/视图“序列”不存在   与命令行程序Java vs C通信   java WebView膨胀异常   java在O(n)java8流中寻找两个列表的交集   java使用Gradle运行单元测试时,最大堆大小在哪里设置?   ssl加载java应用程序(CXF)内的jks文件   CI:Jenkins Git:Simple Java项目:希望在特定时间在脚本上发送消息   java根据位置更改数字   java按数值排序字符串数组   macos java版本“1.6.0_65”是否与java 6模棱两可?   Cassandra中的java时间戳