<div dir="ltr">Apologies, it is <i>now </i>working.  (typo said <i>not</i> working).<div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 18, 2014 at 9:48 AM, Elizabeth Burakowski <span dir="ltr">&lt;<a href="mailto:burakows@ucar.edu" target="_blank">burakows@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for the prompt response, Adam.  It was the draw order and it is not working properly when I move gsn_add_text above draw(plot_01).<div><br></div><div>Liz.</div><div>  </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 18, 2014 at 9:16 AM, Adam Phillips <span dir="ltr">&lt;<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Elizabeth,<br></div>I think this is just a draw order problem. According to the gsn_add_text documentation, &quot;The
text strings will be drawn only when the plot is drawn.&quot;. So, I think all you need to do is move these five lines above the draw(plot_d01) call:<span><br><div>tres = True</div><div>tres@txFontHeightF = 0.15</div><div>dum1 = gsn_add_text(wks,plot_d01,&quot;d01, 36 km&quot;,-65,28,tres)<br>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></span><span>draw(plot_d01)<br><div>;---- set polygon line resources:</div><div>lnres = True<br><br></div></span><div>If that does not solve it please let ncl-talk know..<br>Adam<br></div><br><br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Thu, Sep 18, 2014 at 9:12 AM, Elizabeth Burakowski <span dir="ltr">&lt;<a href="mailto:burakows@ucar.edu" target="_blank">burakows@ucar.edu</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><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 style="white-space:pre-wrap">        </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" target="_blank">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" target="_blank">00.nc</a>&quot;,&quot;r&quot;)</div><div>    wrfo_d03<span style="white-space:pre-wrap">    </span>= addfile(dir+&quot;wrfout_d03_2008-11-01_00:00:<a href="http://00.nc" target="_blank">00.nc</a>&quot;,&quot;r&quot;)<span style="white-space:pre-wrap">        </span></div><div><br></div><div>       <span style="white-space:pre-wrap">        </span>d01_LC <span style="white-space:pre-wrap">        </span>= wrfo_d01-&gt;LU_INDEX<span style="white-space:pre-wrap">        </span>; read present-day land use and preserve metadata</div><div><span style="white-space:pre-wrap">        </span>d02_LC  = wrfo_d02-&gt;LU_INDEX</div><div><span style="white-space:pre-wrap">        </span>d03_LC  = wrfo_d03-&gt;LU_INDEX</div><div><br></div><div><span style="white-space:pre-wrap">        </span>d01_LC@description = &quot; &quot;</div><div><span style="white-space:pre-wrap">        </span>d02_LC@description = &quot; &quot;</div><div><span style="white-space:pre-wrap">        </span>d03_LC@description = &quot; &quot;</div><div>       <span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>d01_LC@lat2d  = wrfo_d01-&gt;XLAT(0,:,:)       <span style="white-space:pre-wrap">                </span>      ; Assign lat to x</div><div>       <span style="white-space:pre-wrap">        </span>d01_LC@lon2d  = wrfo_d01-&gt;XLONG(0,:,:)       <span style="white-space:pre-wrap">                </span>      ; Assign lon to x</div><div><span style="white-space:pre-wrap">        </span>d01_lat2d     = wrfo_d01-&gt;XLAT(0,:,:)</div><div><span style="white-space:pre-wrap">        </span>d01_lon2d     = wrfo_d01-&gt;XLONG(0,:,:)</div><div><span style="white-space:pre-wrap">        </span>dims_d01      = dimsizes(d01_LC(0,:,:))</div><div><span style="white-space:pre-wrap">        </span>nlat_d01      = dims_d01(0)</div><div><span style="white-space:pre-wrap">        </span>nlon_d01      = dims_d01(1)</div><div><span style="white-space:pre-wrap">        </span> </div><div>        d02_LC@lat2d  = wrfo_d02-&gt;XLAT(0,:,:)                        </div><div>        d02_LC@lon2d  = wrfo_d02-&gt;XLONG(0,:,:)                       </div><div><span style="white-space:pre-wrap">        </span>d02_lat2d     = wrfo_d02-&gt;XLAT(0,:,:)</div><div><span style="white-space:pre-wrap">        </span>d02_lon2d     = wrfo_d02-&gt;XLONG(0,:,:)</div><div><span style="white-space:pre-wrap">        </span>dims_d02      = dimsizes(d02_LC(0,:,:))</div><div><span style="white-space:pre-wrap">        </span>nlat_d02      = dims_d02(0)</div><div><span style="white-space:pre-wrap">        </span>nlon_d02      = dims_d02(1)</div><div><span style="white-space:pre-wrap">        </span></div><div>        d03_LC@lat2d  = wrfo_d03-&gt;XLAT(0,:,:)                        </div><div>        d03_LC@lon2d  = wrfo_d03-&gt;XLONG(0,:,:)</div><div><span style="white-space:pre-wrap">        </span>d03_lat2d     = wrfo_d03-&gt;XLAT(0,:,:)</div><div><span style="white-space:pre-wrap">        </span>d03_lon2d     = wrfo_d03-&gt;XLONG(0,:,:)</div><div><span style="white-space:pre-wrap">        </span>dims_d03      = dimsizes(d03_LC(0,:,:))</div><div><span style="white-space:pre-wrap">        </span>nlat_d03      = dims_d03(0)</div><div><span style="white-space:pre-wrap">        </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 style="white-space:pre-wrap">        </span>,\ ; red</div><div>        &quot; 2 Dryland Crop &amp; Pasture&quot;     ,\ ; lightgoldenrod1</div><div>        &quot; 3 Irr. Crop &amp; Pasture&quot;      <span style="white-space:pre-wrap">        </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 style="white-space:pre-wrap">        </span>,\ ; khaki1</div><div>        &quot; 8 Shrubland&quot;          <span style="white-space:pre-wrap">        </span>,\ ; khaki3</div><div>        &quot; 9 Mix Shrub/Grass&quot;            ,\ ; bisque</div><div>        &quot; 10 Savanna&quot;<span style="white-space:pre-wrap">                </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 style="white-space:pre-wrap">        </span>&quot; 18 Wooden Wetland&quot;            ,\ ; midnightblue</div><div><span style="white-space:pre-wrap">        </span>&quot; 19 Barren/Sparse&quot;      <span style="white-space:pre-wrap">        </span>,\ ; moccasin</div><div><span style="white-space:pre-wrap">        </span>&quot; 20 Herbaceous Tundra&quot;         ,\ ; magenta</div><div><span style="white-space:pre-wrap">        </span>&quot; 21 Wooded Tundra&quot;  <span style="white-space:pre-wrap">        </span>        ,\ ; mediumorchid4</div><div><span style="white-space:pre-wrap">        </span>&quot; 22 Mixed Tundra&quot;    <span style="white-space:pre-wrap">        </span>        ,\ ; maroon4</div><div><span style="white-space:pre-wrap">        </span>&quot; 23 Bare Ground Tundra&quot;        ,\ ; mediumpurple</div><div><span style="white-space:pre-wrap">        </span>&quot; 24 Snow or Ice&quot;               /) ; white</div><div><br></div><div><br></div><div>   ninfo = dimsizes(info)<span style="white-space:pre-wrap">        </span>; # of categories</div><div><br></div><div>;----------------------------------------------------------------------</div><div>; Plotting options section</div><div>;----------------------------------------------------------------------</div><div><span style="white-space:pre-wrap">        </span></div><div>       pltType = &quot;ps&quot;                <span style="white-space:pre-wrap">                </span>; plot type</div><div>       pltDir = &quot;./&quot;              <span style="white-space:pre-wrap">                </span>; plot directory</div><div>       pltName = &quot;DomainMap&quot; <span style="white-space:pre-wrap">                </span>; plot name (ps file)</div><div>       pltPath = pltDir+pltName         <span style="white-space:pre-wrap">        </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 style="white-space:pre-wrap">                </span>     &quot;khaki1&quot;,&quot;khaki3&quot;,&quot;bisque&quot;,&quot;palegoldenrod&quot;,&quot;palegreen&quot;,&quot;olivedrab3&quot;,\</div><div><span style="white-space:pre-wrap">                </span>     &quot;chartreuse&quot;,&quot;darkgreen&quot;,&quot;seagreen4&quot;,&quot;slategray1&quot;,&quot;mediumturquoise&quot;,&quot;midnightblue&quot;,\</div><div><span style="white-space:pre-wrap">                </span>     &quot;moccasin&quot;,&quot;magenta&quot;,&quot;mediumorchid4&quot;,&quot;maroon4&quot;,\</div><div><span style="white-space:pre-wrap">                </span>     &quot;mediumpurple&quot;,&quot;white&quot;/)</div><div>        ncolors = dimsizes(colorscheme)</div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>if(ninfo.ne.ncolors) then</div><div><span style="white-space:pre-wrap">                </span>print(&quot;size mismatch lu cats=&quot;+ninfo+&quot;  ,ncolors=&quot;+ncolors)</div><div><span style="white-space:pre-wrap">                </span>exit</div><div><span style="white-space:pre-wrap">        </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 style="white-space:pre-wrap">        </span>cnres                  = True                ; plot mods desired</div><div>  <span style="white-space:pre-wrap">        </span>cnres@gsnDraw          = False</div><div>  <span style="white-space:pre-wrap">        </span>cnres@gsnFrame         = False</div><div><br></div><div>    <span style="white-space:pre-wrap">        </span>cnres@lbLabelBarOn     = False             ; turn on in panel plot</div><div><span style="white-space:pre-wrap">        </span>cnres@cnInfoLabelOn    = False </div><div><span style="white-space:pre-wrap">        </span></div><div>  <span style="white-space:pre-wrap">        </span>cnres@cnFillOn         = True               ; color Fill </div><div>  <span style="white-space:pre-wrap">        </span>cnres@cnFillMode       = &quot;RasterFill&quot; </div><div>  <span style="white-space:pre-wrap">        </span>cnres@cnLinesOn        =  False             ; Turn off contour lines</div><div><span style="white-space:pre-wrap">        </span>cnres@cnLineLabelsOn   = False</div><div>  <span style="white-space:pre-wrap">        </span>cnres@cnLevelSelectionMode = &quot;ExplicitLevels&quot; ; set explict contour levels</div><div>  <span style="white-space:pre-wrap">        </span>cnres@cnLevels         = (/2,3,4,5,6,7,8,\</div><div><span style="white-space:pre-wrap">                                </span>9,10,11,12,13,14,\</div><div><span style="white-space:pre-wrap">                                </span>15,16,17,18,19,20,\</div><div><span style="white-space:pre-wrap">                                </span>21,22,23,24/)</div><div><span style="white-space:pre-wrap">                </span></div><div>  <span style="white-space:pre-wrap">        </span>cnres@cnFillPalette    = colorscheme        ; distinct colors for categories</div><div>  <span style="white-space:pre-wrap">        </span>cnres@gsnSpreadColors  = False              ; use each color sequentially</div><div><br></div><div><span style="white-space:pre-wrap">        </span>res = cnres<span style="white-space:pre-wrap">        </span>; copy contour resources from first plot </div><div><span style="white-space:pre-wrap">        </span></div><div>    <span style="white-space:pre-wrap">        </span>res@mpFillOn              = False</div><div>    <span style="white-space:pre-wrap">        </span>res@mpOutlineOn           = True</div><div>    <span style="white-space:pre-wrap">        </span>res@mpOutlineBoundarySets = &quot;AllBoundaries&quot;</div><div>    <span style="white-space:pre-wrap">        </span>res@mpProjection          = &quot;LambertConformal&quot;</div><div><span style="white-space:pre-wrap">        </span>res@mpOutlineDrawOrder<span style="white-space:pre-wrap">        </span>  = &quot;PostDraw&quot;<span style="white-space:pre-wrap">                </span> ; draw map outlines last</div><div><span style="white-space:pre-wrap">        </span>res@mpDataBaseVersion     = &quot;LowRes&quot;<span style="white-space:pre-wrap">        </span> ; State boundaries</div><div><span style="white-space:pre-wrap">        </span>res@mpGridAndLimbOn<span style="white-space:pre-wrap">        </span>  = False</div><div><span style="white-space:pre-wrap">        </span>res@pmTickMarkDisplayMode = &quot;Always&quot;         ; Turn on map tickmarks</div><div><br></div><div>    <span style="white-space:pre-wrap">        </span>res@mpLambertParallel1F<span style="white-space:pre-wrap">        </span>  = (max(d01_lat2d)+min(d01_lat2d))*0.3</div><div><span style="white-space:pre-wrap">        </span>res@mpLambertParallel2F<span style="white-space:pre-wrap">        </span>  = (max(d01_lat2d)+min(d01_lat2d))*0.7</div><div><span style="white-space:pre-wrap">        </span>res@mpLambertMeridianF<span style="white-space:pre-wrap">        </span>  = -72<span style="white-space:pre-wrap">        </span>; </div><div><span style="white-space:pre-wrap">        </span>res@mpLimitMode           = &quot;Corners&quot;        ; required for Lambert Conformal</div><div><span style="white-space:pre-wrap">        </span>res@mpLeftCornerLatF      = d01_lat2d(0,0)</div><div>    <span style="white-space:pre-wrap">        </span>res@mpLeftCornerLonF      = d01_lon2d(0,0)</div><div>    <span style="white-space:pre-wrap">        </span>res@mpRightCornerLatF     = d01_lat2d(nlat_d01-1,nlon_d01-1)</div><div>    <span style="white-space:pre-wrap">        </span>res@mpRightCornerLonF     = d01_lon2d(nlat_d01-1,nlon_d01-1)</div><div><span style="white-space:pre-wrap">        </span>res@mpPerimOn<span style="white-space:pre-wrap">                </span>  = True</div><div><span style="white-space:pre-wrap">        </span>res@mpPerimLineThicknessF = 2.0</div><div><span style="white-space:pre-wrap">        </span>res@mpPerimLineColor<span style="white-space:pre-wrap">        </span>  = &quot;black&quot;</div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>res@lbTitleString <span style="white-space:pre-wrap">        </span>  = &quot; &quot;</div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>res@tfDoNDCOverlay <span style="white-space:pre-wrap">        </span>  = True  ; turn off transformation</div><div><br></div><div><span style="white-space:pre-wrap">        </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 style="white-space:pre-wrap">        </span>res@gsnAddCyclic<span style="white-space:pre-wrap">        </span>= False<span style="white-space:pre-wrap">                </span>; regional grid </div><div><br></div><div><span style="white-space:pre-wrap">        </span>res2 = cnres</div><div>  <span style="white-space:pre-wrap">        </span>res2@lbLabelBarOn = False  ; Labelbar already created in 1st plot  </div><div>  <span style="white-space:pre-wrap">        </span>res2@gsnMaximize  = False  ; Use maximization from original plot</div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>res3 = cnres</div><div>  <span style="white-space:pre-wrap">        </span>res3@lbLabelBarOn = False  ; Labelbar already created in 1st plot  </div><div>  <span style="white-space:pre-wrap">        </span>res3@gsnMaximize  = False  ; Use maximization from original plot</div><div><br></div><div><span style="white-space:pre-wrap">        </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 style="white-space:pre-wrap">        </span>plot_d02 = gsn_csm_contour(wks,d02_LC(0,:,:),res2) ; create plot of d02 present-day land cover</div><div><span style="white-space:pre-wrap">        </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 style="white-space:pre-wrap">        </span>overlay(plot_d01,plot_d02)</div><div><span style="white-space:pre-wrap">        </span>overlay(plot_d01,plot_d03)</div><div><br></div><div><span style="white-space:pre-wrap">        </span>draw(plot_d01)</div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>;---- set polygon line resources:</div><div><span style="white-space:pre-wrap">        </span>lnres = True</div><div><span style="white-space:pre-wrap">        </span>lnres@gsLineColor = &quot;black&quot;</div><div><span style="white-space:pre-wrap">        </span>lnres@gsLineThicknessF = 2.0 </div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>gsn_polyline(wks,plot_d01,d02_lon2d(:,0),d02_lat2d(:,0),lnres)</div><div><span style="white-space:pre-wrap">        </span>gsn_polyline(wks,plot_d01,d02_lon2d(:,nlon_d02-1),d02_lat2d(:,nlon_d02-1),lnres)</div><div><span style="white-space:pre-wrap">        </span>gsn_polyline(wks,plot_d01,d02_lon2d(0,:),d02_lat2d(0,:),lnres)</div><div><span style="white-space:pre-wrap">        </span>gsn_polyline(wks,plot_d01,d02_lon2d(nlat_d02-1,:),d02_lat2d(nlat_d02-1,:),lnres)</div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>gsn_polyline(wks,plot_d01,d03_lon2d(:,0),d03_lat2d(:,0),lnres)</div><div><span style="white-space:pre-wrap">        </span>gsn_polyline(wks,plot_d01,d03_lon2d(:,nlon_d03-1),d03_lat2d(:,nlon_d03-1),lnres)</div><div><span style="white-space:pre-wrap">        </span>gsn_polyline(wks,plot_d01,d03_lon2d(0,:),d03_lat2d(0,:),lnres)</div><div><span style="white-space:pre-wrap">        </span>gsn_polyline(wks,plot_d01,d03_lon2d(nlat_d03-1,:),d03_lat2d(nlat_d03-1,:),lnres)</div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>tres = True</div><div><span style="white-space:pre-wrap">        </span>tres@txFontHeightF = 0.15</div><div><span style="white-space:pre-wrap">        </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>
<br></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><span class="HOEnZb"><font color="#888888"><br>-- <br><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Division, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>   </font></span><span><font color="#888888"><a href="tel:303-497-1726" value="+13034971726" target="_blank">303-497-1726</a> </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div>
</font></span></font></span></div>
</blockquote></div><br></div>
</blockquote></div><br></div>