Dear Help,
I am trying to create Indian state boundary. The following script is running
fine and it is creating "WRF_me.ps". But this "ps" file contains 2 images
(first image is without state boundary and the second image is with state
boundary).
I want to create ONLY second image. Could you please help to solve this
issue.
;=========================================
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
begin
; f = addfile ("wrfout_d01_2003-07-13_12:00:00.nc", "r")
a = addfile ("./../wrfout/wrfout_d01_2010-02-16_00:00:00.nc", "r")
f = addfile("india_st.shp", "r") ; Open shapefile
; Read character variable Times; Convert to string for plots ; Read vertical
coordinate for plot labels
times = chartostring(a->Times) ; built-in function
;print(times)
znu = a->ZNU(0,:) ; (Time, bottom_top)
; Read perturbation geopotential at all times and levels
x = a->T ; (Time, bottom_top,
south_north, west_east)
; create plots
wks = gsn_open_wks("ps" ,"WRF_me") ; ps,pdf,x11,ncgm,eps
gsn_define_colormap(wks,"BlAqGrYeOrReVi200") ; select color map
res = True ; plot mods desired
;;res@gsnMaximize = True ; uncomment to maximize size
res@gsnSpreadColors = True ; use full range of colormap
res@cnFillOn = True ; color plot desired
res@cnLinesOn = False ; turn off contour lines
res@cnLineLabelsOn = False ; turn off contour labels
res@mpOutlineOn = True ; Turn of map outlines
; Use WRF_contributed procedure to set map resources
WRF_map_c (a, res, 0)
; if appropriate, set True for native (direct) mapping (faster)
res@tfDoNDCOverlay = True ; set True for native mapping ;
will result in faster plotting
; associate the 2-dimensional coordinates to the variable for plotting only
if non-native plot
if (.not.res@tfDoNDCOverlay) then
x@lat2d = f->XLAT(0,:,:) ; direct assignment
x@lon2d = f->XLONG(0,:,:)
end if
; Turn on lat / lon labeling
;;123 res@pmTickMarkDisplayMode = "Always" ; turn on tickmarks
; Loop over all times and levels ( uncomment ) Demo: one arbitrarily closen
time and level
dimx = dimsizes(x) ; dimensions of x
ntim = dimx(0) ; number of time steps
klev = dimx(1) ; number of "bottom_top"
levels
nt = ntim/2 ; arbitrary time
kl = 6 ; " level
;;123 res@tiMainString = times(nt)
;;123 res@gsnLeftString = x@description+" z="+znu(kl)
plot = gsn_csm_contour_map(wks,x(nt,kl,:,:),res)
segments = f->segments
geometry = f->geometry
segsDims = dimsizes(segments)
geomDims = dimsizes(geometry)
; Read global attributes
geom_segIndex = f@geom_segIndex
geom_numSegs = f@geom_numSegs
segs_xyzIndex = f@segs_xyzIndex
segs_numPnts = f@segs_numPnts
plres=True
lines = new(segsDims(0),graphic) ; Array to hold polygons
numFeatures = geomDims(0)
lon = f->x
lat = f->y
segNum = 0
lat = f->y
lon = f->x
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, plot, lon(startPT:endPT),
lat(startPT:endPT), plres)
segNum = segNum + 1
end do
end do
plres = True ; resources for polylines
plres@gsEdgesOn = True ; draw border around polygons
plres@gsEdgeColor = "black"
colors = (/"white","transparent","yellow","red"/)
plres@gsFillColor = colors(1)
; plres@gsFillColor = False
; Maximize output in frame. This will draw everything and advance the frame.
maximize_output(wks, plres)
end
;=========================================
Thanking you,
with regards,
Sahidul
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jul 22 11:16:31 2010
This archive was generated by hypermail 2.1.8 : Wed Jul 28 2010 - 10:42:06 MDT