爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4842|回复: 4

[作图] NCL程序错误

[复制链接]
发表于 2015-12-10 16:43:01 | 显示全部楼层 |阅读模式

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

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

x
我想画AQI的时间序列图,程序是这样的,提示出现错误,想了一天了,也没改好。
Variable: data
Type: string
Total Size: 200 bytes
            25 values
Number of Dimensions: 1
Dimensions and sizes: [25]
Coordinates:
Number Of Attributes: 1
  _FillValue : missing
fatal:Argument type mismatch on argument (1) of (gsn_xy) can not coerce
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 23 in file lx.txt。


load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
begin
data  = asciiread("liu.csv",-1,"string")
printVarSummary(data)
  x=data(:1)   
  y= data(1:)
  wks = gsn_open_wks("pdf","gsn_xy")        
res               = True                  
  res@tiMainString  = "An xy plot Example"   
  res@tiYAxisString = "AQI (ppmv)"           
  res@tiXAxisString = "Time"                 
plot = gsn_xy(wks,x,y,res)      
end
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2015-12-10 16:44:59 | 显示全部楼层
不好意思,上面的程序贴错了
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"

begin
data  = asciiread("liu.csv",-1,"string")
printVarSummary(data)
  x=data(:1)
  y= data(1:)

  wks = gsn_open_wks("pdf","gsn_xy")        ; Open a workstation.

  res               = True                   ; plot mods desired
  res@tiMainString  = "An xy plot Example"   ; title
  res@tiYAxisString = "AQI (ppmv)"           ; y axis title
  res@tiXAxisString = "Time"                 ; x axis title
plot = gsn_xy(wks,x,y,res)          ; Draw an XY plot with 1 curve.

end
                                       
密码修改失败请联系微信:mofangbao
发表于 2015-12-10 21:23:34 | 显示全部楼层
不知道数据长什么样,但是
data  = asciiread("liu.csv",-1,"string")

string?
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2015-12-10 22:37:18 | 显示全部楼层
Hurricane_Hu 发表于 2015-12-10 21:23
不知道数据长什么样,但是
data  = asciiread("liu.csv",-1,"string")

改成float是出来图了,不过图是错的。应该我程序不完整,我的数据是两列24行一列是时间一列是AQI,我想问下,数据这样读取x=data(:1), y= data(2:),对吗。
密码修改失败请联系微信:mofangbao
发表于 2015-12-10 22:59:40 | 显示全部楼层
悠然一梦123 发表于 2015-12-10 22:37
改成float是出来图了,不过图是错的。应该我程序不完整,我的数据是两列24行一列是时间一列是AQI,我想问 ...

NCL数组从0开始的?
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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