- 积分
- 1502
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-4-12
- 最后登录
- 1970-1-1
|
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
|
-
|