爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 955|回复: 2

求助!用王老师的代码画的图,想要输出污染物浓度随时间变化的GIF图应该要怎么改进?

[复制链接]

新浪微博达人勋

发表于 2023-10-15 00:25:51 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

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)
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2023-10-16 18:21:21 | 显示全部楼层
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2023-10-19 23:48:17 | 显示全部楼层
MeteoInfo 发表于 2023-10-16 18:21
参考这里:http://www.meteothink.org/examples/meteoinfolab/plot_types/gif_animation.html

王老师,这个示例代码读取的数据文件在哪里可以下载到?没有数据文件看不是很懂,不知道他怎么按时间读取的。
1697730262378.png
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表