爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5917|回复: 3

NCL 画特别小的区域出现 奇葩现象 ? 相同数据坐标变大,则正常出图?难道是bug

[复制链接]

新浪微博达人勋

发表于 2013-12-12 09:03:37 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 guizi 于 2013-12-12 09:03 编辑

当区域比较小的时候脚本

begin
ntime   = 48
nlat    = 190
nlon    = 297
sumnum     = ntime*nlat

minlat = 23.19114549
  maxlat  = 23.37566132
  minlon  = 116.6007425
  maxlon  = 116.8892957

; read the data
datau = asciiread("../../fort.1914",(/sumnum,nlon/),"float")
datav = asciiread("../../fort.1915",(/sumnum,nlon/),"float")
my_lon= asciiread("../../fort.9201",(/nlat,nlon/),"float")
  my_lat= asciiread("../../fort.9202",(/nlat,nlon/),"float")

;~~~~~ Deal with the UV  E data #################################
my_datau  =new((/ntime,nlat,nlon/),float)
my_datav  =new((/ntime,nlat,nlon/),float)
my_datauv = new((/ntime,nlat,nlon/),float)

  doit=0,ntime-1
  doiy=0,nlat-1
  doix=0,nlon-1
my_datau(it,iy,ix)  =datau(it*nlat+iy,ix)*1000
my_datav(it,iy,ix)  =datav(it*nlat+iy,ix)*1000
my_datauv(it,iy,ix)=sqrt(my_datau(it,iy,ix)*my_datau(it,iy,ix)+my_datav(it,iy,ix)*my_datav(it,iy,ix))
  enddo
  enddo
  enddo
;########################################################

my_datau@long_name  ="WIND"
my_datau@units      ="cm**2/s**2"
my_lat@units ="degrees_north"
my_lon@units ="degrees_east"
;~~~~~~
time=ispan(1,ntime,1)
my_datau!0          ="time"
my_datau!1          ="lat2d"
my_datau!2          ="lon2d"
my_datau&time       = time

;坐标范围
my_datau@lat2d      = my_lat
  my_datau@lon2d      = my_lon

copy_VarCoords(my_datau,my_datav)
copy_VarCoords(my_datau,my_datauv)
my_datav@long_name  ="WINDV"


;************************************************
; create plot
;************************************************
  wks= gsn_open_wks("pdf","my_W")             ; open a ps file
gsn_define_colormap(wks,"BlAqGrYeOrReVi200")            ; choose color map
res                      =True               ; plot mods desired
  res@gsnSpreadColors     = True     ; use full colormap
res@gsnSpreadColorEnd   = 193       ; last color to use
res@gsnSpreadColorStart = 6        ; first color to use
res@lbLabelStride       = 2         ; plot every other colar bar label
  i =NhlNewColor(wks,0.7,0.7,0.7)      ; addgray to colormap for continents
                                       ; w/othis, they are white, and you
                                        ; cannot see them.
res@vcRefMagnitudeF         =0.5              ; make vectors larger
res@vcRefLengthF            =0.050            ; ref vec length
res@vcGlyphStyle            ="CurlyVector"    ; turn oncurly vectors
res@vcMinDistanceF          =0.017            ; thin out vectors

;res@vcVectorDrawOrder      ="Predraw"          ; drawcontours first
res@gsnAddCyclic         = False
res@gsnMaximize          =True               ; make ps, pdf, epslarge


res@mpFillDrawOrder         ="Predraw"
; res@mpDataBaseVersion    ="HighRes"
res@mpMinLonF            = minlon               ; select asubregion
res@mpMaxLonF            =  maxlon
res@mpMinLatF            =  minlat
res@mpMaxLatF            =  maxlat

   doit=0,ntime-1
    res@gsnCenterString    ="Time= "+(it+1)
   plot=gsn_csm_vector_scalar_map_ce(wks,my_datau(it,:,:),my_datav(it,:,:),\
                                   my_datauv(it,:,:),res)
  end do
end

出现的几幅奇葩图 如下

奇葩图48.jpg 奇葩图17.jpg



区域加大之后 仅仅是把坐标的范围加大
脚本如下

begin
ntime   = 48
nlat    = 190
nlon    = 297
sumnum     = ntime*nlat
; 坐标加大
  minlat = 0       ;23.19114549
  maxlat = 37.8    ;23.37566132
  minlon = 100     ;116.6007425
  maxlon = 159.4   ;116.8892957
; read the data
datau =  asciiread("../../fort.1914",(/sumnum,nlon/),"float")
datav = asciiread("../../fort.1915",(/sumnum,nlon/),"float")
;############################################
;~~~~~ Deal with the UV  E data #################################
my_datau  = new((/ntime,nlat,nlon/),float)
my_datav  =new((/ntime,nlat,nlon/),float)
my_datauv = new((/ntime,nlat,nlon/),float)
  doit=0,ntime-1
  doiy=0,nlat-1
  doix=0,nlon-1
my_datau(it,iy,ix)  =datau(it*nlat+iy,ix)*1000
my_datav(it,iy,ix)  =datav(it*nlat+iy,ix)*1000
my_datauv(it,iy,ix)=sqrt(my_datau(it,iy,ix)*my_datau(it,iy,ix)+my_datav(it,iy,ix)*my_datav(it,iy,ix))
  enddo
  enddo
  enddo
;########################################################
time=ispan(1,ntime,1)
my_lat=fspan(0,37.8,190)
  my_lon=fspan(100,159.4,297)
my_datau@long_name  ="WIND"
my_datau@units      ="cm**2/s**2"
my_lat@units ="degrees_north"
my_lon@units ="degrees_east"
my_datau!0          ="time"
my_datau!1          ="lat2d"
my_datau!2          ="lon2d"
my_datau&time       = time
; 把坐标换了,变大了
  my_datau&lat2d      = my_lat
  my_datau&lon2d      = my_lon
copy_VarCoords(my_datau,my_datav)
copy_VarCoords(my_datau,my_datauv)
my_datav@long_name  ="WINDV"
;************************************************
; create plot
;************************************************
  wks= gsn_open_wks("pdf","my_W")             ; open a ps file
gsn_define_colormap(wks,"BlAqGrYeOrReVi200")            ; choose color map
  res                      = True               ; plot mods desired
res@gsnSpreadColors     =True      ; use full colormap
res@gsnSpreadColorEnd   = 193       ; last color to use
res@gsnSpreadColorStart = 6        ; first color to use
res@lbLabelStride       = 2         ; plot every other colar bar label
  i =NhlNewColor(wks,0.7,0.7,0.7)      ; addgray to colormap for continents
res@vcRefMagnitudeF         =0.5              ; make vectors larger
res@vcRefLengthF            =0.050            ; ref vec length
res@vcGlyphStyle            ="CurlyVector"    ; turn oncurly vectors
res@vcMinDistanceF          =0.017            ; thin out vectors
res@vcVectorDrawOrder      ="Predraw"          ; drawcontours first
res@gsnAddCyclic         = False
res@gsnMaximize          =True               ; make ps, pdf, epslarge
res@mpMinLonF            =  minlon               ; select a subregion
res@mpMaxLonF            =  maxlon
res@mpMinLatF            =  minlat
res@mpMaxLatF            = maxlat
   doit=0,ntime-1
   res@gsnCenterString    ="Time= "+(it+1)
   plot=gsn_csm_vector_scalar_map_ce(wks,my_datau(it,:,:),my_datav(it,:,:),\
                                   my_datauv(it,:,:),res)
  end do
End
结果如下
大区域48.jpg 大区域17.jpg

求解释呀  

注:我画 标量图正常,但是话矢量图就出问题?
是不是 ncl  底图 变小 之后 ,,,,话矢量图会出错
                                                                 

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

新浪微博达人勋

发表于 2013-12-18 16:43:03 | 显示全部楼层
是不是地图的原因啊
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2013-12-18 16:57:13 | 显示全部楼层
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2013-12-20 09:20:13 | 显示全部楼层
doix=0,nlon-1
my_datau(it,iy,ix)  =datau(it*nlat+iy,ix)*1000
my_datav(it,iy,ix)  =datav(it*nlat+iy,ix)*10
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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