爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 7425|回复: 4

grib2画涡度剖面图问题

[复制链接]

新浪微博达人勋

发表于 2020-7-23 08:16:09 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 大扣 于 2020-7-23 08:27 编辑

   最近在用grib2文件画涡度剖面图,算出来的涡度是这样子的(数据类型和u,v是一样的)
批注 2020-07-23 081319.png
涡度的高度场场的单位是Pa,但还是无法用gsn_csm_pres_hgt画剖面图,请问可以怎么改变这个变量的属性使得可以符合这个函数的要求呢
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2020-7-23 09:41:57 | 显示全部楼层
u     = f->UGRD_P0_L100_GLL0                           ; get u for January
v     = f->VGRD_P0_L100_GLL0                           ; get u for January
lat1d = f->lat_0
lon1d = f->lon_0
p     = f->lv_ISBL0  



Vor   = uv2vr_cfd(u, v, lat1d, lon1d, 0)
Vor   = Vor*1.e05

Vor!0 = "p"
Vor!1 = "lat"
Vor!2 = "lon"

Vor&p = p
Vor&lat = lat1d
Vor&lon = lon1d

Vor@long_name = "Vorticity"
Vor@units = "le-5 s-1"
printVarSummary(Vor)
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2020-7-23 09:55:55 | 显示全部楼层
小其其格 发表于 2020-7-23 09:41
u     = f->UGRD_P0_L100_GLL0                           ; get u for January
v     = f->VGRD_P0_L100_ ...

太感谢了,画出来啦!
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2020-9-7 17:52:16 | 显示全部楼层
小其其格 发表于 2020-7-23 09:41
u     = f->UGRD_P0_L100_GLL0                           ; get u for January
v     = f->VGRD_P0_L100_ ...

读取的P是34,然而,Vor是(31,lat,lon),所以Vor&p = p这一步会报错,请问这该怎么解决呢?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2020-10-28 09:45:07 | 显示全部楼层
想问一下我画FNL的涡度场的时候不管加不加trGridType这条命令都有这个warning:ContourPlotDraw: out of range coordinates encountered; standard AreaFill rendering method may be unreliable;
consider setting the resource trGridType to "TriangularMesh" if coordinates contain missing values
画出来的涡度图分布有棱有角的,这个是什么问题呢??
下面是我的脚本:
load"$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/cnmap/cnmap.ncl"
begin

;;;;;;;;;;;;;;;;;;;;;;;;;;fnl;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
a = addfile("E:\fnl\20080608\fnl.grib2","r")

  v= a->VGRD_P0_L100_GLL0(:,20,:,:)
  u =a->UGRD_P0_L100_GLL0(:,20,:,:)
  p =a->lv_ISBL0
  print(p)
  printVarSummary(u)
  uu = dim_avg_n_Wrap(u,0)
  vv = dim_avg_n_Wrap(v,0)
   scale=1.e05

  vort = uv2vr_cfd(uu,vv,u&lat_0,u&lon_0,0)*scale

  type = "pdf"
  wks = gsn_open_wks(type,"v080608")
  gsn_define_colormap(wks,"WhiteBlueGreenYellowRed")  
  ; Set some basic resources
  cnres                          = True                            ; plot mods desired
  cnres@gsnFrame                 = False
  cnres@gsnDraw                  = False
  cnres@gsnMaximize              = True
  cnres@gsnRightString           = " "             ; turn off right string
  cnres@gsnLeftString            = " "             ; turn off left string
  cnres@pmTickMarkDisplayMode = "Always"
;  cnres@tiXAxisString            = " "


  res                = True
  res   = cnres
  res@vcGlyphStyle         = "CurlyVector" ;  "CurlyVector" , "WindBarb"  
  res@vcFillArrowEdgeColor     = "white"
  res@vcFillArrowFillColor     = "black"
  res@vcMinDistanceF           = 0.02
  res@vcMinMagnitudeF           = 5.0

  ;; 箭头头部大小一致。若要绘制头部大小不一致箭头可参考第4章示例。
  res@vcFillArrowMinFracWidthF = 1.0
  res@vcFillArrowHeadMinFracXF = 1.0  
  res@vcFillArrowHeadMinFracYF = 1.0
  
  ;; 参考箭头
  res@vcRefAnnoOn               = True  
  res@vcRefMagnitudeF           = 20      ;标准长度箭头所表示的大小
  res@vcRefLengthF              = 0.04   ;标准长度箭头在图形中的长度
  res@vcRefAnnoBackgroundColor  = "white" ;背景颜色     
  res@vcRefAnnoPerimOn          = False   ;关闭边框   
  res@vcRefAnnoFontHeightF      = 0.015   ;参考箭头标签字体大小      
  res@vcRefAnnoString1On        = False   ;设定参考箭头上、        
  res@vcRefAnnoString2On        = True    ;        下的字符
  res@vcRefAnnoString2          = "20 m/s"  
;----------------------------------map plot--------------------------------

  mpres = cnres

;---Zoom in on area of interest  

  mpres@mpLimitMode           = "LatLon"

  mpres@mpMinLatF               = 18.                        

  mpres@mpMaxLatF               = 32.

  mpres@mpMinLonF               = 102.

  mpres@mpMaxLonF               = 124.

  mpres@mpDataBaseVersion       = "MediumRes"

  mpres@mpDataSetName           = "Earth..4"

  mpres@mpOutlineOn             = True         ; Turn on map outlines

  mpres@mpOutlineSpecifiers     = (/"China","Taiwan"/)       ;China:states


  mpres@mpLandFillColor         = "white"

  mpres@mpInlandWaterFillColor  = "white"

  mpres@mpOceanFillColor        = "white"

  mpres@gsnMajorLatSpacing      = 4.

  mpres@gsnMajorLonSpacing      = 4.           ; 设置高级绘图窗口gsn中经纬度刻度的间隔

  mpres@tmXTOn                  = False         ;不显示X轴顶部的坐标刻度

  mpres@tmYROn                  = False         ;不显示Y轴右侧的坐标刻度

  mpplot=gsn_csm_map(wks,mpres)

;----------------------------- contour plot--------------------------------------

   cnres = True           
      cnres@cnLinesOn = False              
      cnres@cnFillOn = True  
      cnres@cnLineLabelsOn = False
      cnres@cnLineLabelFontHeightF = 0.01

      cnres@gsnSpreadColorEnd    = -3    ; End third from the last color in color map
      cnres@cnLineLabelPlacementMode = "Computed"
      cnres@cnLineLabelDensityF = 0.0
      cnres@lbTitleOn            = False
      cnres@pmLabelBarOrthogonalPosF = -0.05
      cnres@cnLevelSelectionMode = "ExplicitLevels"

      cnres@cnLevels             = (/ -3, -2, -1, 0, 0.5, 1, 1.5, 2, 2.5, 3/)
      cnres@cnFillColors         = (/ 64, 48, 32, 16, 142,143,158,159,175,190,191/)
      cnres@cnSmoothingOn        = True
      cnres@vpHeightF = 0.1
      cnres@vpWidthF = 0.8
      cnres@vpXF = 0.1
      cnres@vpYF = 0.9

  uvplot = gsn_csm_vector(wks,uu,vv,res)
  cnplot = gsn_csm_contour(wks,vort,cnres)  ; create plot
  ;--------------------------- draw plot and fram wks------------------------------
  overlay(mpplot,cnplot)
  overlay(mpplot,uvplot)
  draw(mpplot)
  frame(wks)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
end
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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