[ncl-talk] map question

lzl lai leslie.linglai at gmail.com
Mon Oct 16 09:33:26 MDT 2023


I have a problem deleting those thin lines in my map (the red arrow pointed
area)
. Could you please help me to remove them? 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
and also set res at cnMissingValPerimOn = False

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"
;----plot-----------------------------------------------------
  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 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


 res at cnLevelSelectionMode = "ManualLevels"
  res at cnMinLevelValF       = 100.
  res at cnMaxLevelValF       = 3600.
  res at cnLevelSpacingF      = 200.
  res at cnMissingValPerimOn = False
  res at cnMissingValPerimGridBoundOn =False
  res at gsnAddCyclic         = False           ; don't add longitude cyclic
point

;---color bar----
  res at lbAutoManage          = False             ; we control label bar
  res at pmLabelBarDisplayMode = "Always"          ; turns on label bar
  res at lbOrientation         = "Horizontal"      ; ncl default is vertical
  res at pmLabelBarSide        = "Bottom"          ; default is right
  res at lbLabelStride         = 1                 ; skip every other label
  res at pmLabelBarWidthF      = 0.5               ; default is shorter
  res at pmLabelBarHeightF     = 0.1               ; default is taller
  res at lbLabelFontHeightF    = .018              ; default is HUGE
  res at lbPerimOn             = False             ; default has box
  res at lbBoxLinesOn       =   True  ; turn on labelbar box lines
  res at lbBoxEndCapStyle = "TriangleBothEnds"

;---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 mpFillOn             = True
  res at mpGeophysicalLineColor      = "transparent"       ; color of cont.
outlines
  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 = 2.0
  dum  = gsn_add_shapefile_polylines(wks,plot,shpdir+filename,lnres)
;---Generate random lat/lon locations and dummy text strings
  lont  = (/121.513,120.684,120.197,120.746,121.613,121.154/)
  latt  = (/25.049,24.12,23.07,22.013,24.05,22.765/)
  lons  = (/121.513,120.684,120.197,120.746,121.613,121.154/)
  lats  = (/25.037,24.145,22.995,22.003,23.975,22.752/)
  text  = (/"Taipei","Taichung","Tainan","Hengchun","Hualian","Taitung"/)


;---Attach some dummy text strings
  txres               = True
  txres at txFontHeightF = 0.02
  txres at txJust        = "BottomCenter"

  text_id = gsn_add_text(wks,plot,text,lont,latt,txres)
;
  mkres               = True
  mkres at gsMarkerIndex = 16     ; Filled circle
  mkres at gsMarkerSizeF = 0.01

  locations = gsn_add_polymarker(wks,plot,lons,lats,mkres)
;====================================================
  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/20231016/5eda036f/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testmap.docx
Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Size: 125523 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20231016/5eda036f/attachment-0001.docx>


More information about the ncl-talk mailing list