- 积分
- 2115
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2017-4-16
- 最后登录
- 1970-1-1
|
发表于 2018-11-21 19:16:43
|
显示全部楼层
王老师,您好!按照您的脚本改写后出现了以下的错误,麻烦您看一看。
#Get file names
fn = 'F:\Meteoinfo\Data\Beijing.txt'
ncol = numasciicol(fn)
nrow = numasciirow(fn)
a = asciiread(fn,shape=(nrow,ncol))
lon = a[:,0]
lat = a[:,1]
pm= a[:,2]
#To grid data
x = arange(115, 117, 0.2)
y = arange(38, 42, 0.2)
gtemp,gx,gy = griddata((lon, lat), pm, xi=(x, y), method='idw', radius=0.8)
#Plot
axesm()
bou1_layer = shaperead('F:/MeteoInfo/Data/beijing.shp')
mlayer = shaperead('F:/MeteoInfo/Data/beijing.shp')
geoshow(bou1_layer, edgecolor='lightgray')
geoshow(mlayer, visible=False)
levs = [0, 25, 35, 50, 75, 95, 115, 130, 150,200]
cols = [(255,255,255),(0,255,0),(127,255,0),(255,255,0),(255,215,0),(255,128,0),(255,97,0), \
(255,0,0),(176,23,31),(135,38,87),(255,0,255)]
#layer = contourfm(x, y, gtemp,20)
layer = contourfm(x, y, gtemp,levs,colors=cols)
#slayer = scatterm(lon, lat,pm,colors=['k'], size=10)
slayer = scatterm(lon, lat,pm,levs,colors=cols, size=8)
masklayer(mlayer, [layer])
xlim(115, 117)
ylim(38, 42)
title(u'北京市空气质量站点PM2.5浓度',fontname=u'黑体',fontsize=20,bold=False,color='blue')
text(113.3, 23.9, u'2018年2月25日00:00时', fontname=u'黑体', fontsize=16)
colorbar(layer)
以上是脚本,以下是出现的问题
>>> run script...
Traceback (most recent call last):
File "<iostream>", line 6, in <module>
File "E:\MeteoInfo\pylib\mipylib\dataset\midata.py", line 480, in asciiread
a = ArrayUtil.readASCIIFile(filename, delimiter, headerlines, datatype, shape, rfirstcol)
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at sun.misc.FloatingDecimal.parseDouble(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
at org.meteoinfo.data.ArrayUtil.readASCIIFile(ArrayUtil.java:122)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
java.lang.NumberFormatException: java.lang.NumberFormatException: For input string: "??1
|
|