;---------------------------------------------------------------------- ; Function to create and draw map of Australia. ; If mode = "create", then only create the map, ; don't draw it and advance the frame. ;---------------------------------------------------------------------- function Australia_map(wks,mode:string) local res begin res = True ; Set up resource list if(mode.eq."create") then res@gsnFrame = False res@gsnDraw = False end if res@gsnMaximize = True ; Maximize plot in frame res@mpFillOn = False ; Outlines will be turned on ; internally res@mpDataBaseVersion = "MediumRes" ; Medium resolution res@mpDataSetName = "Earth..4" ; Contains divisions for ; other countries. res@mpOutlineBoundarySets = "AllBoundaries" res@mpLimitMode = "LatLon" res@mpMinLatF = -45 ; Zoom in on Australia res@mpMaxLatF = -10 res@mpMinLonF = 112 res@mpMaxLonF = 155 res@tiMainString = "Adding purple markers and city names" map = gsn_csm_map(wks,res) ; Create or draw default map return(map) end ;--Main code begin wks = gsn_open_wks("png","poly3f") ; Open png file ;---Create the map so we can add lines, strings, and markers. map = Australia_map(wks,"create") ;---Create arrays with cities and lat/lon locations cities = (/"Darwin", "Perth", "Alice Springs", "Melbourne", "Sydney"/) lat = (/ -12.46, -31.95, -23.70, -37.81, -33.86/) lon = (/ 130.84, 115.86, 133.88, 144.96, 151.21/) ;---Attach markers to map. mres = True mres@gsMarkerSizeF = 10. ; Make it larger mres@gsMarkerIndex = 16 ; Filled dot mres@gsMarkerColor = "purple" dum1 = gsn_add_polymarker(wks,map,lon,lat,mres) ;---Attach text to map. tres = True tres@txFontHeightF = 0.015 ; Default is large tres@txJust = "CenterLeft" ; default is "CenterCenter" dum2 = gsn_add_text(wks,map,cities,lon+0.5,lat,tres) draw(map) ; Drawing the map draws the markers. frame(wks) end