爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5286|回复: 3

求助:ncl提取10m风速

[复制链接]

新浪微博达人勋

发表于 2017-7-5 16:20:24 | 显示全部楼层 |阅读模式
NCL
系统平台:
问题截图: -
问题概况: 我引用大神的脚本,改了自己的参数后报错
我看过提问的智慧: 看过
自己思考时长(天): 7

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

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

x
本帖最后由 15918702650 于 2017-7-5 16:43 编辑

以下是我改过的的脚本:出错是在27行,红色字体部分(小弟在这个地方已经停留两个星期了,望大神指导):
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
a = addfile("wrfout_d01_1999-09-16_00_00_00.nc","r")
type = "pdf"
wks = gsn_open_wks(type,"case")
res = True
res@MainTitie = "REAL-TIME WRF"
res@Footer = False
pltres = True
mpres = True
;times = wrf_user_getvar(a,"times",-1)
;ntimes = dimsizes(times)
;it = 0
;res@TimeLabel = times(it)
;slp = wrf_user_getvar(a,"slp",it)
;wrf_smooth_2d(slp,3)
;t2 = wrf_user_getvar(a,"T2",it)
;tc2 = t2-273.16
;tf2 = 1.8*tc2+32
;tf2@description = "Surface Temperature"
;tf2@units = "F"
  FirstTime = True
  times  = wrf_user_list_times(a)  ; get times in the file
  ntimes = dimsizes(times)         ; number of times in the file
  it=6
  print("Working on time: " + times(it) )
  
u10 = wrf_user_getvar(a,"U10",it)
v10 = wrf_user_getvar(a,"V10",it)
u10 = u10*1.94386
v10 = v10*1.94386
u10@units = "kts"
v10@units = "kts"
WindVeo = sqrt(u10*u10+v10*v10)

opts = res
opts@cnFillOn = True
opts@ContourParameters=(/0.,12.,5./)
opts@gsnSpreadColorEnd = -3
contour_WindVeo = wrf_contour(a,wks,WindVeo,opts)
delete(opts)

;opts = res
;opts@cnFillOn = True
;opts@ContourParameters=(/-20.,90.,5./)
;opts@gsnSpreadColorEnd = -3
;contour_tc = wrf_contour(a,wks,tf2,opts)
;delete(opts)
;opts = res
;opts@cnLineColor = "Blue"
;opts@cnHighLabelsOn = True
;opts@ContourParameters = (/900.,1100.,4./)
;contour_psl = wrf_contour(a,wks,slp,opts)
;delete(opts)
opts = res
opts@FieldTitle = "Winds"
opts@NumVectors = 47
vector = wrf_vector(a,wks,u10,v10,opts)
delete(opts)
;plot = wrf_map_overlays(a,wks,(/contour_tc,contour_psl,vector/),pltres,mpres)
plot = wrf_map_overlays(a,wks,(/contour_WindVeo,vector/),pltres,mpres)

end

搜狗截图20170705164726.png
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-7-5 16:53:45 | 显示全部楼层
数组越界,  times变量中只有一个时间。  因为你的文件只有一个预报时间。  你只能取到times(0)
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-7-6 08:59:44 | 显示全部楼层
cmy 发表于 2017-7-5 16:53
数组越界,  times变量中只有一个时间。  因为你的文件只有一个预报时间。  你只能取到times(0)

那请问该往哪个方向改呢,求解答
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2017-7-6 09:10:49 | 显示全部楼层
cmy 发表于 2017-7-5 16:53
数组越界,  times变量中只有一个时间。  因为你的文件只有一个预报时间。  你只能取到times(0)

把it改为0时,能生成图形,但显示:Variable: times
Type: string
Total Size: 8 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:        [1]
Coordinates:
Number Of Attributes: 2
  description :        times in file
  _FillValue :        missing
(0)        1999-09-16_00:00:00
(0)        Working on time: 1999-09-16_00:00:00
warning:MainTitie is not a valid resource in case_contour at this time
warning:MainTitie is not a valid resource in case_vector at this time
这样出的图形是那个时刻正确的10m风速吗
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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