<div dir="ltr"><div><div><div><div>Hi,<br><br></div>I looked at this, but can not really tell what's going on without knowing more about the data. There are two shapefiles, shaanxi_city_l.shp, and xian.shp. I presume one of these is used to draw the subregional boundaries in your plot (which one)? What is the other? Are these both polygonal shapefiles? Perhaps plot them in two different colors to make sure they are what you think they are?<br><br></div>Without access to the data, I'm not sure what else to suggest....<br></div>Wish I could be of more help.<br></div>Rick <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 10, 2016 at 2:54 AM, grace <span dir="ltr"><<a href="mailto:313695096@qq.com" target="_blank">313695096@qq.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi:</div><div> All,I am trying to mask data with shapefile according to the example shapefiles_14_mask.ncl on the NCL website.</div><div>B<span style="line-height:1.5">ut most data disappeared after mask.</span></div><div><span style="line-height:1.5">The right plot is the plot after mask,the left one is the original plot.</span></div><div><span style="line-height:1.5"><br></span></div><div><img src="cid:FCC3B4E7@ABD5F612.C3EBAA57.jpg" style="width:487px;min-height:195px"></div><div>This is my script:</div><div><div>; Example script to produce precip plots with satationdata,</div><div><br></div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl"</div><div><br></div><div>load"/public/home/huanglei/<wbr>map/shapefile_mask_data.ncl"</div><div>begin</div><div> station_file ="/public/home/huanglei/data/<wbr>20160724/stationdata_20160724.<wbr>txt" </div><div> data = asciiread(station_file,-1,"<wbr>string")</div><div> num_att = numAsciiCol(station_file) ;return the number of columns of the stationfile</div><div> print(num_att)</div><div><br></div><div> lon_station1 = stringtofloat(str_get_field(<wbr>data(0:1889),2," "))</div><div> lat_station1 = stringtofloat(str_get_field(<wbr>data(0:1889),3," "))</div><div> obs_precip1 = stringtofloat(str_get_field(<wbr>data(0:1889),4," "))</div><div><br></div><div><br></div><div> olon = fspan(105.5,110.9,100)</div><div> olat = fspan(31.5,35.8,100)</div><div><br></div><div> olon!0 = "lon"</div><div> olon@long_name = "lon"</div><div> olon@units = "degrees-east"</div><div> olon&lon = olon</div><div> olat!0 = "lat"</div><div> olat@long_name = "lat"</div><div> olat@units = "degrees_north"</div><div> olat&lat = olat</div><div> print("......")</div><div> obs_precip1@_FillValue = -999.000000</div><div> rscan = (/0.5,0.2,0.1/) </div><div> griddata = obj_anal_ic_deprecated(lon_<wbr>station1,lat_station1,obs_<wbr>precip1,olon,olat,rscan,False)</div><div>;;;;;;;;;;;;;;;;;;;;;;mask data with shapfile;;;;;;;;;;;;;;;;;;;</div><div> shp_filename = "/public/home/huanglei/map/<wbr>shaanxi_city_l.shp"</div><div> final= shapefile_mask_data(griddata,<wbr>shp_filename,True)</div><div> ; exit</div><div> wks = gsn_open_wks ("pdf","rain20160724") </div><div> </div><div> res = True </div><div> res@gsnMaximize = True</div><div> res@gsnDraw = False</div><div> res@gsnFrame = False</div><div><br></div><div>;>----------------------------<wbr>----------------<</div><div>; set for the map </div><div>;>----------------------------<wbr>----------------<</div><div> res@mpMinLatF = 31.5 </div><div> res@mpMaxLatF = 35.8</div><div> res@mpMinLonF = 105.5</div><div> res@mpMaxLonF = 110.9</div><div> res@tmXBMode = "Explicit" </div><div> res@tmXBValues = (/106,107,108,109,110/) </div><div> res@tmXBLabels = (/"106~S~o~N~E","107~S~o~N~E",<wbr>"108~S~o~N~E","109~S~o~N~E","<wbr>110~S~o~N~E"/) </div><div> ; res@tmXBMinorValues = fspan(97,109,30) </div><div> ; res@tmXBMinorOn = True </div><div> </div><div> res@tmYLMode = "Explicit" </div><div> res@tmYLValues = (/32,33,34,35/) </div><div> res@tmYLLabels = (/"32~S~o~N~N","33~S~o~N~N","<wbr>34~S~o~N~N","35~S~o~N~N"/) </div><div> ;res@tmYLMinorValues = fspan(26,36,20) </div><div> ;res@tmYLMinorOn = True </div><div><br></div><div> res@mpFillOn = True</div><div> res@mpOutlineOn = False </div><div> res@cnFillDrawOrder = "PreDraw"</div><div> res@mpDataBaseVersion = "MediumRes"</div><div> res@mpDataSetName = "Earth..4"</div><div> res@mpAreaMaskingOn = True</div><div> res@mpLandFillColor = "white"</div><div> res@mpInlandWaterFillColor = "white"</div><div> res@mpOceanFillColor = "white"</div><div> res@mpOutlineBoundarySets = "NoBoundaries"</div><div><br></div><div>;>----------------------------<wbr>----------------<</div><div>; set for the plot</div><div>;>----------------------------<wbr>----------------<</div><div><br></div><div> res@cnFillOn = True </div><div> res@cnLinesOn = False </div><div> ; res@cnLevelSpacingF = 0.2 </div><div> res@gsnSpreadColors = True </div><div> res@lbLabelAutoStride = True</div><div> res@gsnAddCyclic = False </div><div> </div><div> res@cnLevelSelectionMode = "ExplicitLevels"</div><div> res@cnLevels = (/ .1, .4, .8, 1.6, 3.2, 6.4, \</div><div> 12.8, 25.6, 51.2,100/)</div><div> res@cnFillColors = (/"White","DarkOliveGreen1", \</div><div> "DarkOliveGreen3","Chartreuse"<wbr>, \</div><div> "Chartreuse3","Green","<wbr>ForestGreen", \</div><div> "Yellow","Orange","Red","<wbr>Violet"/)</div><div> map = gsn_csm_contour_map(wks,final,<wbr>res) </div><div><br></div><div>;>----------------------------<wbr>------------------------------<wbr>--<</div><div>; add map</div><div>;>----------------------------<wbr>------------------------------<wbr>--<</div><div><br></div><div> shp_name1 = "/public/home/huanglei/map/<wbr>xian.shp"</div><div> shp_name2 = "/public/home/huanglei/map/<wbr>shaanxi_city_l.shp"</div><div> lnres = True</div><div> lnres@gsLineColor = "gray25"</div><div> lnres@gsLineThicknessF = 1.5 </div><div><br></div><div> id = gsn_add_shapefile_polylines(<wbr>wks,map,shp_name1,lnres)</div><div> id2= gsn_add_shapefile_polylines(<wbr>wks,map,shp_name2,lnres)</div><div>;>----------------------------<wbr>------------------------------<wbr>--<</div><div> </div><div> ; station = asciiread("/public/home/<wbr>huanglei/data/prcdata.txt",(/<wbr>160,3/),"float") </div><div> </div><div> res2 = True </div><div> res2@gsMarkerIndex = 16 </div><div> res2@gsMarkerSizeF = 6. </div><div> res2@gsMarkerColor = "Violet" </div><div> res2@tfPolyDrawOrder = "PostDraw" </div><div> res2@cnFillDrawOrder = "PostDraw" </div><div> ;</div><div> plots1=gsn_add_polymarker(<wbr>wks,map,108.9373,34.2158,res2)</div><div> plots2=gsn_add_polymarker(<wbr>wks,map,108.9133,34.2303,res2)</div><div> plots3=gsn_add_polymarker(<wbr>wks,map,108.8908,34.1953,res2)</div><div><br></div><div> ; plots=gsn_add_polymarker(wks,<wbr>map,station(:,1),station(:,2),<wbr>res2)</div><div> delete(res2) </div><div> draw(map)</div><div> frame(wks)</div><div> end </div></div><div><span style="font-family:'lucida Grande',Verdana,'Microsoft YaHei';line-height:23.8px"> How can I slove the problem?</span></div><div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>