爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 8063|回复: 4

[作图] ncl绘制时间高度剖面图时出错了

[复制链接]

新浪微博达人勋

发表于 2018-2-12 22:14:25 | 显示全部楼层 |阅读模式

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

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

x
就是想画一下时间高度剖面图,用的数据是wrf出来的,然后分别对温度和位涡进行区域平均之后画图。但是最后结果全是缺测值是怎么回事。。因为我插值的问题吗??

代码如下:
  begin
  f            = addfile("f:/wrfdata/chanchu_18km.nc","r")
  res          =True
  res@NoTitles =True
  ;经纬度转换
  Lat          =new((/171/), float)
  Long         =new((/144/), float)
  LAT          =f->XLAT
  LONG         =f->XLONG
  Lat          =LAT(1,:,1)
  Long         =LONG(1,2,:)
  Lat@unit     ="degree_north"
  Long@unit    ="degree_east"

  ;时间转换
  time      =f->Times
  Times_s   =chartostring(time)
  z         =wrf_user_getvar(f, "z",-1)
  T         =wrf_user_getvar(f, "tc",-1)
  pvo       =wrf_user_getvar(f, "pvo", -1)
  T!0       ="Times"
  T!2       ="Lat"
  T!3       ="Long"
  T&Times   =Times_s
  T&Lat     =Lat
  T&Long    =Long
  pvo!0     ="Times"
  pvo!2     ="Lat"
  pvo!3     ="Long"
  pvo&Lat   =Lat
  pvo&Long  =Long
  pvo&Times =Times_s

  H                =(/0,2000,4000,6000,8000,10000,12000,14000,16000,18000,20000/)
  T_Plane          =wrf_user_vert_interp(f, T, "ght_msl", H, True)
  pvo_plane        =wrf_user_vert_interp(f, pvo, "ght_msl", H, True)
  T_Plane!1        ="height"
  T_Plane&height   =H
  pvo_plane!1      ="height"
  pvo_plane&height =H

  dT=new((/63,11,171,144/), float)
  do i =0,62,1
      dT(i,:,:,:)=T_Plane(i,:,:,:)-T_Plane(0,:,:,:)
  end do

  temp    =new((/57,11,171,144/),float)
  temp    =dT(6:62,:,:,:);模式区域取了任意一个加权来计算
  copy_VarCoords(T_Plane(6:62,:,:,:), temp(:,:,:,:))
  T_area  =wgt_areaave(temp(:,:,85:86,77:78), 1.0,1.0,1)


;计算区域涡度值
  ;copy_VarCoords(pvo_plane(6:62,:,:,:), Varea1)
  Varea1   =new((/57,11,171,144/), float)
  Varea1   =pvo_plane(6:62,:,:,:)
  copy_VarCoords(pvo_plane(6:62,:,:,:), Varea1)
  Varea2   =wgt_areaave(Varea1(:,:,80:90,72:82), 1.0,1.0,1)
  Varea2!0 ="Times"
  Varea2!1 ="height"
  T_area!0 ="Times"
  T_area!1 ="height";这里的维度命名没成功

wks =gsn_open_wks("png", "T_Pvo")
  ;gsn_define_colormap(wks, "")
  opt_xy  =True
  opt_xy@tiYAxisString   ="Hight(km)"
  opt_xy@cnMissingValPerimOn   =False
  ;opt_xy@cnMissingValFillColor  =0
  ;opt_xy@cnMissingValFillPattern  =11
  opt_xy@tmYLValues     =(/0,2000,4000,6000,8000,10000,12000,14000,16000,18000,20000/)
  opt_xy@tmYLLabels     =(/0,2,4,6,8,10,12,14,16,18,20/)
  opt_xy@tmXBMode       ="Explicit"
  opt_xy@tmXBValues     =ispan(0,56, 8)
  opt_xy@tmXBLabels     =(/"1100","1200","1300","1400","1500","1600","1700","1800"/)
  opt_xy@tiMainOn       =False
  opt_xy@lbTitleOn      =False

  ;温度
  resT                      =opt_xy
  resT@cnFillOn             =True
  resT@cnLinesOn            =False
  resT@cnLevelSelectionMode ="ExplicitLevels"
  ;resT@cnLevels            =(/-4,-2,-1,1,2,3,4,6,8,12/)
  resT@ContourParameters    =4
  resT@lbLabelBarOn         =True
  resT@lbOrientation        ="Horizontal"
  resT@pmLabelBarSide       ="Right"
  resT@lbLabelFontHeightF   =0.01
  resT@lbLabelFontColor     ="black"
  contour_T                 =wrf_contour(f, wks, T_area, resT)
  ;涡度
  resV                   =opt_xy
  resV@cnLinesOn         =True
  resV@cnLevel           =(/2/)
  resV@cnLineColor       ="brown"
  resV@cnLineDashPattern =2
  resV@cnLineThicknesses =0.3
  contour_V              =wrf_contour(f, wks,Varea2, resV)

  plot=wrf_overlays(f, wks,(/contour_T,contour_V/), res)

最后发现 Varea2和T_area都成了缺测值。。。。不知道哪错了,求大神讲解


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

新浪微博达人勋

 楼主| 发表于 2018-2-12 22:33:39 | 显示全部楼层
确实是插值的地方错了,有人能讲解上我用垂直插值那地方怎么回事蛮。。发现自己好像一开始就因为插值的问题折磨了很久
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2018-2-12 22:34:11 | 显示全部楼层
垂直插值之后全部变成了缺测了
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2020-12-8 20:54:41 | 显示全部楼层
楼主我跟您一样,请问您解决了吗?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2020-12-15 14:36:58 | 显示全部楼层
彭雪娇 发表于 2020-12-8 20:54
楼主我跟您一样,请问您解决了吗?

解决了,但是忘记了,这种无非是插值函数的问题,仔细查一下原因
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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