登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
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
出现的几幅奇葩图 如下
区域加大之后 仅仅是把坐标的范围加大
脚本如下
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 结果如下
求解释呀
注:我画 标量图正常,但是话矢量图就出问题?
是不是 ncl 底图 变小 之后 ,,,,话矢量图会出错
|