- 积分
- 1502
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-4-12
- 最后登录
- 1970-1-1
![[黄大仙honey] 粉丝数:147 微博数:131 新浪微博达人勋](source/plugin/sina_login/img/light.png)
|
NCL
系统平台: |
|
问题截图: |
- |
问题概况: |
想用NCL画站点降水图然后与WRF画出来的降水作对比,但是提示读入的站点数据有误, |
我看过提问的智慧: |
看过 |
自己思考时长(天): |
2 |
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 黄小仙儿 于 2014-7-14 17:03 编辑
想用NCL画站点降水图然后与WRF画出来的降水作panel图对比,但是提示读入的站点数据有误,请大神帮忙看看
提示错误:
warning:stringtofloat: a bad value was passed; input strings must contain numerc digits, replacing with missing value
warning:stringtofloat: a bad value was passed; input strings must contain numerc digits, replacing with missing value
warning:stringtofloat: a bad value was passed; input strings must contain numerc digits, replacing with missing value
warning:stringtofloat: a bad value was passed; input strings must contain numerc digits, replacing with missing value
warning:stringtofloat: a bad value was passed; input strings must contain numerc digits, replacing with missing value
(0) icObjAnal: all input data are missing
fatal:Subscript out of range, error in subscript #0
fatal:An error occurred reading X
fatal:["Execute.c":8567]:Execute: Error occurred at or near line 12232 in file NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl
fatal:["Execute.c":8567]:Execute: Error occurred at or near line 66 in file /hoe/Huanglei/station_1.ncl
我的脚本如下:
; This example reads in station data represented by
; 1D arrays, and generates a filled contour plot
; via the triangular mesh capability in NCL.
;
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
;
; Data is stored in four columns: station_name lat lon pwv
; Read in each line as a string, and use "str_get_field" to
; read in the fields of interest.
;
fname = "/home/Huanglei/data/rainstation.txt"
lines = asciiread(fname,-1,"string")
;
; Use "str_get_field" to indicate which fields to read in. Each field
; is separated by spaces.
;
lat = stringtofloat(str_get_field(lines(1:),2," "))
lon = stringtofloat(str_get_field(lines(1:),3," "))
pwv = stringtofloat(str_get_field(lines(1:),4," "))
rain = stringtofloat(str_get_field(lines(1:),5," "))
;
; This second file is not so tricky. The 2D lat/lon data is sorted with
; lat values first, and then lon values.
;
olon = new(66,"float");
olat = new(40,"float");
data1 = new((/40,66/),"float")
do i=0,65
olon(i) =72+i
end do
do l=0,39
olat(l) = 17+l
end do
olon!0 = "lon"
olon@long_name = "lon"
olon@units = "degrees-east"
olon&lon = olon
olat!0 = "lat"
olat@long_name = "lat"
olat@units = "degrees_north"
olat&lat = olat
rain@_FillValue = 999999.000000
rscan = (/10,5,3/) ;连续的有效半径大小,最大为10,依次递减
data1 = obj_anal_ic_deprecated(lon,lat,rain,olon,olat,rscan, False) ;Creanm插值
a=addfile("/home/Huanglei/data/d032"+".nc","r")
times=wrf_user_getvar(a,"times",-1)
ntime=dimsizes(times)
rainnc1= wrf_user_getvar(a,"RAINNC",35)
rainc1 = wrf_user_getvar(a,"RAINC",35)
rain1 = rainnc1 + rainc1
rainnc2= wrf_user_getvar(a,"RAINNC",ntime-1)
rainc2 = wrf_user_getvar(a,"RAINC",ntime-1)
rain2 = rainnc2 + rainc2
rain=rain2-rain1
lat2=wrf_user_getvar(a,"XLAT",-1)
lon2=wrf_user_getvar(a,"XLONG",-1)
rain@lat2d=lat2(1,:,:)
rain@lon2d=lon2(1,:,:)
wks = gsn_open_wks("ps","station")
gsn_define_colormap(wks, "cmp_haxby")
res=True
res@gsnSpreadColors = True ; spread out color table
res@cnFillOn = True ; turn on color
res@cnLinesOn = False
res@lbLabelBarOn = False
res@cnInfoLabelOn = False
res@cnLineLabelsOn = False
res@mpPerimOn = True
res@gsnMaximize=True
res@pmTickMarkDisplayMode = "Always"
res@gsnDraw = False ; don't draw yet
res@gsnFrame = False
res@mpGeophysicalLineColor = "Black"
res@mpNationalLineColor = "Black"
res@mpDataSetName = "Earth..4"
res@mpDataBaseVersion = "MediumRes"
res@mpOutlineSpecifiers = ("China:states")
res@mpNationalLineThicknessF= 0.1
res@mpOutlineDrawOrder = "PostDraw"
res@mpLimitMode = "LatLon" ; Limit the map view.
res@mpMinLonF = min(lon2)
res@mpMaxLonF = max(lon2)
res@mpMinLatF = min(lat2)
res@mpMaxLatF = max(lat2)
res1=res
res2=res
res1@gsnLeftString = "(a):WRF"
res1@gsnRightString = ""
res1@sfXCStartV = min(lon2) ; Define where contour
res1@sfXCEndV = max(lon2)
res1@sfYCStartV = min(lat2)
res1@sfYCEndV = max(lat2)
res2@gsnLeftString = "(b):OBS"
res2@gsnRightString = ""
resP = True ; modify the panel plot
resP@gsnMaximize = False
resP@gsnPanelLabelBar = True
resP@pmLabelBarWidthF = 0.8
resP@lbLabelFontHeightF = 0.01
resP@lbBoxLinesOn = False
resP@lbTitleOn = True ; turn on title
resP@lbTitleString = "mm"
;resP@lbTitlePosition = "Right" ; title position
resP@lbTitleFontHeightF= .015 ; make title smaller
;resP@lbTitleDirection = "Across"
plot=new(2,graphic)
plot(0)=gsn_csm_contour_map(wks,rain,res1)
plot(1)=gsn_csm_contour_map(wks,data1,res2)
gsn_panel(wks,plot,(/1,2/),resP)
end
我的数据是这样排列的(站号,纬度,经度,海拔高度,累积降水量),截取了一部分如下:
57206 32.43 105.85 513.8 97.8
57204 32.58 105.23 800.5 95.5
57217 32.23 106.28 485.7 11.1
57208 32.02 105.48 536.1 144.9
57303 31.73 105.92 459.9 28.1
56196 31.47 104.68 522.7 58.9
56193 32.42 104.52 893.2 18.4
56194 31.78 104.43 678.9 84.5
请大家帮忙看看,实在是当局者迷。
|
|