[ncl-talk] Question about map and shapfile

lzl lai leslie.linglai at gmail.com
Sun Oct 15 04:19:06 MDT 2023


Hi

I have a problem for deleting those thin lines (the red arrow pointed area)
. Could you please help me to remove it? Thanks a lot!

I use "ETOPO_2022_v1_60s_N90W180_bed.nc"  ,for drawing topography,
  and "gadm41_TWN_0.shp" , for drawing coastline in Taiwan


my scrip is below :
========================================
;---Read data
;  topo_file = "../topo/ETOPO_2022_v1_60s_N90W180_geoid.nc"
  topo_file = "../topo/ETOPO_2022_v1_60s_N90W180_bed.nc"
  f  = addfile(topo_file,"r")
  elev  = f->z
;
; Set all values below -100 to missing, hence removing all
; the ocean elevation values. The ocean will be filled in
; a light blue (see mpOceanFillColor below).
;
  elev = where(elev.lt.-100.,elev at _FillValue,elev)

;;file --- 2
  shpdir = "/home/lzl/data2/lzl/CWBtrend/topo/TW/"
  filename ="gadm41_TWN_0.shp"

  wks = gsn_open_wks("pdf","./pic/TW_topo")           ; send graphics to
PNG file
  gsn_define_colormap(wks,"WhiteBlueGreenYellowRed")

  res                    = True
  res at gsnMaximize        = True     ; maximize plot in frame

  res at cnFillOn           = True     ; turn on contour fill
;  res at cnFillPalette      = cmap(2:,:) ; set color map
  res at cnLinesOn          = False    ; turn off contour lines
  res at cnLineLabelsOn     = False    ; turn off line labels
  res at cnInfoLabelOn      = False    ; turn off info label
  res at lbBoxLinesOn       = False    ; turn off labelbar box lines

  res at cnFillMode         = "MeshFill"   ; for faster draw

;---Pick "nice" contour levels
;  mnmxint = nice_mnmxintvl( min(elev), max(elev), 18, False)
  mnmxint = nice_mnmxintvl( min(elev), max(elev), 5, False)

 printVarSummary(mnmxint)
 print(mnmxint(1))
 print(mnmxint(2))
  res at cnLevelSelectionMode = "ManualLevels"
  res at cnMinLevelValF       = 100.
  res at cnMaxLevelValF       = mnmxint(1)
  res at cnLevelSpacingF      = mnmxint(2)/20.   ; Increase the number of
levels
                                             ; by choosing a smaller
spacing.
                                             ;higher number mean higher
resol

  res at gsnAddCyclic         = False           ; don't add longitude cyclic
point

;---Zoom in on map
  res at mpLimitMode           = "LatLon"
  res at mpMinLatF            = 21.5
  res at mpMaxLatF            = 25.5
  res at mpMinLonF            = 119.5
  res at mpMaxLonF            = 122.5
;  res at mpCenterLonF         = (res at mpMinLonF + res at mpMaxLonF) / 2.

  res at mpFillOn             = True

  res at mpInlandWaterFillColor="Background"
  res at mpOceanFillColor     = "transparent"
  res at mpLandFillColor      = "transparent"

  res at mpFillDrawOrder      = "PostDraw"
  res at mpDataBaseVersion = "MediumRes"
  res at mpOutlineOn           = False
  res at pmTickMarkDisplayMode       = "Always"
  res at mpGeophysicalLineThicknessF = 2
  plot = gsn_csm_contour_map(wks,elev,res)

  nres                  = True
  lnres at gsLineColor = "black"
  lnres at gsLineThicknessF = 3.0
  dum  = gsn_add_shapefile_polylines(wks,plot,shpdir+filename,lnres)

  draw(plot)   ; This will draw the map and the shapefile outlines.
  frame(wks)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20231015/7c412a5e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Q.docx
Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Size: 111995 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20231015/7c412a5e/attachment.docx>


More information about the ncl-talk mailing list