[ncl-talk] Question about adding stipples on contour map
Wang, Jiali
jialiwang at anl.gov
Tue Jul 18 16:22:26 MDT 2017
Dear NCL experts,
I am trying to add stipples (or hatchings, doesn't matter) on a contour map when my "alpha >2". I plot alpha, which is not always larger than 2, meaning that I should have some places where I don't have stipples. However, I get stipples everywhere even when I set the threshold to 4. Attached are two maps, one is alpha, and the other is something else but with sitpples when alpha>2.
Here is my script. Can you please take a look and advice what happens? Thank you very much!
=============================================
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
files1 = systemfunc("ls ./T2_IV_DJF_50_rs*.nc")
a = addfiles(files1,"r")
f = addfile("T2_IV_DJF_12to50_16m.nc","r")
c = addfile("/global/cscratch1/sd/wangjl/RCP85_IV_RUNS/50km_1995_IV_runs/wrfout_d01_1996-03-01_00_00_00"+".nc","r")
lat = c->XLAT(0,:,:)
lon = c->XLONG(0,:,:)
ListSetType (a, "join")
IV_10 = a[:]->IV
IV_16 = f->IV
rain = new(dimsizes(IV_10),typeof(IV_10))
do r = 0, 199
rain(r,:,:) = IV_10(r,:,:) - IV_16(:,:)
end do
printVarSummary (rain)
std_r = dim_stddev_n(rain,0)
avg_r = dim_avg_n(rain,0)
alpha = abs(avg_r/(std_r+0.00001))
; printMinMax(alpha,0)
ff = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/landsea.nc","r")
lsdata = ff->LSMASK
lsm = landsea_mask(lsdata,lat,lon)
avg_r = mask(avg_r, lsm .eq.0 .or. lsm.eq.2, False)
alpha = mask(alpha, lsm .eq.0 .or. lsm.eq.2, False)
;;;;;;;;;;;;;;;;;;;;;;contour plot
type = "ps"
wks = gsn_open_wks(type,"T2_IV_DJF_50_vs_12_1995") ;;;no 1983 for sum, aut, win
gsn_define_colormap(wks,"ViBlGrWhYeOrRe")
res = True
pltres = True
mpres = True
mpres at mpGeophysicalLineColor = "Black"
mpres at mpNationalLineColor = "Black"
mpres at mpUSStateLineColor = "Black"
mpres at mpGridAndLimbOn = False
mpres at tiMainString = "IV 50 vs. 12"
mpres at tiMainFontHeightF = 0.015
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Plotting options for Precipitation
opts_r = res
opts_r at cnFillMode = "RasterFill"
opts_r at cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
opts_r at cnMinLevelValF = -3. ; set min contour level
opts_r at cnMaxLevelValF = 3. ; set max contour level
opts_r at cnLevelSpacingF = .3 ; set contour spacing
opts_r at cnInfoLabelOn = False
opts_r at cnConstFLabelOn = False
opts_r at cnFillOn = True
opts_r at lbLabelFont = 25
opts_r at pmLabelBarOrthogonalPosF= -0.012
contour_tot = wrf_contour(c,wks,avg_r,opts_r)
delete(opts_r)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Plotting options for Significant level
opts = res
opts at cnFillOn = False
opts at cnLinesOn = False
opts at cnLineLabelsOn = False
contour_sgl = wrf_contour(c,wks,alpha,opts)
contour_sgl = ShadeGtContour(contour_sgl,4.,17)
delete(opts)
; MAKE PLOTS
plot = wrf_map_overlays(c,wks,(/contour_tot,contour_sgl/),pltres,mpres)
end
=======================
Jiali Wang, Ph. D
Environmental Science Division
Argonne National Laboratory
Tel: 630-252-2848
http://www.evs.anl.gov/about-evs/staff/detail/index.cfm?/Wang/Jiali
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170718/70a00f5f/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alpha.ps
Type: application/postscript
Size: 759830 bytes
Desc: alpha.ps
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170718/70a00f5f/attachment-0002.ps
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plotting.ps
Type: application/postscript
Size: 1110583 bytes
Desc: plotting.ps
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170718/70a00f5f/attachment-0003.ps
More information about the ncl-talk
mailing list