1 Star 0 Fork 13

靖老道/python-gdal-test

forked from fungis/python-gdal-test 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
02_栅格HDF文件展示.py 796 Bytes
一键复制 编辑 原始数据 按行查看 历史
fungis 提交于 2022-10-15 15:05 . 文档修改
# -*- coding: utf-8 -*-
"""
@File : 02_栅格HDF文件展示.py
@Author : fungis@163.com
@notice :
"""
import matplotlib.pylab as plt # 画图模块
from osgeo import gdal, gdalconst
raster_path = r'./data-use/hdf/MOSAIC_TMP_2019273.hdf' # 输入你的hdf文件
# raster_path = r'E:\ModisTools\Data_Mod14a1\Result\MOSAIC_TMP_2019249.hdf' # 输入你的hdf文件(绝对路径)
dataset = gdal.Open(raster_path, gdalconst.GA_ReadOnly) # 读取遥感数据信息
band = dataset.GetRasterBand(1)
location_array = band.ReadAsArray() # 二维行列像元矩阵
plt.title('gdal-hdf-show') # 设置图框标题为gdal-hdf-show
plt.imshow(location_array, cmap='rainbow') # 绘图,配色为rainbow
plt.colorbar() # 绘制图例
plt.savefig("./results/20220917.04.png", dpi=300)
plt.show()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/jzhang0767/python-gdal-test.git
git@gitee.com:jzhang0767/python-gdal-test.git
jzhang0767
python-gdal-test
python-gdal-test
master

搜索帮助