爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5899|回复: 5

定点画延高度风速的x-y曲线图

[复制链接]

新浪微博达人勋

发表于 2015-3-21 23:37:28 | 显示全部楼层 |阅读模式

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

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

x
一直想画风速延高度分部的图,总是遇到很多问题。下面代码是NCL给的例子改编的,但还是有错误。
终端显示:fatal:Subscript out of range, error in subscript #0
                 fatal:An error occurred reading z
                 fatal:["Execute.c":8578]:Execute: Error occurred at or near line 66 in file ccc
定义的zz超出范围            到底是该怎么解决这些问题



load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin
  a = addfile("/home/yjane/A/DATA/0814/wrfout_d01_2008-09-19_00:00:00.nc","r")

  type = "pdf"
  wks = gsn_open_wks(type,"A")





;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  FirstTime = True
  times  = wrf_user_list_times(a)  ; get times in the file
  ntimes = dimsizes(times)         ; number of times in the file


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  do it = 0,ntimes-1,2             ; TIME LOOP

    print("Working on time: " + times(it) )


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need        

    u  = wrf_user_getvar(a,"ua",it)        ; u averaged to mass points
    v  = wrf_user_getvar(a,"va",it)        ; v averaged to mass points
    p  = wrf_user_getvar(a, "pressure",it) ; pressure is our vertical coordinate
    z  = wrf_user_getvar(a, "z",it)        ; grid point height




      ip_lats =   19.3

      ip_lons = 122.1   
                  



        loc = wrf_user_ll_to_ij(a, ip_lons, ip_lats, True)
        locX = loc(0)
        locY = loc(1)


    zz = z(1:100,locY,locX)
     uu = u(1:100,locY,locX)
     vv = v(1:100,locY,locX)
     
     ww = sqrt(uu*uu+vv*vv)
                                    
     plot                       = gsn_csm_xy(wks,ww,zz,True)


end do

end
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-3-22 09:08:40 | 显示全部楼层
1:100指定的是哪一维,楼主知道不?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2015-3-22 11:34:39 | 显示全部楼层
longlivehj 发表于 2015-3-22 09:08
1:100指定的是哪一维,楼主知道不?

我不知的1:100指定哪个维度,
我看到在skewT中是这样指定的:
         skewT_data = skewT_PlotData(wks, skewt_bkgd, p(:,locY,locX), \
                                                     tc(:,locY,locX), \
                                                     td(:,locY,locX), \
                                                      z(:,locY,locX), \
                                                      u(:,locY,locX), \
                                                      v(:,locY,locX), \
                                                     dataOpts)
画出的图也是定点处沿高度的变化量。我就想学一学人家的做法,

我改成    zz = z(:,locY,locX)
             uu = u(:,locY,locX)
              vv = v(:,locY,locX)
依然是错误的。

难道我需要想下面这样定义taus的值吗?但是我同样不知的在wrfout*中沿高度有多少个taus值。
您能帮一下我吗?谢谢

  uu = wrf_user_intrp3d(u,z,"h",height,0,False)
  vv = wrf_user_intrp3d(v,z,"h",height,0,False)

  V = sqrt(uu*uu+vv*vv)

V_point = V(1:64,locY,locX)

taus =(/1.,2.,3.,4.,5. ,6.,7.,8.,9.,10.,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64/)
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-3-22 12:45:04 | 显示全部楼层
YJane 发表于 2015-3-22 11:34
我不知的1:100指定哪个维度,
我看到在skewT中是这样指定的:
         skewT_data = skewT_PlotData( ...

必须知道z的基本情况,比如printVarSummary(z);
skewT和taus,怎么又多出这两个东西,原来的程序里面没有看到!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2015-3-22 15:21:16 | 显示全部楼层
longlivehj 发表于 2015-3-22 12:45
必须知道z的基本情况,比如printVarSummary(z);
skewT和taus,怎么又多出这两个东西,原来的程序里面没 ...

哇,太好了,听您说的,我改了以后确实把图做出来了。太感谢了!!

下面是可以出图的NCL-script,图形比较粗糙,需要根据自己情况修改。希望能给后学者提供一个方向

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin

  a = addfile("/home/yjane/A/DATA/0814/wrfout_d01_2008-09-19_00:00:00.nc","r")


  type = "pdf"

  wks = gsn_open_wks(type,"A")


  FirstTime = True
  times  = wrf_user_list_times(a)  ; get times in the file
  ntimes = dimsizes(times)         ; number of times in the file



  do it = 0,ntimes-1,2             ; TIME LOOP

    print("Working on time: " + times(it) )



    u  = wrf_user_getvar(a,"ua",it)        ; u averaged to mass points
    v  = wrf_user_getvar(a,"va",it)        ; v averaged to mass points
    p  = wrf_user_getvar(a, "pressure",it) ; pressure is our vertical coordinate
    z  = wrf_user_getvar(a, "z",it)        ; grid point height




      ip_lats =   19.3

      ip_lons =  122.1






        loc = wrf_user_ll_to_ij(a, ip_lons, ip_lats, True)
        locX = loc(0)
        locY = loc(1)


     zz = z(0:28,locY,locX)
     uu = u(0:28,locY,locX)
     vv = v(0:28,locY,locX)
     
     ww = sqrt(uu*uu+vv*vv)
                                    
     plot                       = gsn_csm_xy(wks,ww,zz,True)




  end do  


end
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-3-24 16:49:13 | 显示全部楼层
YJane 发表于 2015-3-22 15:21
哇,太好了,听您说的,我改了以后确实把图做出来了。太感谢了!!

下面是可以出图的NCL-script,图形 ...

正好需要,谢了~
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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