Hi, everyone,
I'm newer, studing ncl for several weeks. Such an issue coms to me and I'm out of mind to deal with.
I downloaded the sample WRF_static_1.ncl ,and modified a little for drawing topography , by reading static data from WRF geogrid.exe program .
1. I need set lon/lat tickmark by manual, So i added these words
res@tmXBOn = True
res@tmXBMode = "Manual"
res@tmXBTickStartF = 0
res@tmXBTickEndF = 360
res@tmXBTickSpacingF = 20
and commented
res@pmTickMarkDisplayMode = "Always" .
But there was no any label as i expected. So does Y label. I managed to set labels like this before.
2. I want to fill the sea area (masked as missing value already ) with some fillpatterns, so I added:
res@cnMissingValFillColor = 7
res@cnMissingValFillPattern = 5
Thus I got the plot that all masked area( sea area) was filled with mono color not the pattern I selected.
I really don't know where i made the mistake. Can someone help me?
My great appreciate!
Sincerely, T.Feng
This is my script:
;*************************************************
; WRF: sample plot of "static" variables
;************************************************
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/WRF_contributed.ncl"
begin
;************************************************
; open file and read in data
;************************************************
f = addfile ("geo_em.d01.nc", "r")
;************************************************
; Read Analysis grid average elevation
; Read non-staggard lat/lon coordinates.
; Read land/sea mask
;************************************************
x = f->HGT_M(0,:,:) ; avg(record, z, y, x)
lat2d = f->XLAT_M (0,:,:)
lon2d = f->XLONG_M(0,:,:)
lsMask= f->LANDMASK(0,:,:) ; land (1) water (0) mask
;************************************************
; Associate 2D coordinates with x for plotting
;************************************************
x@lat2d = lat2d
x@lon2d = lon2d
;************************************************
; Use mask function to set all ocean areas to _FillValue
;************************************************
x = mask(x,lsMask,1) ; sea
;************************************************
; The file should be examined via: ncdump -v grid_type static.wrsi
; This will print the print type. then enter below.
;************************************************
projection = "mercator"
;************************************************
; create plots
;************************************************
wks = gsn_open_wks("png" ,"WRF_static") ; ps,pdf,x11,ncgm,eps
gsn_define_colormap(wks,"BlAqGrYeOrRe") ; select color map
res = True ; plot mods desired
res@gsnDraw = False ; don't draw
res@gsnFrame = False ; don't advance frame
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@cnFillMode = "RasterFill" ; Use Raster Mode
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = (/0,100,200,500,1000,2000,3000,4000,5000,6000/)
;************************************************
; Turn on lat / lon labeling
;************************************************
;res@pmTickMarkDisplayMode = "Always" ; turn on tickmarks
;************************************************
; set map limits
;************************************************
dimll = dimsizes(lat2d)
nlat = dimll(0)
mlon = dimll(1)
res@mpProjection = projection
res@mpLimitMode = "Corners"
res@mpLeftCornerLatF = lat2d(0,0)
res@mpLeftCornerLonF = lon2d(0,0)
res@mpRightCornerLatF = lat2d(nlat-1,mlon-1)
res@mpRightCornerLonF = lon2d(nlat-1,mlon-1)
res@mpCenterLonF = 0 ; set center logitude
if (projection.eq."LambertConformal") then
res@mpLambertParallel1F = f->Latin1
res@mpLambertParallel2F = f->Latin2
res@mpLambertMeridianF = f->LoV
end if
res@mpFillOn = False ; turn off map fill
res@mpOutlineDrawOrder = "PostDraw" ; draw continental outline last
;res@mpOutlineBoundarySets = "GeophysicalAndUSStates" ; state boundaries
;;res@tfDoNDCOverlay = True ; True only for 'native' grid
res@gsnAddCyclic = True ; data are not cyclic
res@lbLabelAutoStride = True ; let NCL determine label bar spacing
res@cnMissingValFillColor = 7 ; color fill missing areas blue
res@cnMissingValFillPattern = 5 ; set the missing value fill pattern to 5
; lb settings
res@lbOrientation = "Horizontal"
res@lbBoxCount = 11
;res@lbLabelFont = "Helvetica-bold"
res@lbLabelFontHeightF= 0.008
res@lbLabelAlignment = "ExternalEdges"
res@lbLabelStrings = (/"Ocean","0","100","200","500","1000","2000","3000", \
"4000","5000","6000","7000"/)
res@tmXBOn = True
res@tmXBMode = "Manual"
res@tmXBTickStartF = 0
res@tmXBTickEndF = 360
res@tmXBTickSpacingF = 20
plot = gsn_csm_contour_map(wks, x, res)
draw(plot)
frame(wks)
end
2011-04-10
atao7cz
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Apr 11 13:36:04 2011
This archive was generated by hypermail 2.1.8 : Tue Apr 19 2011 - 18:32:03 MDT