爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 2574|回复: 4

[作图] NCL水汽通量绘图问题请教

[复制链接]

新浪微博达人勋

发表于 2023-4-20 18:54:43 | 显示全部楼层 |阅读模式

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

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

x
在绘图过程中一直报错uv2dv_cfd: the lat,lon arrays must be dimensioned nlat and nlon, the last two dimensions of u and v好像问题出在这里?
lat=in->latitude
lon=in->longitude

   vapord=uv2dv_cfd(qu,qv,lat,lon,2)               ; u,v ==> divergence


之前用ncep的数据绘制的时候是可以的,现在换成ERA5的数据后就一直报这个错,请教各位大佬该怎么处理呀?感激不尽!

源码:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.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/cnmap/cnmap.ncl"

begin

  in  = addfile("vapor-750_850.nc","r")

  air1= short2flt(in->t(:,{850},:,:))
  u1=short2flt(in->u(:,{850},:,:))
  v1=short2flt(in->v(:,{850},:,:))
  rhum1=short2flt(in->r(:,{850},:,:))

   air = dim_avg_n_Wrap(air1, 0)           ;求时间平均
   uwnd = dim_avg_n_Wrap(u1, 0)           ;求时间平均
   vwnd = dim_avg_n_Wrap(v1, 0)
   rhum = dim_avg_n_Wrap(rhum1, 0)


lat=in->latitude
lon=in->longitude

es=6.112*exp(17.67*air/(air+243.5))
qs=(622*es/(925-0.378*es))
q=qs*rhum/100
q= smth9(q, 0.50, -0.25, False)

   qu = new((/73,144/),float)
   qv = new((/73,144/),float)
                do i=0,72
                        do j=0,143
                                qu(i,j) = q(i,j)*uwnd(i,j)/9.8
                                qv(i,j) = q(i,j)*vwnd(i,j)/9.8
                        end do
                end do

    ;    qu = smth9(qu, 0.50, -0.25, False)
    ;    qv = smth9(qv, 0.50, -0.25, False)
        vapord = new((/73,144/),float)
   vapord=uv2dv_cfd(qu,qv,lat,lon,2)               ; u,v ==> divergence
   vapord = vapord*100000
copy_VarCoords(air,vapord)
printVarSummary(vapord)


wks = gsn_open_wks("png","vf")

  vres                         = True             ; plot mods desired
  vres@gsnFrame                = False            ; so we can draw time stamp
  vres@gsnDraw                 = False
  vres@vcRefAnnoOrthogonalPosF = -1.0             ; move ref vector up
  vres@vcRefMagnitudeF         = 10.0             ; define vector ref mag
  vres@vcRefLengthF            = 0.045            ; define length of vec ref
  vres@vcGlyphStyle            = "CurlyVector"    ; turn on curly vectors
  vres@vcMinDistanceF          = 0.017

   res                      = True
   res@gsnFrame=False
   res@gsnDraw=False
  res@cnFillOn             = True                 ; color on
  res@cnLinesOn            = False               ; turn off contour lines
; res@gsnScalarContour     = True                 ; vectors over contours
  res@cnFillPalette        = "sunshine_diff_12lev"
  res@mpFillOn             = False              ; turn off map fill
  res@cnFillPalette        = "rh_19lev"
  res@gsnContourNegLineDashPattern=1
  res@cnLevelSelectionMode = "ManualLevels"       ; set manual contour levels
  res@cnMinLevelValF       = -4               ; set min contour level
  res@cnMaxLevelValF       =  4               ; set max contour level
  res@cnLevelSpacingF      =  0.1         ; set contour spacing

  res@mpMinLatF = 0
  res@mpMaxLatF = 60
  res@mpMinLonF =60
  res@mpMaxLonF = 150

res@tiMainString ="Water vapor flux and its divergence during the event"

  vfd = gsn_csm_contour_map(wks,vapord, res)
  vf  = gsn_csm_vector(wks, uwnd, vwnd, vres)
overlay(vfd,vf )

cnres           = True
cnres@china     = True       ;draw china map or not
cnres@river     = True       ;draw changjiang&huanghe or not
cnres@province  = True       ;draw province boundary or not
cnres@nanhai    = True       ;draw nanhai or not
cnres@diqu      = False      ; draw diqujie or not

chinamap = add_china_map(wks,vfd,cnres)

   gsn_panel(wks,vfd,(/1,1/),False)
   frame (wks)
  end



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

新浪微博达人勋

发表于 2023-5-10 10:22:28 | 显示全部楼层
我也遇到这个问题了
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2023-5-11 11:27:19 | 显示全部楼层
梁苏洁 发表于 2023-5-10 10:22
我也遇到这个问题了

去看一下你用的资料格点数,把代码相应部分修改一下
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2023-8-5 20:34:01 | 显示全部楼层
楼主你好,之前看了好多算水汽通量的帖子,发现里面水汽都是用的比湿q来算的,这里为什么你用的是相对湿度呢?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2023-12-27 16:52:27 | 显示全部楼层
楼主解决了吗?我也遇到这个问题了
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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