- 积分
- 4190
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-8-10
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 直孔吧-坚扎 于 2020-7-13 21:42 编辑
''绘制高原区域网格温度场encoding=UTF-8
'''
import cmaps
from guance_lunwentu import maskout
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy.interpolate import griddata
from mpl_toolkits.basemap import Basemap
def main():
## 原数据文件
path1 =r'E:\\MY_project_data\\PLot_36_project_data\\DATA_LUNWEN\\result_data\\202006302000_TMAX.csv'
data = pd.read_csv(path1, skiprows=0)
data=np.array(data)
plot(data)
def plot(data_new):
lon = np.linspace(78.25, 99.30, 422)
lat = np.linspace(26.75, 36.75, 197)
lons, lats = np.meshgrid(lon, lat)
## 画图
plt.rcParams['font.sans-serif'] = ['SimHei'] # 用来正常显示中文
plt.rcParams['axes.unicode_minus'] = False # 用来正常显示负号
fig = plt.figure(figsize=(10, 6))
plt.rc('font', size=10, weight='bold')
ax = fig.add_subplot(111)
m = Basemap(projection='cyl', llcrnrlat=26.75, llcrnrlon=78.25, urcrnrlat=36.75, urcrnrlon=99.30)
m.readshapefile('../shapefile/tibet_shp/xizang_all', 'xizang_all.shp', default_encoding='gbk', drawbounds=True,
linewidth=0.5, color='k')
m.readshapefile('../shapefile/tibet_shp/river_1', 'river_1.shp', default_encoding='gbk', linewidth=0.3, color='b')
m.readshapefile('../shapefile/tibet_shp/river_2', 'river_2.shp', default_encoding='gbk', linewidth=0.3, color='b')
m.readshapefile('../shapefile/tibet_shp/river_3', 'river_3.shp', default_encoding='gbk', linewidth=0.3, color='b')
m.readshapefile('../shapefile/tibet_shp/xzlake', 'xzlake.sp', default_encoding='gbk', linewidth=0.2, color='b')
cmap_color = plt.cm.get_cmap('jet')
m.pcolormesh(lons,lats,data_new,cmap=cmap_color)
m.colorbar(location = 'right')
# 坐标轴
lon_num = np.arange(78.25, 100.25, 2)
print(lon_num)
lon_label = ['78.25', '80.25', '82.25' ,'84.25', '86.25' ,'88.25', '90.25' ,'92.25', '94.25' ,'96.25','98.25']
lat_num = np.arange(26.75, 38.60, 2)
print(lat_num)
lat_label = ['26.75' ,'28.75', '30.75', '32.75' ,'34.75','36.75']
plt.yticks(lat_num, lat_label)
plt.xticks(lon_num, lon_label)
plt.title('TIBET TMAX')
## 目标文件
path2 = r'F:\\plot\\tibet_tmmax'
plt.savefig(path2, bbox_inches='tight',dpi=300)
plt.show()
if __name__ == '__main__':
main();
|
-
评分
-
查看全部评分
|