<div dir="ltr">Hi, <div><br></div><div>I am trying to use gsn_add_text to include some text on my overlaid contour maps.  However, the text I enter does not show up in the map and I do not receive any errors.  Any ideas why the text is not showing up?</div><div><br></div><div>Thanks, </div><div><br></div><div>Liz.</div><div><br></div><div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;</div><div><br></div><div>;==========================================================</div><div>;                         The main code</div><div>;==========================================================</div><div><br></div><div>begin</div><div>    <span class="" style="white-space:pre">        </span></div><div>;---WRF Domains directory</div><div>    dir       = &quot;/glade/scratch/burakows/summer_MP8LW1SW2CLMcurrent_200811-200911/run/&quot;</div><div><br></div><div>    wrfo_d01    = addfile(dir+&quot;wrfout_d01_2008-11-01_00:00:<a href="http://00.nc">00.nc</a>&quot;,&quot;r&quot;)</div><div>    wrfo_d02    = addfile(dir+&quot;wrfout_d02_2008-11-01_00:00:<a href="http://00.nc">00.nc</a>&quot;,&quot;r&quot;)</div><div>    wrfo_d03<span style="white-space:pre">    </span>= addfile(dir+&quot;wrfout_d03_2008-11-01_00:00:<a href="http://00.nc">00.nc</a>&quot;,&quot;r&quot;)<span class="" style="white-space:pre">        </span></div><div><br></div><div>       <span class="" style="white-space:pre">        </span>d01_LC <span class="" style="white-space:pre">        </span>= wrfo_d01-&gt;LU_INDEX<span class="" style="white-space:pre">        </span>; read present-day land use and preserve metadata</div><div><span class="" style="white-space:pre">        </span>d02_LC  = wrfo_d02-&gt;LU_INDEX</div><div><span class="" style="white-space:pre">        </span>d03_LC  = wrfo_d03-&gt;LU_INDEX</div><div><br></div><div><span class="" style="white-space:pre">        </span>d01_LC@description = &quot; &quot;</div><div><span class="" style="white-space:pre">        </span>d02_LC@description = &quot; &quot;</div><div><span class="" style="white-space:pre">        </span>d03_LC@description = &quot; &quot;</div><div>       <span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span>d01_LC@lat2d  = wrfo_d01-&gt;XLAT(0,:,:)       <span class="" style="white-space:pre">                </span>      ; Assign lat to x</div><div>       <span class="" style="white-space:pre">        </span>d01_LC@lon2d  = wrfo_d01-&gt;XLONG(0,:,:)       <span class="" style="white-space:pre">                </span>      ; Assign lon to x</div><div><span class="" style="white-space:pre">        </span>d01_lat2d     = wrfo_d01-&gt;XLAT(0,:,:)</div><div><span class="" style="white-space:pre">        </span>d01_lon2d     = wrfo_d01-&gt;XLONG(0,:,:)</div><div><span class="" style="white-space:pre">        </span>dims_d01      = dimsizes(d01_LC(0,:,:))</div><div><span class="" style="white-space:pre">        </span>nlat_d01      = dims_d01(0)</div><div><span class="" style="white-space:pre">        </span>nlon_d01      = dims_d01(1)</div><div><span class="" style="white-space:pre">        </span> </div><div>        d02_LC@lat2d  = wrfo_d02-&gt;XLAT(0,:,:)                        </div><div>        d02_LC@lon2d  = wrfo_d02-&gt;XLONG(0,:,:)                       </div><div><span class="" style="white-space:pre">        </span>d02_lat2d     = wrfo_d02-&gt;XLAT(0,:,:)</div><div><span class="" style="white-space:pre">        </span>d02_lon2d     = wrfo_d02-&gt;XLONG(0,:,:)</div><div><span class="" style="white-space:pre">        </span>dims_d02      = dimsizes(d02_LC(0,:,:))</div><div><span class="" style="white-space:pre">        </span>nlat_d02      = dims_d02(0)</div><div><span class="" style="white-space:pre">        </span>nlon_d02      = dims_d02(1)</div><div><span class="" style="white-space:pre">        </span></div><div>        d03_LC@lat2d  = wrfo_d03-&gt;XLAT(0,:,:)                        </div><div>        d03_LC@lon2d  = wrfo_d03-&gt;XLONG(0,:,:)</div><div><span class="" style="white-space:pre">        </span>d03_lat2d     = wrfo_d03-&gt;XLAT(0,:,:)</div><div><span class="" style="white-space:pre">        </span>d03_lon2d     = wrfo_d03-&gt;XLONG(0,:,:)</div><div><span class="" style="white-space:pre">        </span>dims_d03      = dimsizes(d03_LC(0,:,:))</div><div><span class="" style="white-space:pre">        </span>nlat_d03      = dims_d03(0)</div><div><span class="" style="white-space:pre">        </span>nlon_d03      = dims_d03(1)</div><div><br></div><div>;--- Define land use (LU_Index) categories for USGS 24 cat</div><div><br></div><div>   info = (/                             \ ; USGS 24 cat</div><div>        &quot; 1 Urban &amp; Built-Up&quot;      <span class="" style="white-space:pre">        </span>,\ ; red</div><div>        &quot; 2 Dryland Crop &amp; Pasture&quot;     ,\ ; lightgoldenrod1</div><div>        &quot; 3 Irr. Crop &amp; Pasture&quot;      <span class="" style="white-space:pre">        </span>,\ ; goldenrod1</div><div>        &quot; 4 Mix Dry/Irr Crop &amp; Pasture&quot; ,\ ; orange</div><div>        &quot; 5 Crop/Grass Mosaic&quot;          ,\ ; tan2</div><div>        &quot; 6 Crop/Wood Mosaic&quot;           ,\ ; tan4 (too dark)</div><div>        &quot; 7 Grassland&quot;           <span class="" style="white-space:pre">        </span>,\ ; khaki1</div><div>        &quot; 8 Shrubland&quot;          <span class="" style="white-space:pre">        </span>,\ ; khaki3</div><div>        &quot; 9 Mix Shrub/Grass&quot;            ,\ ; bisque</div><div>        &quot; 10 Savanna&quot;<span class="" style="white-space:pre">                </span>        ,\ ; palegoldenrod</div><div>        &quot; 11 Decid. Broadleaf&quot;          ,\ ; palegreen</div><div>        &quot; 12 Decid. Needleleaf&quot;         ,\ ; olivedrab3</div><div>        &quot; 13 Evergreen Broadleaf&quot;       ,\ ; chartruese</div><div>        &quot; 14 Evergreen Needleleaf&quot;      ,\ ; darkgreen</div><div>        &quot; 15 Mixed Forest&quot;              ,\ ; seagreen4</div><div>        &quot; 16 Water Bodies&quot;              ,\ ; slategray</div><div>        &quot; 17 Herbaceous Wetland&quot;        ,\ ; mediumturquoise</div><div><span class="" style="white-space:pre">        </span>&quot; 18 Wooden Wetland&quot;            ,\ ; midnightblue</div><div><span class="" style="white-space:pre">        </span>&quot; 19 Barren/Sparse&quot;      <span class="" style="white-space:pre">        </span>,\ ; moccasin</div><div><span class="" style="white-space:pre">        </span>&quot; 20 Herbaceous Tundra&quot;         ,\ ; magenta</div><div><span class="" style="white-space:pre">        </span>&quot; 21 Wooded Tundra&quot;  <span class="" style="white-space:pre">        </span>        ,\ ; mediumorchid4</div><div><span class="" style="white-space:pre">        </span>&quot; 22 Mixed Tundra&quot;    <span class="" style="white-space:pre">        </span>        ,\ ; maroon4</div><div><span class="" style="white-space:pre">        </span>&quot; 23 Bare Ground Tundra&quot;        ,\ ; mediumpurple</div><div><span class="" style="white-space:pre">        </span>&quot; 24 Snow or Ice&quot;               /) ; white</div><div><br></div><div><br></div><div>   ninfo = dimsizes(info)<span class="" style="white-space:pre">        </span>; # of categories</div><div><br></div><div>;----------------------------------------------------------------------</div><div>; Plotting options section</div><div>;----------------------------------------------------------------------</div><div><span class="" style="white-space:pre">        </span></div><div>       pltType = &quot;ps&quot;                <span class="" style="white-space:pre">                </span>; plot type</div><div>       pltDir = &quot;./&quot;              <span class="" style="white-space:pre">                </span>; plot directory</div><div>       pltName = &quot;DomainMap&quot; <span class="" style="white-space:pre">                </span>; plot name (ps file)</div><div>       pltPath = pltDir+pltName         <span class="" style="white-space:pre">        </span>; plot path</div><div><br></div><div>       colorscheme = (/&quot;red&quot;,&quot;lightgoldenrod1&quot;,&quot;goldenrod1&quot;,&quot;orange&quot;,&quot;tan2&quot;,&quot;tan4&quot;,\</div><div>       <span class="" style="white-space:pre">                </span>     &quot;khaki1&quot;,&quot;khaki3&quot;,&quot;bisque&quot;,&quot;palegoldenrod&quot;,&quot;palegreen&quot;,&quot;olivedrab3&quot;,\</div><div><span class="" style="white-space:pre">                </span>     &quot;chartreuse&quot;,&quot;darkgreen&quot;,&quot;seagreen4&quot;,&quot;slategray1&quot;,&quot;mediumturquoise&quot;,&quot;midnightblue&quot;,\</div><div><span class="" style="white-space:pre">                </span>     &quot;moccasin&quot;,&quot;magenta&quot;,&quot;mediumorchid4&quot;,&quot;maroon4&quot;,\</div><div><span class="" style="white-space:pre">                </span>     &quot;mediumpurple&quot;,&quot;white&quot;/)</div><div>        ncolors = dimsizes(colorscheme)</div><div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span>if(ninfo.ne.ncolors) then</div><div><span class="" style="white-space:pre">                </span>print(&quot;size mismatch lu cats=&quot;+ninfo+&quot;  ,ncolors=&quot;+ncolors)</div><div><span class="" style="white-space:pre">                </span>exit</div><div><span class="" style="white-space:pre">        </span>end if</div><div><br></div><div>   wks = gsn_open_wks(pltType,pltPath)              ; create workstation for ps file</div><div><br></div><div><span class="" style="white-space:pre">        </span>cnres                  = True                ; plot mods desired</div><div>  <span class="" style="white-space:pre">        </span>cnres@gsnDraw          = False</div><div>  <span class="" style="white-space:pre">        </span>cnres@gsnFrame         = False</div><div><br></div><div>    <span class="" style="white-space:pre">        </span>cnres@lbLabelBarOn     = False             ; turn on in panel plot</div><div><span class="" style="white-space:pre">        </span>cnres@cnInfoLabelOn    = False </div><div><span class="" style="white-space:pre">        </span></div><div>  <span class="" style="white-space:pre">        </span>cnres@cnFillOn         = True               ; color Fill </div><div>  <span class="" style="white-space:pre">        </span>cnres@cnFillMode       = &quot;RasterFill&quot; </div><div>  <span class="" style="white-space:pre">        </span>cnres@cnLinesOn        =  False             ; Turn off contour lines</div><div><span class="" style="white-space:pre">        </span>cnres@cnLineLabelsOn   = False</div><div>  <span class="" style="white-space:pre">        </span>cnres@cnLevelSelectionMode = &quot;ExplicitLevels&quot; ; set explict contour levels</div><div>  <span class="" style="white-space:pre">        </span>cnres@cnLevels         = (/2,3,4,5,6,7,8,\</div><div><span class="" style="white-space:pre">                                </span>9,10,11,12,13,14,\</div><div><span class="" style="white-space:pre">                                </span>15,16,17,18,19,20,\</div><div><span class="" style="white-space:pre">                                </span>21,22,23,24/)</div><div><span class="" style="white-space:pre">                </span></div><div>  <span class="" style="white-space:pre">        </span>cnres@cnFillPalette    = colorscheme        ; distinct colors for categories</div><div>  <span class="" style="white-space:pre">        </span>cnres@gsnSpreadColors  = False              ; use each color sequentially</div><div><br></div><div><span class="" style="white-space:pre">        </span>res = cnres<span class="" style="white-space:pre">        </span>; copy contour resources from first plot </div><div><span class="" style="white-space:pre">        </span></div><div>    <span class="" style="white-space:pre">        </span>res@mpFillOn              = False</div><div>    <span class="" style="white-space:pre">        </span>res@mpOutlineOn           = True</div><div>    <span class="" style="white-space:pre">        </span>res@mpOutlineBoundarySets = &quot;AllBoundaries&quot;</div><div>    <span class="" style="white-space:pre">        </span>res@mpProjection          = &quot;LambertConformal&quot;</div><div><span class="" style="white-space:pre">        </span>res@mpOutlineDrawOrder<span class="" style="white-space:pre">        </span>  = &quot;PostDraw&quot;<span class="" style="white-space:pre">                </span> ; draw map outlines last</div><div><span class="" style="white-space:pre">        </span>res@mpDataBaseVersion     = &quot;LowRes&quot;<span class="" style="white-space:pre">        </span> ; State boundaries</div><div><span class="" style="white-space:pre">        </span>res@mpGridAndLimbOn<span class="" style="white-space:pre">        </span>  = False</div><div><span class="" style="white-space:pre">        </span>res@pmTickMarkDisplayMode = &quot;Always&quot;         ; Turn on map tickmarks</div><div><br></div><div>    <span class="" style="white-space:pre">        </span>res@mpLambertParallel1F<span class="" style="white-space:pre">        </span>  = (max(d01_lat2d)+min(d01_lat2d))*0.3</div><div><span class="" style="white-space:pre">        </span>res@mpLambertParallel2F<span class="" style="white-space:pre">        </span>  = (max(d01_lat2d)+min(d01_lat2d))*0.7</div><div><span class="" style="white-space:pre">        </span>res@mpLambertMeridianF<span class="" style="white-space:pre">        </span>  = -72<span class="" style="white-space:pre">        </span>; </div><div><span class="" style="white-space:pre">        </span>res@mpLimitMode           = &quot;Corners&quot;        ; required for Lambert Conformal</div><div><span class="" style="white-space:pre">        </span>res@mpLeftCornerLatF      = d01_lat2d(0,0)</div><div>    <span class="" style="white-space:pre">        </span>res@mpLeftCornerLonF      = d01_lon2d(0,0)</div><div>    <span class="" style="white-space:pre">        </span>res@mpRightCornerLatF     = d01_lat2d(nlat_d01-1,nlon_d01-1)</div><div>    <span class="" style="white-space:pre">        </span>res@mpRightCornerLonF     = d01_lon2d(nlat_d01-1,nlon_d01-1)</div><div><span class="" style="white-space:pre">        </span>res@mpPerimOn<span class="" style="white-space:pre">                </span>  = True</div><div><span class="" style="white-space:pre">        </span>res@mpPerimLineThicknessF = 2.0</div><div><span class="" style="white-space:pre">        </span>res@mpPerimLineColor<span class="" style="white-space:pre">        </span>  = &quot;black&quot;</div><div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span>res@lbTitleString <span class="" style="white-space:pre">        </span>  = &quot; &quot;</div><div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span>res@tfDoNDCOverlay <span class="" style="white-space:pre">        </span>  = True  ; turn off transformation</div><div><br></div><div><span class="" style="white-space:pre">        </span>res@gsnLeftString         = &quot;&quot;                ; Turn off left subtitle</div><div>        res@gsnRightString        = &quot;&quot;                ; Turn off right subtitle</div><div><br></div><div><span class="" style="white-space:pre">        </span>res@gsnAddCyclic<span class="" style="white-space:pre">        </span>= False<span class="" style="white-space:pre">                </span>; regional grid </div><div><br></div><div><span class="" style="white-space:pre">        </span>res2 = cnres</div><div>  <span class="" style="white-space:pre">        </span>res2@lbLabelBarOn = False  ; Labelbar already created in 1st plot  </div><div>  <span class="" style="white-space:pre">        </span>res2@gsnMaximize  = False  ; Use maximization from original plot</div><div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span>res3 = cnres</div><div>  <span class="" style="white-space:pre">        </span>res3@lbLabelBarOn = False  ; Labelbar already created in 1st plot  </div><div>  <span class="" style="white-space:pre">        </span>res3@gsnMaximize  = False  ; Use maximization from original plot</div><div><br></div><div><span class="" style="white-space:pre">        </span>;---- Plot three domains and their land cover</div><div>        </div><div>        plot_d01 = gsn_csm_contour_map(wks,d01_LC(0,:,:),res) ; create plot of d01 present-day land cover</div><div><span class="" style="white-space:pre">        </span>plot_d02 = gsn_csm_contour(wks,d02_LC(0,:,:),res2) ; create plot of d02 present-day land cover</div><div><span class="" style="white-space:pre">        </span>plot_d03 = gsn_csm_contour(wks,d03_LC(0,:,:),res3) ; create plot of d03 present-day land cover</div><div><br></div><div><span class="" style="white-space:pre">        </span>overlay(plot_d01,plot_d02)</div><div><span class="" style="white-space:pre">        </span>overlay(plot_d01,plot_d03)</div><div><br></div><div><span class="" style="white-space:pre">        </span>draw(plot_d01)</div><div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span>;---- set polygon line resources:</div><div><span class="" style="white-space:pre">        </span>lnres = True</div><div><span class="" style="white-space:pre">        </span>lnres@gsLineColor = &quot;black&quot;</div><div><span class="" style="white-space:pre">        </span>lnres@gsLineThicknessF = 2.0 </div><div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span>gsn_polyline(wks,plot_d01,d02_lon2d(:,0),d02_lat2d(:,0),lnres)</div><div><span class="" style="white-space:pre">        </span>gsn_polyline(wks,plot_d01,d02_lon2d(:,nlon_d02-1),d02_lat2d(:,nlon_d02-1),lnres)</div><div><span class="" style="white-space:pre">        </span>gsn_polyline(wks,plot_d01,d02_lon2d(0,:),d02_lat2d(0,:),lnres)</div><div><span class="" style="white-space:pre">        </span>gsn_polyline(wks,plot_d01,d02_lon2d(nlat_d02-1,:),d02_lat2d(nlat_d02-1,:),lnres)</div><div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span>gsn_polyline(wks,plot_d01,d03_lon2d(:,0),d03_lat2d(:,0),lnres)</div><div><span class="" style="white-space:pre">        </span>gsn_polyline(wks,plot_d01,d03_lon2d(:,nlon_d03-1),d03_lat2d(:,nlon_d03-1),lnres)</div><div><span class="" style="white-space:pre">        </span>gsn_polyline(wks,plot_d01,d03_lon2d(0,:),d03_lat2d(0,:),lnres)</div><div><span class="" style="white-space:pre">        </span>gsn_polyline(wks,plot_d01,d03_lon2d(nlat_d03-1,:),d03_lat2d(nlat_d03-1,:),lnres)</div><div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span>tres = True</div><div><span class="" style="white-space:pre">        </span>tres@txFontHeightF = 0.15</div><div><span class="" style="white-space:pre">        </span>dum1 = gsn_add_text(wks,plot_d01,&quot;d01, 36 km&quot;,-65,28,tres)</div><div>        dum2 = gsn_add_text(wks,plot_d01,&quot;d02,12 km&quot;,-67,36,tres)</div><div>        dum3 = gsn_add_text(wks,plot_d01,&quot;d03, 4 km&quot;,-69,41,tres)</div><div><br></div><div><br></div><div>frame(wks)</div><div><br></div><div>end</div></div></div>