[ncl-talk] Text label on map projection

Rick Brownrigg brownrig at ucar.edu
Tue Nov 11 14:12:15 MST 2014


Hi,

I'm guessing you need to add these resources:

 res at gsnFrame = False ; don't advance frame yet
 res at gsnDraw = False ;

and then after your call to gsn_add_text(), issue these commands:

 draw(plot)
 frame(wks)

The docs on gsn_add_text() state that the text is not drawn until the
associated plot is drawn, but with these resources, that plot gets drawn
immediately in the call to gsn_csm_contour_map_ce()

Hope  that helps...

On Tue, Nov 11, 2014 at 1:51 PM, David Adams <dave.k.adams at gmail.com> wrote:

> Hi NCLers,
> I need to add simple text to GOES image, but the text doesn´t appear.
> It might be due to the funky 2d lat,lon coordinates of GOES images.  Any
> suggestions?
>
> thanks,
> Dave
>
> ---------Code--------------------------------------------
>    diri = "./"
>   file_name = asciiread("file_name",-1,"string")
>   fili ="goes13_4_2013_196_2315_subset.nc"
>    f    = addfile(diri+fili,"r")
>    new_temp    = f->new_temp          ; float data(time, yc, xc) ;
>                            ; data:type = "IR" ;
> ;*********************************
> ; Fix the variable so it has recognizable missing data
> ;*********************************
>    lat  = f->new_lat
>    lon  = f->new_lon
>    lat at _FillValue = max(lat)
>    lon at _FillValue = lat at _FillValue
>    new_temp at _FillValue   = 255.
>                            ; associate coordinates with variable
>    new_temp at lat2d = lat           ; (yc, xc)
>    new_temp at lon2d = lon
>
>
> ;*********************************
> ; create plot
> ;*********************************
>    sfx     = get_file_suffix(fili,0)           ; use file name
>
> ;  write output file name using first time record of file list
>   out_file = str_get_cols(file_name(0),0,21)
>   output_file = out_file
>    pltName = output_file
>
>  pltType = "ps"                             ; "ps", "eps", "pdf", "png"
>    pltDir  = "./"
>    wks = gsn_open_wks(pltType, pltDir+pltName)
>   ;gsn_define_colormap(wks,"amwg")             ; choose a color map
>    gsn_define_colormap(wks,"BlAqGrYeOrReVi200"); choose a color map
>    res                     = True
>    res at cnFillOn            = True            ; turn on color
>    res at cnFillMode          = "RasterFill"    ; cell mode
>    res at cnLinesOn           = False           ; Turn off contour lines
>    res at gsnSpreadColors     = True            ; use full colormap
>    res at gsnAddCyclic        = False           ; data not cyclic
>    res at gsnMaximize         = True            ; ps, pdf, pdf
>    res at pmTickMarkDisplayMode = "Always"      ; use NCL default
>   ;res at lbOrientation       = "Vertical"      ; vertical label bar
>    res at lbLabelAutoStride   = True            ; let NCL decide spacing
>
>    res at mpMinLatF           = 22.50  ;    min(d at lat2d)    ; region to zoom
> in on
>    res at mpMaxLatF           = 33.80  ;    max(d at lat2d)
>    res at mpMinLonF           = -115.00   ;   min(d at lon2d)
>    res at mpMaxLonF           = -102.500 ; max(d at lon2d)
>    res at mpFillOn            = False
>   ;res at mpOutlineBoundarySets = "USStates"    ; turn on state boundaries
>   ;res at mpOutlineBoundarySets = "AllBoundaries"
>    res at mpOutlineBoundarySets = "National"    ; turn on country boundaries
>    res at trGridType          = "TriangularMesh"   ; Necessary b/c lat, lon
>
>    res at cnLevelSelectionMode = "ManualLevels"  ;"ExplicitLevels"
>    res at cnMinLevelValF       = 200.                            ; set the
> minimum contour level
>    res at cnMaxLevelValF       = 300.                          ; set the
> maximum contour level
>    res at cnLevelSpacingF      = 5.0                            ; set the
> contour interval
>    res at cnRasterSmoothingOn  = True
>  res at lbLabelStride        = 5.0             ; every other label bar label
>
>    res at gsnLeftString       = new_temp at type
>    res at tiMainString        = fili
>    plot = gsn_csm_contour_map_ce(wks,new_temp(:,:), res)
>
>    txid = new(1,graphic)                 ; one text string
>
>    txres               = True
>    txres at txFont        = "helvetica-bold"
>    txres at txFontHeightF = 0.10
>    txid = gsn_add_text (wks,plot,"BASC",-108.2,28.2 ,txres)
>
>
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141111/13e370d6/attachment.html 


More information about the ncl-talk mailing list