- 积分
- 259
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2017-5-8
- 最后登录
- 1970-1-1
|
发表于 2017-5-19 10:28:11
|
显示全部楼层
王老师,我在画城市的累积6小时降水,想试试脚本的运行,多学习学习。运行后提示错误,是等值线颜色那提示错误,不太明白。
- #Set data folders
- basedir = 'F:/Meteinfo/MeteoInfo_Java_1.4.2_Files/MeteoInfo'
- datadir = os.path.join(basedir, 'sample/MICAPS/surface20150515/surface/plot')
- mapdir = os.path.join(basedir, 'map')
- #Read shape files
- bou2_layer = shaperead(os.path.join(mapdir, 'bou2_4p.shp'))
- bou1_layer = shaperead(os.path.join(mapdir, 'bou1_4l.shp'))
- hubei_layer = shaperead(os.path.join(mapdir, 'hubei-1.shp'))
- #Read station data
- f = addfile_micaps(os.path.join(datadir, '15051502.000'))
- pr = f.stationdata('Precipitation6h')
- #griddata function - interpolate
- x = arange(108, 116, 0.5)
- y = arange(29, 34, 0.5)
- prg = pr.griddata((x, y), method='idw', radius=3)
- #Plot
- axesm()
- geoshow(bou2_layer, edgecolor='lightgray')
- geoshow(bou1_layer, facecolor=(0,0,255))
- geoshow(hubei_layer, facecolor='r', size=4, labelfield='NAME2', fontname=u'Times New Roman', fontsize=16, yoffset=15)
- geoshow(hubei_layer, visible=False)
- levs = [0.1, 1, 2, 5, 10, 20, 25, 50, 100]
- cols = [(255,255,255),(170,240,255),(120,230,240),(200,220,50),(240,220,20),(255,120,10),(255,90,10), \
-     (240,40,0),(180,10,0),(120,10,0)]
- layer = contourfm(prg, levs, colors=cols)
- masklayer(hubei_layer, [layer])
- colorbar(layer)
- xlim(107, 117)
- ylim(28, 35)
- text(95, 52, u'Accumulated Precipitatio 6h', fontname=u'黑体', fontsize=16)
- text(95, 50, u'(2015-05-14 09:00 至 2015-05-15 02:00)', fontname=u'黑体', fontsize=14)
复制代码
提示错误如下:
>>> run script...
File "<iostream>", line 24
    (240,40,0),(180,10,0),(120,10,0)]
^
SyntaxError: no viable alternative at character ' 
15051502.000
(774.45 KB, 下载次数: 0)
|
|