<div dir="ltr"><div class="gmail_default" style="font-size:small">I think these are map outlines that you see. Try setting:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">res@mpOutlineOn = False</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"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 26, 2015 at 9:21 AM, <a href="mailto:dyjbean@163.com">dyjbean@163.com</a> <span dir="ltr"><<a href="mailto:dyjbean@163.com" target="_blank">dyjbean@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
<table width="99.99%" height="100%" style="padding:10px;background-color:transparent" border="0" cellpadding="0" cellspacing="0" background="cid:_Foxmail.1@18b36621-24fd-776e-b2b0-bef5be473df6">
<tbody><tr>
<td valign="top" style="width:100%;height:100%;line-height:160%;font-size:10.5pt">
<div>
<div><span></span>hi,</div><div> i made a plot with shapefile , but there exist some extra lines in figure, as follows:</div><div> <img src="cid:_Foxmail.1@e156f4a0-fd5a-e6ea-ccb7-7cfeac5ba16b" border="0" style="font-size:10.5pt;line-height:160%;background-color:transparent"></div>
<div><br></div><div> there some extra lines on figure above. how can i get rid of them?</div><div><br></div><div><br></div><div>the following is my script:</div><div>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</div><div><span style="color:rgb(0,0,0);background-color:rgba(0,0,0,0)">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<br>load "./shapefile_mask_data.ncl"<br><br>begin<br>;forgname="../../globecover_hubei_liuhuan_usgs_ronghe_snow-ice1.txt"<br>forgname="beijing_globecover_liuhuan30_usgs_changed.txt"<br>;fconname="../../globecover_huabei_liuhuan_usgs_new_allocate1.txt"<br>fconname="beijing_globecover_liuhuan30_usgs_changed_lir-mir-hir.txt"<br><br>onlat=5403<br>omlon=5403<br><br>nnlat=1801<br>nmlon=1801<br><br>odat=new((/onlat,omlon/),"integer","No_FillValue")<br>ndat=new((/nnlat,nmlon/),"integer","No_FillValue")<br><br>odat=readAsciiTable(forgname,omlon,"integer",5)<br>ndat=asciiread(fconname,(/nnlat,nmlon/),"integer")<br>delete(odat@_FillValue)<br>delete(ndat@_FillValue)<br><br>;; confused lc<br>olat=new((/onlat/),"float","No_FillValue")<br>olon=new((/omlon/),"float","No_FillValue")<br><br>do i=0,onlat-1<br> olat(i)=45.00413067-i*0.0027778<br>end do<br><br><br>do j=0,omlon-1<br> olon(j)=109.99606533+j*0.0027778<br>end do<br><br>olat!0="lat"<br>olat@units="degrees_north"<br>olat@long_name="latitude"<br><br>olon!0="lon"<br>olon@units="degrees_east"<br>olon@long_name="longitude"<br><br>odat!0="lat"<br>odat!1="lon"<br>odat&lat=olat<br>odat&lon=olon<br>odat@units=""<br>odat@long_name="land cover confused with globaland30 and globercover"<br><br>;; new classified lc<br>nlat=new((/nnlat/),"float","No_FillValue")<br>nlon=new((/nmlon/),"float","No_FillValue")<br><br>do i=0,nnlat-1<br> nlat(i)=45.00413067-i*0.0083334<br>end do<br><br><br>do j=0,nmlon-1<br> nlon(j)=109.99606533+j*0.0083334<br>end do<br><br>nlat!0="lat"<br>nlat@units="degrees_north"<br>nlat@long_name="latitude"<br><br>nlon!0="lon"<br>nlon@units="degrees_east"<br>nlon@long_name="longitude"<br><br>ndat!0="lat"<br>ndat!1="lon"<br>ndat&lat=nlat<br>ndat&lon=nlon<br>ndat@units=""<br>ndat@long_name="land cover new categories after confused"<br><br>;<br>; If you already have the mask NetCDF file, set this to False.<br>; Creating the mask can be slow!<br>;<br> CREATE_MASK = True<br><br>;---Whether to draw lat/lon points and shapefile outlines<br> ADD_LATLON_POINTS = False<br> ADD_SHAPEFILE_OUTLINES = True<br><br>;---Name of shapefile containing USA outlines<br> shp_fname = "jingjinji.shp"<br><br>;---Name of file to write mask to or to read mask from.<br> mask_oname = "<a href="http://jingjinji_mask_300m.nc" target="_blank">jingjinji_mask_300m.nc</a>"<br> mask_nname = "<a href="http://jingjinji_mask_1km.nc" target="_blank">jingjinji_mask_1km.nc</a>"<br><br>;---Rough area we are interested in. Everything outside this will be masked.<br> minlon = 113.<br> maxlon = 120.<br> minlat = 36.0<br> maxlat = 43.0<br><br>;; odat<br>if(CREATE_MASK) then<br> print("Creating the mask file...")<br><br>;---Create a new mask using a shapefile of USA<br> odims = dimsizes(odat)<br> opto = True<br> opto@return_mask = True<br>; opto@debug = True<br> opto@minlon = minlon ; Makes the shapefile masking<br> opto@maxlon = maxlon ; go faster.<br> opto@minlat = minlat<br> opto@maxlat = maxlat<br> odat_mask = shapefile_mask_data(odat,shp_fname,opto)<br><br>;---Write new mask to file<br> system("rm -f " + mask_oname)<br> oout = addfile(mask_oname,"c")<br> oout->odat_mask = odat_mask<br> else<br> print("Reading mask off file.")<br><br>;---Read the new mask from the NetCDF file<br> omask = addfile(mask_oname,"r")<br> odat_mask = omask->odat_mask<br> end if<br><br>;; ndat<br>if(CREATE_MASK) then<br> print("Creating the mask file...")<br><br>;---Create a new mask using a shapefile of USA<br> ndims = dimsizes(ndat)<br> optn = True<br> optn@return_mask = True<br>; optn@debug = True<br> optn@minlon = minlon ; Makes the shapefile masking<br> optn@maxlon = maxlon ; go faster.<br> optn@minlat = minlat<br> optn@maxlat = maxlat<br> ndat_mask = shapefile_mask_data(ndat,shp_fname,optn)<br><br>;---Write new mask to file<br> system("rm -f " + mask_nname)<br> nout = addfile(mask_nname,"c")<br> nout->ndat_mask = ndat_mask<br> else<br> print("Reading mask off file.")<br><br>;---Read the new mask from the NetCDF file<br> nmask = addfile(mask_nname,"r")<br> ndat_mask = nmask->ndat_mask<br> end if<br><br>;---Create masked data array<br> omask = where(odat_mask.eq.1,odat,odat@_FillValue)<br> copy_VarMeta(odat,omask)<br><br>;---Create masked data array<br> nmask = where(ndat_mask.eq.1,ndat,ndat@_FillValue)<br> copy_VarMeta(ndat,nmask)<br><br><br>print(odat(onlat-1,omlon-1))<br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>;; create plot<br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>plot=new(2,"graphic")<br>info=(/ \<br> "1 urban_and_built-in" ,\<br> "2 dryland_cropland" ,\<br> "3 irrigated_cropland" ,\<br> "4 mixed_dry_cropland" ,\<br> "5 cropland_grassland" ,\<br> "6 cropland_woodland" ,\<br> "7 grassland" ,\<br> "8 shrubland" ,\<br> "9 mixed_shrub_grassland",\<br> "10 savanna" ,\<br> "11 deciduous_broadleaf" ,\<br> "12 deciduous_needleleaf" ,\<br> "13 evergreen_broadleaf" ,\<br> "14 evergreen_needleleaf" ,\<br> "15 mixed_forest" ,\<br> "16 water" ,\<br> "17 herbaceous_wetland" ,\<br> "18 wooded_wetland" ,\<br> "19 barren_or_sparse" ,\<br> "31 low_intensity_res" ,\<br> "32 mid_intensity_res" ,\<br> "33 high_intensity_res"/)<br><br>ninfo=dimsizes(info)<br><br> ninfo = dimsizes(info) ; # of classifications<br><br><br>;************************************************<br>; create plot<br>;************************************************<br> pltType = "png" ; ps, pdf, png, x11, eps<br><br><br><br> colorscheme =(/"red","SpringGreen2","SpringGreen3","springgreen",\<br> "limegreen","darkolivegreen3","green","lightsalmon","green3",\<br> "LightSeaGreen","palegreen","olivedrab3","chartreuse2","chartreuse3", \<br> "darkgreen","blue","hotpink2","hotpink","light cyan", \<br> "khaki1","violetred1","purple3"/)<br><br> ncolors = dimsizes(colorscheme)<br> if (ninfo.ne.ncolors) then ; make sure # of colors match categories (classes)<br> print("size mismatch: ninfo="+ninfo+" ncolors="+ncolors)<br> exit<br> end if<br><br> wks = gsn_open_wks(pltType,"plot_lc_jingjinji_new")<br> plot=new(2,graphic)<br> res = True ; plot mods desired<br> res@gsnDraw = False<br> res@gsnFrame = False<br> ;res@gsnMaximize = True ; ps, pdf<br> res@gsnAddCyclic = False<br><br> ;res@mpMinLatF = min(odat&lat)<br> ;res@mpMaxLatF = max(odat&lat)<br> ;res@mpMinLonF = min(odat&lon)<br> ;res@mpMaxLonF = max(odat&lon)<br><br> res@cnFillOn = True ; color Fill<br> res@cnFillMode = "RasterFill"<br> res@cnLinesOn = False ; Turn off contour lines<br> res@cnLineLabelsOn = False<br> res@cnLevelSelectionMode = "ExplicitLevels" ; set explict contour levels<br> res@cnLevels = tobyte((/2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,31,32,33/)) ; tobyte(ispan(1,ninfo-1,1)+1)<br> res@cnFillPalette = colorscheme ; distinct colors for categories<br> res@gsnSpreadColors = False ; use each color sequentially<br> res@cnInfoLabelOn = False<br><br> ;res@lbLabelPosition = "Center" ; label position<br> ;res@lbLabelAlignment = "BoxCenters" ; label orientation<br> ;res@lbLabelStrings = (/"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16",\<br> ;"17","18","19","31","32","33"/)<br> ;res@lbLabelStrings = ispan(0,ninfo,1)<br> ;res@lbLabelStride = 1<br> ;res@lbLabelAutoStride = False ; in V6.1.0 and up, this is defaulted<br> ; to True, and overrides lbLabelStride<br> ; default. Set this to ensure that<br> ; your label scheme is preserved.<br> ;res@pmLabelBarHeightF = 0.075<br> ;res@pmLabelBarWidthF = 0.60 ; default is 0.6<br> ;res@pmLabelBarOrthogonalPosF = 0.08 ; move up smidge<br><br> res@mpFillOn = False<br><br> ;res@mpGridAndLimbOn = True<br> ;res@mpGridLatSpacingF = 5.0<br> ;res@mpGridLonSpacingF = 5.0<br> ;res@mpGridLineDashPattern = "2"<br><br> res@gsnAddCyclic = False ; regional data<br> ;res@trGridType = "TriangularMesh"<br> res@tmXBLabelFontHeightF = 0.01 ; Make lon & lat text smaller<br> res@tmYLLabelFontHeightF = res@tmXBLabelFontHeightF<br><br> res@gsnLeftString = ""<br> res@gsnRightString = ""<br><br> res1 = True<br> res1 = res<br> res1@mpMinLatF = minlat<br> res1@mpMaxLatF = maxlat<br> res1@mpMinLonF = minlon<br> res1@mpMaxLonF = maxlon<br><br> res1@tmXBMode = "Explicit"<br> res1@tmXBValues = (/113.0,114.0,115.0,116.0,117.0,118.0,119.0,120.0/)<br> res1@tmXBLabels = (/"113.0~S~o~N~E","114.0~S~o~N~E","115.0~S~o~N~E","116.0~S~o~N~E","117.0~S~o~N~E",\<br> "118.0~S~o~N~E","119.0~S~o~N~E","120.~S~o~N~E"/)<br><br><br> res1@tmYLMode = "Explicit"<br> res1@tmYLValues = (/36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0/)<br> res1@tmYLLabels = (/"36.0~S~o~N~N","37.0~S~o~N~N","38.0~S~o~N~N","39.0~S~o~N~N","40.0~S~o~N~N",\<br> "41.0~S~o~N~N","42.0~S~o~N~N","43.0~S~o~N~N"/)<br><br> res1@tiMainString = "confused LC"<br> res1@lbLabelBarOn = False<br> plot(0) = gsn_csm_contour_map_ce(wks, omask, res1) ; create plot<br><br> res2 = True<br> res2=res<br> res2@mpMinLatF = minlat<br> res2@mpMaxLatF = maxlat<br> res2@mpMinLonF = minlon<br> res2@mpMaxLonF = maxlon<br><br> res2@tmXBMode = "Explicit"<br> res2@tmXBValues = (/113.0,114.0,115.0,116.0,117.0,118.0,119.0,120.0/)<br> res2@tmXBLabels = (/"113.0~S~o~N~E","114.0~S~o~N~E","115.0~S~o~N~E","116.0~S~o~N~E","117.0~S~o~N~E",\<br> "118.0~S~o~N~E","119.0~S~o~N~E","120.~S~o~N~E"/)<br><br> res2@tmYLMode = "Explicit"<br> res2@tmYLValues = (/36.0,37.0,38.0,39.0,40.0,41.0,42.0,43.0/)<br> res2@tmYLLabels = (/"36.0~S~o~N~N","37.0~S~o~N~N","38.0~S~o~N~N","39.0~S~o~N~N","40.0~S~o~N~N",\<br> "41.0~S~o~N~N","42.0~S~o~N~N","43.0~S~o~N~N"/)<br><br> res2@lbLabelBarOn = False<br> res2@tiMainString = "reclassified LC"<br> plot(1) = gsn_csm_contour_map_ce(wks,nmask,res2)<br><br> pres = True<br> pres@gsnFrame = False<br> pres@gsnPanelLabelBar = True<br> pres@lbLabelFontHeightF = 0.01<br> ;pres@gsnPanelBottom = 0.015<br> pres@lbLabelPosition = "Center" ; label position<br> pres@lbLabelAlignment = "BoxCenters" ; label orientation<br> pres@lbLabelStrings = (/"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16",\<br> "17","18","19","31","32","33"/)<br> ;pres@lbLabelStrings = ispan(0,ninfo,1)<br> pres@lbLabelStride = 1<br> pres@lbLabelAutoStride = False<br><br> gsn_panel(wks,plot,(/1,2/),pres)<br><br> rtxt = True<br> rtxt@txJust = "TopLeft"<br> rtxt@txFontHeightF = 0.0125<br><br> ; Add text: rows x columns of text (arbitrary)<br>; Usually must play with xx, yy and txFontHeightF<br><br> nrow = 5 ; # rows<br> ncol = 6 ; # columns<br><br> n = -1<br> xx = 0.015 ; arbitrary<br> do nc=0,ncol-1<br> yy = 0.20<br> do nr=0,nrow-1<br> n = n+1<br> if (n.le.(ninfo-1)) then<br> gsn_text_ndc (wks,info(n),xx,yy,rtxt)<br> yy = yy - 2*rtxt@txFontHeightF<br> end if<br> end do<br> xx = xx + 0.20<br> end do<br><br> ;draw(plot)<br> frame(wks)<br><br>end<br></span></div><div>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</div><div><br></div><div>what kind of properties should i add in the script? </div><div>or something is wrong with the shapefile?</div><div><br></div><div><br></div><div>thanks for your advices</div><div><br></div><div><br></div><div><br></div><hr style="width:210px;min-height:1px" color="#b5c4df" size="1" align="left"><span class="HOEnZb"><font color="#888888">
<div><span><div style="MARGIN:10px;FONT-FAMILY:verdana;FONT-SIZE:10pt"><div><a href="mailto:dyjbean@163.com" target="_blank">dyjbean@163.com</a></div></div></span></div>
<div></div></font></span></div>
</td>
</tr>
</tbody></table>
</div><br>_______________________________________________<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/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>