爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1509|回复: 3

画图时函数 和程序的区别

[复制链接]
发表于 2015-11-6 12:48:08 | 显示全部楼层 |阅读模式
NCL
系统平台:
问题截图: -
问题概况: fatal:syntax error: gsn_add_polymarker is a function not a procedure; return value must be referenced
我看过提问的智慧: 看过
自己思考时长(天): 2

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

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

x
dumDot2 = gsn_add_polymarker(xwks, plot,  39.03,88.19, resDot)
和gsn_polymarker(wks,plot,83.63,39.04,pmres)有什么区别呢,最后draw(plot)什么时候加呢


密码修改失败请联系微信:mofangbao
发表于 2015-11-6 13:56:25 | 显示全部楼层
看gsn_polymaker的帮助

If you want to resize the plot (i.e. by passing the plot to gsn_panel or setting the vpWidthF or vpHeightF resources), then use the function gsn_add_polymarker. This will cause the polymarkers to be attached to the given plot, and hence automatically resized when the plot is resized.
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2015-11-6 14:51:12 | 显示全部楼层
本帖最后由 chongzika 于 2015-11-6 14:52 编辑
longlivehj 发表于 2015-11-6 13:56
看gsn_polymaker的帮助

If you want to resize the plot (i.e. by passing the plot to gsn_panel or s ...

画图一般什么时候在末尾添加draw呢,另外我用的3.7版本wrf自带的plotgrids.ncl 画的图为何站点只能标注一个呢? wps_show_dom.png
;   Script display location of model domains
;   Only works for ARW domains
;   Only works for NCL versions 6.1.x
;   Reads namelist file directly

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"   
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

begin
;

; Check the version of NCL
  version = systemfunc("ncl -V")
  if(version.lt.6.1) then
    print("You need NCL V6.1 to run this script. Try running util/plotgrids_old.ncl. Stopping now...")
    return
  end if
  if(version.ge.6.2) then
    print("You need NCL V6.1 to run this script. Try running util/plotgrids_new.ncl. Stopping now...")
    return
  end if

; We generate plots, but what kind do we prefer?
; type = "x11"
  type = "pdf"
; type = "ps"
; type = "ncgm"
  wks = gsn_open_wks(type,"wps_show_dust")

; read the following namelist file
  filename = "namelist.wps"

x=(/83.63,39.03,37.07,37.12,41.76/)
y=(/39.04, 88.19, 82.70,79.93,86.11/)
m=(/"tz", "rq", "mf", "ht", "kel"/)


; Set the colors to be used
  colors = (/"white","black","White","ForestGreen","DeepSkyBlue","Red","Blue"/)
  gsn_define_colormap(wks, colors)  


; Set some map information ; line and text information
  mpres = True
  mpres@gsnDraw     = False
  mpres@gsnFrame    = False
  mpres@mpFillOn = True
  mpres@mpFillColors  = (/"background","DeepSkyBlue","ForestGreen","DeepSkyBlue", "transparent"/)
  mpres@mpDataBaseVersion           = "Ncarg4_1"
  mpres@mpGeophysicalLineColor      = "Black"
  mpres@mpGridLineColor             = "Black"
  mpres@mpLimbLineColor             = "Black"
  mpres@mpNationalLineColor         = "Black"
  mpres@mpPerimLineColor            = "Black"
  mpres@mpUSStateLineColor          = "Black"
;  mpres@mpOutlineBoundarySets       = "AllBoundaries"
  ;mpres@mpGridSpacingF              = 45
  ;mpres@gsnAddCyclic  = False
  mpres@mpDataSetName         = "Earth..4"   ; This new database contains
                                           ; divisions for other countries.
  mpres@mpDataBaseVersion     = "MediumRes"  ; Medium resolution database
  mpres@mpOutlineOn=True ; Turn on map outlines
  mpres@mpOutlineSpecifiers=(/"China","Xinjiang Uygur"/) ;China:states
  mpres@pmTickMarkDisplayMode = "Always"         ; turn on tickmarks
  mpres@tiMainString                = " WPS Domain Configuration  "


  lnres = True
  lnres@gsLineThicknessF = 2.5
  lnres@domLineColors    = (/ "white", "Red" , "Red" , "Blue" /)

  txres = True
  txres@txFont = "helvetica-bold"
  ;txres@txJust = "BottomLeft"
  txres@txJust = "TopLeft"
  txres@txPerimOn = False
  txres@txFontHeightF = 0.015
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Do not change anything between the ";;;;;" lines

  maxdom = 21
  nvar = 17
  parent_idn = new (maxdom,integer)
  parent_grid_ration = new (maxdom,integer)
  i_parent_startn = new (maxdom,integer)
  j_parent_startn = new (maxdom,integer)
  e_wen = new (maxdom,integer)
  e_snn = new (maxdom,integer)
  plotvar = new((/maxdom,nvar/),float)
  plotvar@_FillValue = -999.0

  plotvar = wrf_wps_read_nml(filename)

  mpres@max_dom = floattointeger(plotvar(0,0))
  mpres@dx = plotvar(0,1)
  mpres@dy = plotvar(0,2)
  mpres@ref_lat = plotvar(0,3)
  mpres@ref_lon = plotvar(0,4)
  mpres@truelat1 = plotvar(0,5)
  mpres@truelat2 = plotvar(0,6)
  mpres@stand_lon = plotvar(0,7)
  mproj_int = plotvar(0,8)
  mpres@pole_lat = plotvar(0,9)
  mpres@pole_lon = plotvar(0,10)

  do i = 0,maxdom-1
    parent_idn(i) = floattointeger(plotvar(i,11))
    parent_grid_ration(i) = floattointeger(plotvar(i,12))
    i_parent_startn(i) = floattointeger(plotvar(i,13))
    j_parent_startn(i) = floattointeger(plotvar(i,14))
    e_wen(i) = floattointeger(plotvar(i,15))
    e_snn(i) = floattointeger(plotvar(i,16))
  end do

  if(mpres@max_dom .gt. 1) then
    do i = 1,mpres@max_dom-1

      ;Making sure edge is nested grid is at least 5 grid points from mother domain.
      if(i_parent_startn(i) .lt. 5) then
        print("Warning: Western edge of grid must be at least 5 grid points from mother domain!")
      end if
      if(j_parent_startn(i) .lt. 5) then
        print("Warning: Southern edge of grid must be at least 5 grid points from mother domain!")
      end if
      pointwe = (e_wen(i)-1.)/parent_grid_ration(i)
      pointsn = (e_snn(i)-1.)/parent_grid_ration(i)
      gridwe = e_wen(parent_idn(i)-1)-(pointwe+i_parent_startn(i))
      gridsn = e_snn(parent_idn(i)-1)-(pointsn+j_parent_startn(i))
      if(gridwe .lt. 5) then
        print("Warning: Eastern edge of grid must be at least 5 grid points from mother domain!")
      end if
      if(gridsn .lt. 5) then
        print("Warning: Northern edge of grid must be at least 5 grid points from mother domain!")
      end if

      ;Making sure nested grid is fully contained in mother domain.
      gridsizewe = (((e_wen(parent_idn(i)-1)-4)-i_parent_startn(i))*parent_grid_ration(i))-(parent_grid_ration(i)-1)
      gridsizesn = (((e_snn(parent_idn(i)-1)-4)-j_parent_startn(i))*parent_grid_ration(i))-(parent_grid_ration(i)-1)
      if(gridwe .lt. 5) then
        print("Warning: Inner nest (domain = " + (i+1) + ") is not fully contained in mother nest (domain = " + parent_idn(i) + ")!")
        print("For the current setup of mother domain = " + parent_idn(i) + ", you can only have a nest of size " + gridsizewe + "X" + gridsizesn + ". Stopping Program!")
        exit
      end if
      if(gridsn .lt. 5) then
        print("Warning: Inner nest (domain = " + (i+1) + ") is not fully contained in mother nest (domain = " + parent_idn(i) + ")!")
        print("For the current setup of mother domain = " + parent_idn(i) + ", you can only have a nest of size " + gridsizewe + "X" + gridsizesn + ". Stopping Program!")
        exit
      end if

      ;Making sure the nest ends of a mother grid domain point.
      pointwetrunc = decimalPlaces(pointwe,0,False)
      pointsntrunc = decimalPlaces(pointsn,0,False)
      if((pointwe-pointwetrunc) .ne. 0.) then
        nest_we_up = (ceil(pointwe)*parent_grid_ration(i))+1
        nest_we_dn = (floor(pointwe)*parent_grid_ration(i))+1
        print("Nest does not end on mother grid domain point. Try " + nest_we_dn + " or " + nest_we_up + ".")
      end if
      if((pointsn-pointsntrunc) .ne. 0.) then
        nest_sn_up = (ceil(pointsn)*parent_grid_ration(i))+1
        nest_sn_dn = (floor(pointsn)*parent_grid_ration(i))+1
        print("Nest does not end on mother grid domain point. Try " + nest_sn_dn + " or " + nest_sn_up + ".")
      end if

    end do
  end if

  mpres@parent_id = parent_idn(0:mpres@max_dom-1)
  mpres@parent_grid_ratio = parent_grid_ration(0:mpres@max_dom-1)
  mpres@i_parent_start = i_parent_startn(0:mpres@max_dom-1)
  mpres@j_parent_start = j_parent_startn(0:mpres@max_dom-1)
  mpres@e_we = e_wen(0:mpres@max_dom-1)
  mpres@e_sn = e_snn(0:mpres@max_dom-1)

  if(mproj_int .eq. 1) then
    mpres@map_proj = "lambert"
    mpres@pole_lat = 0.0
    mpres@pole_lon = 0.0
  else if(mproj_int .eq. 2) then
    mpres@map_proj = "mercator"
    mpres@pole_lat = 0.0
    mpres@pole_lon = 0.0
  else if(mproj_int .eq. 3) then
    mpres@map_proj = "polar"
    mpres@pole_lat = 0.0
    mpres@pole_lon = 0.0
  else if(mproj_int .eq. 4) then
    mpres@map_proj = "lat-lon"
  end if
  end if
  end if
  end if

  plot = wrf_wps_dom (wks,mpres,lnres,txres)
  ;plot = gsn_csm_contour_map (wks,mpres,lnres,txres)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Now you can add some information to the plot.
; Below is an example of adding a white dot over the DC location.
pmres = True
  pmres@gsMarkerColor = "White"
  pmres@gsMarkerIndex = 16
  pmres@gsMarkerSizeF = 0.01
  gsn_polymarker(wks,plot,x,y,pmres)

  txres2 = True
  txres2@txFontColor = "grey58"
  txres2@txFont  = 26
  txres2@txFontHeightF =0.005
  gsn_text(wks, plot, m, x,y, txres2)


  frame(wks)           ; lets frame the plot - do not delete

end


密码修改失败请联系微信:mofangbao
发表于 2015-11-6 15:52:35 | 显示全部楼层
学艺不精,表示默默关注一下
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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