- 积分
- 10
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2023-9-13
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
原帖:【新提醒】MeteoInfoLab脚本示例:站点数据读取插值-精品推荐-气象家园_气象人自己的家园 (06climate.com)
绘图代码:
#Set file name
stfn = 'E:/Temp/station1.txt'
datafn = 'E:/Temp/529/0.txt'
tstr = '0'
#Read station id, lon, lat
st_table = readtable(stfn, headerlines=-1, format='%s%2f')
stids = st_table['Col_0'
lons = st_table['Col_1'
lats = st_table['Col_2'
#Read station temperature data at a specific time
stations = [
temp = [
lon = [
lat = [
dataf = open(datafn)
for line in dataf:
a = line.split()
if a[1 == tstr:
if a[0 in stids:
idx = stids.index(a[0)
stations.append(a[0)
temp.append(float(a[2))
lon.append(lons[idx)
lat.append(lats[idx)
dataf.close()
temp = array(temp)
temp[temp==-9997 = nan
#Interpolate to grid data
lon = array(lon)
lat = array(lat)
x = arange(115.5, 117.5, 0.1)
y = arange(22.8, 24.3, 0.1)
gtemp, xx, yy = griddata([lon, lat, temp, xi=[x, y, method='idw')
#Plot
axesm()
yuedon = shaperead('E:/Temp/Map/2.shp')
yd_xc = shaperead('E:/Temp/Map/ydxd.shp')
geoshow(yuedon, edgecolor='gray')
geoshow(yd_xc, size=1, edgecolor='k', labelfield='NAME', \
fontname=u'黑体', fontsize=14, yoffset=15)
levs = arange(70, 200, 10)
layer = contourfm(xx, yy, gtemp, levs, 20)
masklayer(yuedon, [layer)
xlim(115.5, 117.5)
ylim(22.8, 24.3)
title('2018-5-29-10:00')
colorbar(layer)
|
|