爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 3570|回复: 0

ncl画图有问题,一张图出两个,一个水平放置,一个垂直放置,水平放置的图还缺一块

[复制链接]

新浪微博达人勋

发表于 2015-8-10 19:53:55 | 显示全部楼层 |阅读模式
NCL
系统平台:
问题截图: -
问题概况: ncl画图有问题,一张图出两个,一个水平放置,没有经纬度信息,一个垂直放置,水平放置的图还缺一块,添加的底图也对不上
我看过提问的智慧: 看过
自己思考时长(天): 2

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

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

x
ncl画图有问题,一张图出两个,一个水平放置,没有经纬度信息,一个垂直放置,水平放置的图还缺一块,添加的底图也对不上,图是这样的,在最后面。
求各位看看是什么原因。。。没有报错


脚本如下:
;   Example script to produce plots for a WRF real-data run,
;   with the ARW coordinate dynamics option.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
;
; The WRF ARW input file.  
; This needs to have a ".nc" appended, so just do it.
  a = addfile("/home/huanglei/WRFV3.1/run/d03.nc","r")

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

; Set some basic resources
  res = True
  res@MainTitle = "REAL-TIME WRF"
  pltres = True
  mpres = True
  mpres@mpGeophysicalLineColor = "Black"
  mpres@mpNationalLineColor    = "Black"
  mpres@mpUSStateLineColor     = "Black"
  mpres@mpGridLineColor        = "Black"
  mpres@mpLimbLineColor        = "Black"
  mpres@mpPerimLineColor       = "Black"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; What times and how many time steps are in the data set?
  FirstTime = True
  times = wrf_user_list_times(a)  ; get all times in the file
  ntimes = dimsizes(times)         ; number of times in the file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  do it = 1,ntimes-1,1            ; TIME LOOP
    print("Working on time: " + times(it) )

    res@TimeLabel = times(it)   ; Set Valid time to use on plots
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; First get the variables we will need        

  ; Get non-convective, convective and total precipitation
  ; Calculate tendency values                              
    rain_exp = wrf_user_getvar(a,"RAINNC",it)
    rain_con = wrf_user_getvar(a,"RAINC",it)
    rain_tot = rain_exp + rain_con
    rain_tot@description = "Total Precipitation"
   


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

    ; Plotting options for Precipitation
        opts_r = res                        
        opts_r@UnitLabel            = "mm"
        opts_r@cnLevelSelectionMode = "ExplicitLevels"
        opts_r@cnLevels             = (/ .1, .2, .4, .8, 1.6, 3.2, 6.4, \
                                        12.8, 25.6, 51.2, 102.4/)
        opts_r@cnFillColors         = (/"White","White","DarkOliveGreen1", \
                                        "DarkOliveGreen3","Chartreuse", \
                                        "Chartreuse3","Green","ForestGreen", \
                                        "Yellow","Orange","Red","Violet"/)
        opts_r@cnInfoLabelOn        = False
        opts_r@cnConstFLabelOn      = False
        opts_r@cnFillOn             = True
       opts_r@gsnPaperOrientation =  "landscape"   
      ; Total Precipitation (color fill)
        contour_tot = wrf_contour(a,wks, rain_tot, opts_r)
   
   m=addfile("/home/huanglei/WRFV3.1/run/shaanxi_diqu.shp","r") ;openshapefile
;read data of shapefile
     segments = m->segments
     geometry = m->geometry
     segsDims = dimsizes(segments)
     geomDims = dimsizes(geometry)
     geom_segIndex = m@geom_segIndex
     geom_numSegs  = m@geom_numSegs
     segs_xyzIndex = m@segs_xyzIndex
     segs_numPnts  = m@segs_numPnts
     lines  = new(segsDims(0),graphic) ;Array to hold polygons
     numFeatures = geomDims(0)
     plres  = True ;resources for polylines
     plres@gsLineColor = "black"
  lon   = m->x
  lat   = m->y
  segNum = 0
  do i=0, numFeatures-1
     startSegment = geometry(i, geom_segIndex)
     numSegments  = geometry(i, geom_numSegs)
     do seg=startSegment, startSegment+numSegments-1
        startPT = segments(seg, segs_xyzIndex)
        endPT = startPT + segments(seg, segs_numPnts) - 1
       lines(segNum) = gsn_add_polyline(wks, contour_tot, lon(startPT:endPT), \
                                                    lat(startPT:endPT), plres)
        segNum = segNum + 1
     end do
  end do
draw(contour_tot)
frame(wks)

        delete(opts_r)

      ; MAKE PLOTS                                       
        ; Total Precipitation
          plot = wrf_map_overlays(a,wks,contour_tot,pltres,mpres)
        
  end do        ; END OF TIME LOOP
end



qq.PNG
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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