爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 10257|回复: 10

[作图] NCL叠加图大小不同

[复制链接]

新浪微博达人勋

发表于 2016-6-7 14:15:32 | 显示全部楼层 |阅读模式

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

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

x
新人,叠加图大小不同,求前辈指点。
8LWNT_U}}AJ)[B`W{0ZS.png
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-6-7 15:01:15 | 显示全部楼层
没代码,没法看。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-6-7 15:30:15 | 显示全部楼层
御风者 发表于 2016-6-7 15:01
没代码,没法看。

谢谢。

begin
  fu = addfile("D:\NCL\data\uwnd.mon.mean.nc","r")
  fv = addfile("D:\NCL\data\vwnd.mon.mean.nc","r")
;print(fu)
;printVarSummary(fu)
;exit
  u = fu->uwnd(1,0,:,:)     
  v = fv->vwnd(1,0,:,:)
speed=sqrt(u^2+v^2)
wks=gsn_open_wks("eps","overlay1d")
gsn_define_colormap(wks,"gui_default")

res=True
res@gsnDraw=False
res@gsnFrame=False
res@gsnAddCyclic=True
mpres=res
map=gsn_csm_contour_map(wks,speed,mpres)

cnres=res
vcres=res

vcres=True
vcres@gsnDraw = False
vcres@gsnFrame = False
vcres@vcRefMagnitudeF  = 30.0
vcres@vcRefLengthF   = 0.045
vcres@vcMinDistanceF    = 0.019
vcres@vcGlyphStyle    = "CurlyVector"
vcres@gsnLeftString  = ""
vcres@gsnRightString  = ""
vectors = gsn_csm_vector(wks,u,v,vcres)

cnres=True
cnres@gsnDraw=False
cnres@gsnFrame = False
cnres@cnFillOn                = True            
cnres@cnLinesOn               = False                        
cnres@gsnSpreadColors         = True         
cnres@lbLabelAutoStride       = True   
cnres@pmLabelBarOrthogonalPosF=0.05
cnres@lbLabelFontHeightF=0.01
contours=gsn_csm_contour(wks,speed,cnres)

overlay(vectors,contours)
overlay(map,vectors)
overlay(map,contours)

draw(map)
frame(wks)

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

新浪微博达人勋

发表于 2016-6-7 15:49:12 | 显示全部楼层

overlay(vectors,contours)
overlay(map,vectors)
overlay(map,contours)

把这个三个改为
overlay(map,vectors)
overlay(map,contours)
试试,即删掉第一行。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2016-6-7 15:56:35 | 显示全部楼层
御风者 发表于 2016-6-7 15:49
overlay(vectors,contours)
overlay(map,vectors)
overlay(map,contours)

试过了 没有用。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-6-11 09:50:22 | 显示全部楼层
是不是傻vectors = gsn_csm_vector(wks,u,v,vcres)
改为gsn_csm_vector_map试试看
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2017-2-25 20:19:06 | 显示全部楼层
请问楼主有没有解决呢?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2020-1-18 22:12:25 | 显示全部楼层
你好楼主,我也画过类似的图,是缺一个语句res@gsnMaximize       = True  
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2020-1-18 22:54:30 | 显示全部楼层
speed=sqrt(u^2+v^2) 这里前面要加上一句
speed=u
不然他没有赋变量,算出来的区域就不对,叠图顺序也错了。先叠填色图(带地图),再叠等值线就不会出这问题
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2020-1-18 22:57:06 | 显示全部楼层
这几天正好也在做这个
wks1 = gsn_open_wks("pdf","uvwind.700.19920617-19920618")
  gsn_define_colormap(wks1,"ViBlGrWhYeOrRe")
   f1=addfile("/mnt/d/fnl/uwnd.1992.nc","r")
   f2=addfile("/mnt/d/fnl/vwnd.1992.nc","r")
   time=f1->time
  its=1992061612
  ite=1992061812
  yyyymmddhh=cd_calendar(time, -3)
recs=ind(its.eq.yyyymmddhh)
rece=ind(ite.eq.yyyymmddhh)

   uwnd    = f1->uwnd(recs:rece,{700},:,:)
   uwnd    =uwnd
   vwnd    = f2->vwnd(recs:rece,{700},:,:)
   vwnd    =vwnd
   speed= uwnd
   speed=sqrt(uwnd^2+vwnd^2);
res=True

res@gsnFrame=False
res@gsnDraw=False
res@gsnLeftString=""
res@gsnRightString=""
res@vcGlyphStyle               ="WindBarb"   
res@vcMinDistanceF             =0.01;箭头间最小距离
res@vcWindBarbScaleFactorF  = 2.5    ; 风杆符合国内习惯(4m/s一个长杆)
;; 参考箭头
res@vcRefAnnoOn               = True  
res@vcRefMagnitudeF           = 12      ;标准长度箭头所表示的大小
res@vcRefLengthF              = 0.03   ;标准长度箭头在图形中的长度
res@vcRefAnnoFontHeightF      = 0.015   ;参考箭头标签字体大小

res@vcRefAnnoOrthogonalPosF    =-1.5
  
res@vcRefAnnoString1On        = False   ;设定参考箭头上、        
res@vcRefAnnoString2On        = True    ;        下的字符
res@vcRefAnnoString2          = "12 m/s"  

mres              =True
mres@gsnLeftString="700hPa"
mres@gsnRightString=""
mres@mpMinLatF                  = 20.   ;·¶Î§                     
mres@mpMaxLatF                  =40
mres@mpMinLonF                  =110.
mres@mpMaxLonF                  =130.
mres@gsnFrame=False
mres@gsnDraw=False
mres@gsnContourPosLineDashPattern=12;
mres@gsnContourNegLineDashPattern=2;
mres@gsnContourZeroLineThicknessF=2.0
mres@gsnAddCyclic               = True  
  mres@mpDataSetName              = "/mnt/d/ncl6.6/lib/ncarg/database/Earth..4"
  mres@mpDataBaseVersion          = "MediumRes" ; or "Ncarg4_1"
  mres@mpAreaMaskingOn            = True
  mres@mpMaskAreaSpecifiers       = (/"China"/)
  mres@mpOutlineSpecifiers        = (/"China","China:Provinces"/)
;mres@gsnRightString              = ""
;mres@gsnLeftString               = ""
mres@cnInfoLabelOn               = False;右下方等值线信息标签
mres@cnLinesOn                  = True;绘制等值线
mres@cnLineThicknessF           =2.0

mres@cnLineLabelsOn              = True
mres@cnLineLabelBackgroundColor  ="White";边框内颜色
mres@cnLineLabelAngleF           =0.0  ;标签角度
mres@cnLabelDrawOrder           ="PostDraw"

mres@cnFillOn                    = True;等值线填充
mres@lbLabelBarOn                =True;色标
;mres@pmLabelBarOrthogonalPosF  =0.102;与坐标重叠调色标垂直位置      


mres@cnLineLabelsOn=True
mres@cnLevelSelectionMode       = "ExplicitLevels";绘制特定等值线
mres@cnLevels                   =(/8,12,16,20,24,28/)
mres@cnFillColors               =(/50,58,66,74,82,90,98/)
base=new(rece-recs+1,graphic)
plot=new(rece-recs+1,graphic)
do i=1,(rece-recs+1)

plot(i-1)=gsn_csm_contour_map(wks1, speed(i-1,:,:),mres)
base(i-1)=gsn_csm_vector(wks1, uwnd(i-1,:,:), vwnd(i-1,:,:),res)
overlay(plot(i-1),base(i-1))
end  do
path_out = "/mnt/d/cjhongrao/uvwind.700.19920617-19920618.nc"

system("rm -f "+ path_out)      ; 若当前路径下有同名文件,则删除
ncdf = addfile(path_out,"c")    ; "c" 表示创建 netCDF 文件
ncdf->uwnd =uwnd(0:rece-recs,:,:)
ncdf->vwnd =vwnd(0:rece-recs,:,:)
pres=True
pres@txString="1992061712-1992061812"
pres@gsnPanelFigureStrings=(/"A","B","C","D","E","F","G","H","I"/)
pres@gsnPanelMainFontHeightF=0.03
pres@amJust="TopLeft"
gsn_panel(wks1, plot,(/3,3/) , pres)
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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