[ncl-talk] Adding a marker on a contouring map
G.Monte at isac.cnr.it
G.Monte at isac.cnr.it
Wed Jun 20 08:21:21 MDT 2018
> What you did was right and I cannot see any obvious errors in your code.
> Usually if you get no errors it's because the marker get placed but
> somewhere where you don't expect, or maybe the marker size is too small,
> but that's not your case, 5 should be big enough.
>
> Can you share a minimal working version of your script and data?
> You could also try to change the bounds of your map projection to include
> all the globe and see where your marker is wandering around :-)
>
I changed the bounds to include all the globe and fixed two pairs of
latitude-longitude, but the markers didn't appear anywhere. I'm working
with GPM-DPR data of radar reflecitivity (h5); here are some code lines
relative to the graphics part, both for plotting the contour map and for
adding the markers:
begin
......
wks =
gsn_open_wks("png","./radar_reflectivity/near_surface/corrected_zfactor_map_marker")
res = True
res at gsnAddCyclic = False
res at gsnMaximize = True
res at cnFillOn = True
res at cnFillMode = "RasterFill"
res at cnFillPalette = "BlueWhiteOrangeRed"
res at cnLinesOn = False
res at cnLineLabelsOn = False
res at mpFillOn = True
res at cnLevelSelectionMode = "ManualLevels"
res at cnMinLevelValF = min(z)
res at cnMaxLevelValF = max(z)
res at cnLevelSpacingF = 1.
res at cnMissingValFillColor = "transparent"
;-----------------------------------------------------------
; plot sub area; for faster plot only use desired sub-region
;-----------------------------------------------------------
minLat = -66
maxLat = 66
minLon = -180
maxLon = 180
res at mpMinLatF = minLat
res at mpMaxLatF = maxLat
res at mpMinLonF = minLon
res at mpMaxLonF = maxLon
;----------------------------------------------------
; extract indices of desired sub-region
;----------------------------------------------------
ji = region_ind(latitude,longitude, minLat, maxLat, minLon, maxLon)
jStrt = ji(0) ; scan start
jLast = ji(1) ; scan last
iStrt = ji(2) ; ray start
iLast = ji(3) ; ray last
Z_region = z(jStrt:jLast,iStrt:iLast) ; [nscan x nray]
Z_region at lat2d = latitude(jStrt:jLast,iStrt:iLast)
Z_region at lon2d = longitude(jStrt:jLast,iStrt:iLast)
plot = gsn_csm_contour_map(wks,Z_region,res)
polyres = True
polyres at gsMarkerIndex = 16
polyres at gsMarkerSizeF = 10.
polyres at gsFillColor = "black"
polyres at tfPolyDrawOrder = "Draw"
lat = (/45.43, 5./)
lon = (/12.12, 5./)
dum = gsn_add_polymarker(wks,plot,lon,lat,polyres)
draw(plot)
end
Giulio Monte
> Il mer 20 giu 2018, 11:54 <G.Monte at isac.cnr.it> ha scritto:
>
>> Dear all,
>> I would like to add a marker for a given latitude-longitude
>> (45.43°N,12.12°E) on a contouring map in NCL 6.4.0. For the plot, I used
>> gsn_csm_contour_map function and I need only a single marker to add in.
>> I
>> tried the following commands:
>>
>> polyres = True
>> polyres at gsMarkerIndex = 16
>> polyres at gsMarkerSizeF = 5.
>> plot = gsn_csm_contour_map(wks,Z_region,res)
>> dum = gsn_add_polymarker(wks,plot,12.12,45.43,polyres)
>> draw(plot)
>>
>> and no error messages appeared, but marker was not added on the map
>> anyway.
>> I do not understand the reason; maybe, I think that gsn_add_polymarker
>> function would be suited only for several markers. Are there existing
>> other functions to add a single marker on a NCL contouring map?
>>
>> Thanks,
>> Giulio Monte
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
More information about the ncl-talk
mailing list