爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 23003|回复: 21

NCL矢量图求指点

[复制链接]
发表于 2013-6-21 01:18:21 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 infocert 于 2013-7-2 10:03 编辑
  1. netcdf desert.UVEL\,VVEL.01 {
  2. dimensions:
  3.     nlat = 384 ;
  4.     nlon = 320 ;
  5.     time = UNLIMITED ; // (1 currently)
  6.     z_t = 60 ;
  7.     d2 = 2 ;
  8. variables:
  9.     double ULAT(nlat, nlon) ;
  10.         ULAT:long_name = "array of u-grid latitudes" ;
  11.         ULAT:units = "degrees_north" ;
  12.         ULAT:_FillValue = 9.96920996838687e+36 ;
  13.         ULAT:missing_value = 9.96920996838687e+36 ;
  14.     double ULONG(nlat, nlon) ;
  15.         ULONG:long_name = "array of u-grid longitudes" ;
  16.         ULONG:units = "degrees_east" ;
  17.         ULONG:_FillValue = 9.96920996838687e+36 ;
  18.         ULONG:missing_value = 9.96920996838687e+36 ;
  19.     float UVEL(time, z_t, nlat, nlon) ;
  20.         UVEL:long_name = "Velocity in grid-x direction" ;
  21.         UVEL:units = "centimeter/s" ;
  22.         UVEL:coordinates = "ULONG ULAT z_t time" ;
  23.         UVEL:grid_loc = "3221" ;
  24.         UVEL:cell_methods = "time: mean" ;
  25.         UVEL:_FillValue = 9.96921e+36f ;
  26.         UVEL:missing_value = 9.96921e+36f ;
  27.     float VVEL(time, z_t, nlat, nlon) ;
  28.         VVEL:long_name = "Velocity in grid-y direction" ;
  29.         VVEL:units = "centimeter/s" ;
  30.         VVEL:coordinates = "ULONG ULAT z_t time" ;
  31.         VVEL:grid_loc = "3221" ;
  32.         VVEL:cell_methods = "time: mean" ;
  33.         VVEL:_FillValue = 9.96921e+36f ;
  34.         VVEL:missing_value = 9.96921e+36f ;
  35.     double time(time) ;
  36.         time:long_name = "time" ;
  37.         time:units = "days since 0000-01-01 00:00:00" ;
  38.         time:bounds = "time_bound" ;
  39.         time:calendar = "noleap" ;
  40.     double time_bound(time, d2) ;
  41.         time_bound:long_name = "boundaries for time-averaging interval" ;
  42.         time_bound:units = "days since 0000-01-01 00:00:00" ;
  43.     float z_t(z_t) ;
  44.         z_t:long_name = "depth from surface to midpoint of layer" ;
  45.         z_t:units = "centimeters" ;
  46.         z_t:positive = "down" ;
  47.         z_t:valid_min = 500.f ;
  48.         z_t:valid_max = 537500.f ;
复制代码
各位大神,小弟初学ncl,上面这种格式的文件怎么画(UVEL,VVEL)的矢量图,求各位大神指点,
风场的适量图我会处理,用风场的脚本套这个文件,总是出错,观察了下,问题应该出在nlat,nlon上,风场上的数据经纬都是一维的,应该用什么办法解决?多谢了!!!
密码修改失败请联系微信:mofangbao
 成长值: 19710
发表于 2013-6-21 08:24:53 | 显示全部楼层
    nlat = 384 ;
    nlon = 320 ;

这是一维的?
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2013-6-21 10:09:25 | 显示全部楼层

但我用风矢量图的脚本来套这个数据,总报错
这个数据跟风数据的区别在于ULAT和ULONG,在风数据里,这两个是一维的表示成lat(nlat),lon(nlon),而这里确是二维的,我的脚本如下:
  1. ncfile = "de-gr."+month+".nc"
  2.   f     = addfile(ncfile, "r")
  3.   ;data  = f->PS(0,:,:)
  4.   u     = f->UVEL(0,0,:,:)
  5.   v     = f->VVEL(0,0,:,:)

  6. ;************************************************
  7. ; create plot
  8. ;************************************************
  9.   wks_type = "png"
  10.   wks_type@wkWidth = 1280
  11.   wks_type@wkHeight = 1280
  12.   wks = gsn_open_wks(wks_type,"uvvel-nh-"+month)
  13.   gsn_define_colormap(wks, "BlWhRe")

  14.   res                  = True                ; plot mods desired
  15.   res@gsnMaximize      = True
  16.   res@gsnAddCyclic     = True

  17.   res@pmLabelBarHeightF=  0.100
  18.   res@pmLabelBarWidthF =  0.60              ; default is 0.6

  19.   mo = stringtoint(month)
  20.   res@tiMainString     = "UVEL VVEL in "+monthArr(mo)
  21.   res@gsnLeftString    = "desert-green"
  22.   res@gsnRightString   = "units: "+u@units

  23.   res@gsnPolar = "NH"

  24.   res@vcRefMagnitudeF  = 1.0
  25.   res@vcRefLengthF     = 0.045
  26.   res@vcMinDistanceF   = 0.017

  27.   res@vcRefMagnitudeF      = 5.0                 ; make vectors larger
  28.   res@vcRefLengthF         = 0.2              ; ref vector length
  29.   res@vcMonoLineArrowColor = True
  30.   res@vcLineArrowColor      = "black"
  31.   plot = gsn_vector_map(wks, u, v, res)
复制代码
密码修改失败请联系微信:mofangbao
 成长值: 19710
发表于 2013-6-21 10:14:14 | 显示全部楼层
infocert 发表于 2013-6-21 10:09
但我用风矢量图的脚本来套这个数据,总报错
这个数据跟风数据的区别在于ULAT和ULONG,在风数据里,这两个 ...

你一直说错,那错误信息呢,大哥。。。
密码修改失败请联系微信:mofangbao
发表于 2013-6-21 10:22:01 | 显示全部楼层
楼主把出错提示发上来
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2013-6-21 10:23:43 | 显示全部楼层
兰溪之水 发表于 2013-6-21 10:14
你一直说错,那错误信息呢,大哥。。。

呵呵,不好意思,错误如下
  1. fatal:VectorPlotDraw: VVECTR - VECTOR NDC LENGTH TOO GREAT
  2. fatal:VectorPlotDraw: error drawing vectors
  3. fatal:VectorPlotDraw: draw error
  4. fatal:PlotManagerDraw: error in plot draw
  5. fatal:_NhlPlotManagerDraw: Draw error
复制代码
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2013-6-21 10:25:27 | 显示全部楼层
尽头的尽头 发表于 2013-6-21 10:22
楼主把出错提示发上来

不好意思,已经发了
密码修改失败请联系微信:mofangbao
发表于 2013-6-21 10:33:35 | 显示全部楼层
infocert 发表于 2013-6-21 10:25
不好意思,已经发了

  res@vcRefMagnitudeF      = 5.0                 ; make vectors larger
  res@vcRefLengthF         = 0.2              ; ref vector length
这两句重复了,把下面的删掉试试,不行再根据数据改变这两句的数值
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2013-6-21 10:36:36 | 显示全部楼层
尽头的尽头 发表于 2013-6-21 10:33
res@vcRefMagnitudeF      = 5.0                 ; make vectors larger
  res@vcRefLengthF         ...

谢谢,我试试,但我觉得应该不是这两句的问题,这个脚本之前画过一个风适量的图,是没问题的,就算res的属性设置重复,也只会产生一个warning,不会产生error的
密码修改失败请联系微信:mofangbao
 成长值: 19710
发表于 2013-6-21 10:46:03 | 显示全部楼层
ncfile = "de-gr."+month+".nc"
  f     = addfile(ncfile, "r")
  u     = f->UVEL(0,0,:,:)
  v     = f->VVEL(0,0,:,:)

;************************************************
; create plot
;************************************************
  wks_type = "png"
  wks_type@wkWidth = 1280
  wks_type@wkHeight = 1280
  wks = gsn_open_wks(wks_type,"uvvel-nh-"+month)
  gsn_define_colormap(wks, "BlWhRe")

  res                  = True                ; plot mods desired
  plot = gsn_vector_map(wks, u, v, res)



看看这样会报什么错~
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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