<div dir="ltr"><div><div><div><div>Hi,<br><br></div>I looked at this, but can not really tell what&#39;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&#39;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">&lt;<a href="mailto:313695096@qq.com" target="_blank">313695096@qq.com</a>&gt;</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 &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl&quot;</div><div><br></div><div>load&quot;/public/home/huanglei/<wbr>map/shapefile_mask_data.ncl&quot;</div><div>begin</div><div> station_file =&quot;/public/home/huanglei/data/<wbr>20160724/stationdata_20160724.<wbr>txt&quot; </div><div> data  = asciiread(station_file,-1,&quot;<wbr>string&quot;)</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,&quot; &quot;))</div><div>  lat_station1  = stringtofloat(str_get_field(<wbr>data(0:1889),3,&quot; &quot;))</div><div>  obs_precip1 = stringtofloat(str_get_field(<wbr>data(0:1889),4,&quot; &quot;))</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          = &quot;lon&quot;</div><div>  olon@long_name  = &quot;lon&quot;</div><div>  olon@units      = &quot;degrees-east&quot;</div><div>  olon&amp;lon        = olon</div><div>  olat!0          = &quot;lat&quot;</div><div>  olat@long_name  = &quot;lat&quot;</div><div>  olat@units      = &quot;degrees_north&quot;</div><div>  olat&amp;lat        = olat</div><div>  print(&quot;......&quot;)</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 = &quot;/public/home/huanglei/map/<wbr>shaanxi_city_l.shp&quot;</div><div>  final= shapefile_mask_data(griddata,<wbr>shp_filename,True)</div><div> ; exit</div><div>  wks = gsn_open_wks (&quot;pdf&quot;,&quot;rain20160724&quot;)  </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>;&gt;----------------------------<wbr>----------------&lt;</div><div>;            set for the map </div><div>;&gt;----------------------------<wbr>----------------&lt;</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                = &quot;Explicit&quot;   </div><div>  res@tmXBValues              = (/106,107,108,109,110/) </div><div>  res@tmXBLabels              = (/&quot;106~S~o~N~E&quot;,&quot;107~S~o~N~E&quot;,<wbr>&quot;108~S~o~N~E&quot;,&quot;109~S~o~N~E&quot;,&quot;<wbr>110~S~o~N~E&quot;/)   </div><div> ; res@tmXBMinorValues         = fspan(97,109,30) </div><div> ; res@tmXBMinorOn             = True  </div><div>  </div><div>  res@tmYLMode                = &quot;Explicit&quot;    </div><div>  res@tmYLValues              = (/32,33,34,35/) </div><div>  res@tmYLLabels              = (/&quot;32~S~o~N~N&quot;,&quot;33~S~o~N~N&quot;,&quot;<wbr>34~S~o~N~N&quot;,&quot;35~S~o~N~N&quot;/)   </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         = &quot;PreDraw&quot;</div><div>  res@mpDataBaseVersion       = &quot;MediumRes&quot;</div><div>  res@mpDataSetName           = &quot;Earth..4&quot;</div><div>  res@mpAreaMaskingOn         = True</div><div>  res@mpLandFillColor         = &quot;white&quot;</div><div>  res@mpInlandWaterFillColor  = &quot;white&quot;</div><div>  res@mpOceanFillColor        = &quot;white&quot;</div><div>  res@mpOutlineBoundarySets   = &quot;NoBoundaries&quot;</div><div><br></div><div>;&gt;----------------------------<wbr>----------------&lt;</div><div>; set for the plot</div><div>;&gt;----------------------------<wbr>----------------&lt;</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 = &quot;ExplicitLevels&quot;</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         = (/&quot;White&quot;,&quot;DarkOliveGreen1&quot;, \</div><div>                                        &quot;DarkOliveGreen3&quot;,&quot;Chartreuse&quot;<wbr>, \</div><div>                                        &quot;Chartreuse3&quot;,&quot;Green&quot;,&quot;<wbr>ForestGreen&quot;, \</div><div>                                        &quot;Yellow&quot;,&quot;Orange&quot;,&quot;Red&quot;,&quot;<wbr>Violet&quot;/)</div><div>  map = gsn_csm_contour_map(wks,final,<wbr>res) </div><div><br></div><div>;&gt;----------------------------<wbr>------------------------------<wbr>--&lt;</div><div>;                      add  map</div><div>;&gt;----------------------------<wbr>------------------------------<wbr>--&lt;</div><div><br></div><div> shp_name1    = &quot;/public/home/huanglei/map/<wbr>xian.shp&quot;</div><div> shp_name2    = &quot;/public/home/huanglei/map/<wbr>shaanxi_city_l.shp&quot;</div><div>  lnres                  = True</div><div>  lnres@gsLineColor      = &quot;gray25&quot;</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>;&gt;----------------------------<wbr>------------------------------<wbr>--&lt;</div><div>  </div><div> ; station             = asciiread(&quot;/public/home/<wbr>huanglei/data/prcdata.txt&quot;,(/<wbr>160,3/),&quot;float&quot;)  </div><div>  </div><div>  res2                 = True                       </div><div>  res2@gsMarkerIndex   = 16                       </div><div>  res2@gsMarkerSizeF   = 6.               </div><div>  res2@gsMarkerColor   = &quot;Violet&quot;                   </div><div>  res2@tfPolyDrawOrder = &quot;PostDraw&quot;  </div><div>  res2@cnFillDrawOrder = &quot;PostDraw&quot;  </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:&#39;lucida Grande&#39;,Verdana,&#39;Microsoft YaHei&#39;;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>