<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Rick has some good suggestions about checking your shapefile and that it must be polygonal.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">To check if you have a polygon-based shapefile, you can type this on the UNIX command line:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">ncl_filedump /public/home/huanglei/map/</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">shaanxi_city_l.shp | grep </span>geometry_type<br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">and it should come back with:</div><div class="gmail_default" style="font-size:small">







<p class=""><span class="">      geometry_type : polygon</span></p></div><div class="gmail_default" style="font-size:small">Finally, to further debug this program, you can turn on an unadvertised &quot;debug&quot; feature. You need to call shapefile_mask_data with:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div style="color:rgb(80,0,80)">  opt = True</div><div style="color:rgb(80,0,80)">  opt@debug = True</div><div style="color:rgb(80,0,80)">  final= shapefile_mask_data(griddata,s<wbr>hp_filename,opt)</div><div><br></div></div><div class="gmail_extra"><div class="gmail_default" style="font-size:small">​If you could provide us with the output from the &quot;debug&quot; results, that might help.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small">​</div><br><div class="gmail_quote">On Wed, Aug 10, 2016 at 10:02 PM, Rick Brownrigg <span dir="ltr">&lt;<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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"><div><div class="h5">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></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="h5"><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/nclscri<wbr>pts/csm/gsn_code.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_csm.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl&quot;</div><div><br></div><div>load&quot;/public/home/huanglei/map<wbr>/shapefile_mask_data.ncl&quot;</div><div>begin</div><div> station_file =&quot;/public/home/huanglei/data/2<wbr>0160724/stationdata_20160724.t<wbr>xt&quot; </div><div> data  = asciiread(station_file,-1,&quot;str<wbr>ing&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(da<wbr>ta(0:1889),2,&quot; &quot;))</div><div>  lat_station1  = stringtofloat(str_get_field(da<wbr>ta(0:1889),3,&quot; &quot;))</div><div>  obs_precip1 = stringtofloat(str_get_field(da<wbr>ta(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_sta<wbr>tion1,lat_station1,obs_precip1<wbr>,olon,olat,rscan,False)</div><div>;;;;;;;;;;;;;;;;;;;;;;mask data with shapfile;;;;;;;;;;;;;;;;;;;</div><div>  shp_filename = &quot;/public/home/huanglei/map/sha<wbr>anxi_city_l.shp&quot;</div><div>  final= shapefile_mask_data(griddata,s<wbr>hp_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;1<wbr>10~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;3<wbr>4~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;ForestG<wbr>reen&quot;, \</div><div>                                        &quot;Yellow&quot;,&quot;Orange&quot;,&quot;Red&quot;,&quot;Viole<wbr>t&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/xia<wbr>n.shp&quot;</div><div> shp_name2    = &quot;/public/home/huanglei/map/sha<wbr>anxi_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(wk<wbr>s,map,shp_name1,lnres)</div><div> id2= gsn_add_shapefile_polylines(wk<wbr>s,map,shp_name2,lnres)</div><div>;&gt;----------------------------<wbr>------------------------------<wbr>--&lt;</div><div>  </div><div> ; station             = asciiread(&quot;/public/home/huangl<wbr>ei/data/prcdata.txt&quot;,(/160,3/)<wbr>,&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(wks<wbr>,map,108.9373,34.2158,res2)</div><div> plots2=gsn_add_polymarker(wks<wbr>,map,108.9133,34.2303,res2)</div><div> plots3=gsn_add_polymarker(wks<wbr>,map,108.8908,34.1953,res2)</div><div><br></div><div> ; plots=gsn_add_polymarker(wks,m<wbr>ap,station(:,1),station(:,2),r<wbr>es2)</div><div>   delete(res2)  </div><div>  draw(map)</div><div>  frame(wks)</div><div>  end </div></div><div><span style="font-family:&quot;lucida Grande&quot;,Verdana,&quot;Microsoft YaHei&quot;;line-height:23.8px"> How can I slove the problem?</span></div><div></div><br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></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></div>