爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2949|回复: 3

ncl画pannel图

[复制链接]
发表于 2016-3-24 14:24:09 | 显示全部楼层 |阅读模式
NCL
系统平台:
问题截图: -
问题概况: 我想画pannel图,对应控制实验,敏感试验,差值。一共3个时刻,总共9张图在一个图中。差值的单独用一个色标。
我看过提问的智慧: 看过
自己思考时长(天): 2

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

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

x
运行结果报错
Copyright (C) 1995-2015 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.3.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.

Variable: edust
Type: float
Total Size: 604800 bytes
            151200 values
Number of Dimensions: 4
Dimensions and sizes:   [3] x [1] x [180] x [280]
Coordinates:
fatal:Eq: Dimension size, for dimension number 0, of operands does not match, can't continue

fatal:["Execute.c":8575]:Execute: Error occurred at or near line 926 in file /nuist/p/public/app/ncl/6.3.0/pgi/13.3-0/lib/ncarg/nclscripts/csm/gsn_csm.ncl

fatal:["Execute.c":8575]:Execute: Error occurred at or near line 1551 in file /nuist/p/public/app/ncl/6.3.0/pgi/13.3-0/lib/ncarg/nclscripts/csm/gsn_csm.ncl

fatal:["Execute.c":8575]:Execute: Error occurred at or near line 6944 in file /nuist/p/public/app/ncl/6.3.0/pgi/13.3-0/lib/ncarg/nclscripts/csm/gsn_csm.ncl

fatal:["Execute.c":8575]:Execute: Error occurred at or near line 67 in file panneledust.ncl


                               
登录/注册后可看大图

脚本如下http://met.sysu.edu.cn/GloCli/Te ... cations/panel.shtml第15个例子
;***************************************
begin
  files     = systemfunc("ls -1 ./wrfout_d02*")
  f=addfiles(files,"r")
  edust   = wrf_user_getvar(f,"EDUST1",-1)+wrf_user_getvar(f,"EDUST2",-1)+wrf_user_getvar(f,"EDUST3",-1)+wrf_user_getvar(f,"EDUST4",-1)+wrf_user_getvar(f,"EDUST5",-1)
  printVarSummary(edust)
  edust@lat2d = wrf_user_getvar(f,"XLAT",-1)   ; latitude/longitude
  edust@lon2d = wrf_user_getvar(f,"XLONG",-1)  ; required for plotting
  filesno     = systemfunc("ls -1 ./no/wrfout_d02*")
  a=addfiles(filesno,"r")
edustno   = wrf_user_getvar(a,"EDUST1",-1)+wrf_user_getvar(a,"EDUST2",-1)+wrf_user_getvar(a,"EDUST3",-1)+wrf_user_getvar(a,"EDUST4",-1)+wrf_user_getvar(a,"EDUST5",-1)
  edustno@lat2d = wrf_user_getvar(a,"XLAT",-1)   ; latitude/longitude
  edustno@lon2d = wrf_user_getvar(a,"XLONG",-1)  ; required for plotting
edustd  = edust-edustno
  edustd@lat2d = wrf_user_getvar(f,"XLAT",-1)   ; latitude/longitude
  edustd@lon2d = wrf_user_getvar(f,"XLONG",-1)  ; required for plotting
;***************************************
; create first two individual plots
;***************************************
  wks = gsn_open_wks("png","paneledust111")        ; send graphics to PNG file
  plot = new(3,graphic)
  plotno = new(3,graphic)
  res                   = True             ; plot mods desired
  res@cnFillOn          = True             ; turn on color
  res@cnLinesOn         = False            ; turn off contour lines
  res@cnFillPalette     = "MPL_YlOrBr"    ; set color map
  res@lbLabelBarOn      = False            ; turn off individual label bars
  res@gsnDraw           = False            ; don't draw yet
  res@gsnFrame          = False            ; don't advance frame yet
  res@gsnAddCyclic      = False            ; data already has cyclic point
  res@mpMinLatF     = min(edust@lat2d)
  res@mpMaxLatF     = max(edust@lat2d)
  res@mpMinLonF     = min(edust@lon2d)
  res@mpMaxLonF     = max(edust@lon2d)
  res@mpDataSetName               = "Earth..4"
  res@mpDataBaseVersion           = "MediumRes"
  res@mpOutlineOn                 = True
  res@mpOutlineSpecifiers         = (/"China:states"/)
  res@pmTickMarkDisplayMode = "Always"         ; turn on tickmarks

  ;res@cnLevelSelectionMode = "ManualLevels"; manual set levels so lb consistent
  ;res@cnMinLevelValF       = 0             ; min level
  ;res@cnMaxLevelValF       = 28            ; max level
  ;res@cnLevelSpacingF      = 2             ; contour interval
  ;res@mpLandFillColor      = "white"       ; make land white

  res@cnLevelSelectionMode = "ExplicitLevels"   ; set explicit contour levels
  res@cnLevels            = (/10,50,100,200,500,1000,2000,5000,10000/)
      
  res@gsnCenterString = "ec-smois"
  plot(0) = gsn_csm_contour_map_ce(wks,edust(0,0,:,:),res)
  plot(1) = gsn_csm_contour_map_ce(wks,edust(1,0,:,:),res)
  plot(2) = gsn_csm_contour_map_ce(wks,edust(2,0,:,:),res)
;***************************************
; panel first two plots
;***************************************
  pres1                     = True
  pres1@gsnPanelLabelBar    = True       ; common label bar
  pres1@gsnFrame            = False      ; don't advance frame yet
  pres1@lbOrientation       = "vertical" ; vertical label bar
; we use PanelBottom to tell the plot to only draw in the top part of the page.
; since there are two plots here, and we have limited the plot to the upper
; 0.6 of the page, each plot will have a size 0.3.
  pres1@gsnPanelBottom      = 0.3        ; move bottom up from 0.0 to 0.4
  gsn_panel(wks,plot,(/1,3/),pres1)
;***************************************
  res@gsnCenterString = "ec-no"
  plotno(0) = gsn_csm_contour_map_ce(wks,edustno(0,0,:,:),res)
  plotno(1) = gsn_csm_contour_map_ce(wks,edustno(1,0,:,:),res)
  plotno(2) = gsn_csm_contour_map_ce(wks,edustno(2,0,:,:),res)
  pres1@gsnPanelBottom      = 0.5        ; move bottom up from 0.0 to 0.4
  gsn_panel(wks,plotno,(/1,3/),pres1)
; create third individual plots
;***************************************
  res@cnFillPalette     = "CBR_coldhot"    ; set color map
  res@cnMinLevelValF       = 0             ; min level
  res@cnMaxLevelValF       = 200            ; max level
  res@cnLevelSpacingF      = 20             ; contour interval
  res@gsnCenterString = "difference"

  plot2 = new(3,graphic)
  plot2(0) = gsn_csm_contour_map_ce(wks,edustd(0,0,:,:),res)
  plot2(1) = gsn_csm_contour_map_ce(wks,edustd(1,0,:,:),res)
  plot2(2) = gsn_csm_contour_map_ce(wks,edustd(2,0,:,:),res)
;***************************************
; create panel of just third plot to keep aspect ratio
; the same as the panel above
;***************************************
  pres2                     = True
  pres2@gsnPanelLabelBar    = True       ; common label bar
  pres2@gsnPanelTop         = 0.3        ; draw up to the bdry of upper plot
  pres2@gsnPanelBottom      = 0.1        ; move bottom up so size is 0.3
  pres2@gsnFrame            = False      ; don't advance frame yet
  pres2@lbOrientation       = "vertical" ; vertical label bar
  gsn_panel(wks,plot2,(/1,3/),pres2)
; now advance frame for all plots
  frame(wks)

end



密码修改失败请联系微信:mofangbao
发表于 2016-3-24 15:09:58 | 显示全部楼层
谢谢
╭︿︿︿╮
{/ o  o /}  
( (oo) )   
  ︶︶︶
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2016-3-25 09:38:55 | 显示全部楼层
http://blog.sina.com.cn/s/blog_76f9c63f0102vgan.html别人有提到这个问题
但是我这个量是个2维的啊
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2016-3-25 14:36:39 | 显示全部楼层
; The key to making gsn_csm_contour_map work with WRF data is:
;
; 1. Reading XLAT/XLONG off the file and attaching them as
;    special "lat2d" and "lon2d" attributes of the data to
;    be plotted.
;
; 2. Zooming in on the map (WRF data is regional and NCL
;    creates global plots by default).
hgt       = wrf_user_getvar(a,"HGT",it)    ; Terrain elevation
  hgt@lat2d = wrf_user_getvar(a,"XLAT",it)   ; latitude/longitude
  hgt@lon2d = wrf_user_getvar(a,"XLONG",it)  ; required for plotting
;---Zoom in on plot
  res@mpMinLatF     = min(hgt@lat2d)
  res@mpMaxLatF     = max(hgt@lat2d)
  res@mpMinLonF     = min(hgt@lon2d)
  res@mpMaxLonF     = max(hgt@lon2d)
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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