<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"><<a href="mailto:burakows@ucar.edu" target="_blank">burakows@ucar.edu</a>></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"><<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</a>></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, "The
text strings will be drawn only when the plot is drawn.". 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,"d01, 36 km",-65,28,tres)<br>dum2 = gsn_add_text(wks,plot_d01,"d02,12 km",-67,36,tres)</div><div>dum3 = gsn_add_text(wks,plot_d01,"d03, 4 km",-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"><<a href="mailto:burakows@ucar.edu" target="_blank">burakows@ucar.edu</a>></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 "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</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 = "/glade/scratch/burakows/summer_MP8LW1SW2CLMcurrent_200811-200911/run/"</div><div><br></div><div> wrfo_d01 = addfile(dir+"wrfout_d01_2008-11-01_00:00:<a href="http://00.nc" target="_blank">00.nc</a>","r")</div><div> wrfo_d02 = addfile(dir+"wrfout_d02_2008-11-01_00:00:<a href="http://00.nc" target="_blank">00.nc</a>","r")</div><div> wrfo_d03<span style="white-space:pre-wrap"> </span>= addfile(dir+"wrfout_d03_2008-11-01_00:00:<a href="http://00.nc" target="_blank">00.nc</a>","r")<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->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->LU_INDEX</div><div><span style="white-space:pre-wrap">        </span>d03_LC = wrfo_d03->LU_INDEX</div><div><br></div><div><span style="white-space:pre-wrap">        </span>d01_LC@description = " "</div><div><span style="white-space:pre-wrap">        </span>d02_LC@description = " "</div><div><span style="white-space:pre-wrap">        </span>d03_LC@description = " "</div><div> <span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>d01_LC@lat2d = wrfo_d01->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->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->XLAT(0,:,:)</div><div><span style="white-space:pre-wrap">        </span>d01_lon2d = wrfo_d01->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->XLAT(0,:,:) </div><div> d02_LC@lon2d = wrfo_d02->XLONG(0,:,:) </div><div><span style="white-space:pre-wrap">        </span>d02_lat2d = wrfo_d02->XLAT(0,:,:)</div><div><span style="white-space:pre-wrap">        </span>d02_lon2d = wrfo_d02->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->XLAT(0,:,:) </div><div> d03_LC@lon2d = wrfo_d03->XLONG(0,:,:)</div><div><span style="white-space:pre-wrap">        </span>d03_lat2d = wrfo_d03->XLAT(0,:,:)</div><div><span style="white-space:pre-wrap">        </span>d03_lon2d = wrfo_d03->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> " 1 Urban & Built-Up" <span style="white-space:pre-wrap">        </span>,\ ; red</div><div> " 2 Dryland Crop & Pasture" ,\ ; lightgoldenrod1</div><div> " 3 Irr. Crop & Pasture" <span style="white-space:pre-wrap">        </span>,\ ; goldenrod1</div><div> " 4 Mix Dry/Irr Crop & Pasture" ,\ ; orange</div><div> " 5 Crop/Grass Mosaic" ,\ ; tan2</div><div> " 6 Crop/Wood Mosaic" ,\ ; tan4 (too dark)</div><div> " 7 Grassland" <span style="white-space:pre-wrap">        </span>,\ ; khaki1</div><div> " 8 Shrubland" <span style="white-space:pre-wrap">        </span>,\ ; khaki3</div><div> " 9 Mix Shrub/Grass" ,\ ; bisque</div><div> " 10 Savanna"<span style="white-space:pre-wrap">                </span> ,\ ; palegoldenrod</div><div> " 11 Decid. Broadleaf" ,\ ; palegreen</div><div> " 12 Decid. Needleleaf" ,\ ; olivedrab3</div><div> " 13 Evergreen Broadleaf" ,\ ; chartruese</div><div> " 14 Evergreen Needleleaf" ,\ ; darkgreen</div><div> " 15 Mixed Forest" ,\ ; seagreen4</div><div> " 16 Water Bodies" ,\ ; slategray</div><div> " 17 Herbaceous Wetland" ,\ ; mediumturquoise</div><div><span style="white-space:pre-wrap">        </span>" 18 Wooden Wetland" ,\ ; midnightblue</div><div><span style="white-space:pre-wrap">        </span>" 19 Barren/Sparse" <span style="white-space:pre-wrap">        </span>,\ ; moccasin</div><div><span style="white-space:pre-wrap">        </span>" 20 Herbaceous Tundra" ,\ ; magenta</div><div><span style="white-space:pre-wrap">        </span>" 21 Wooded Tundra" <span style="white-space:pre-wrap">        </span> ,\ ; mediumorchid4</div><div><span style="white-space:pre-wrap">        </span>" 22 Mixed Tundra" <span style="white-space:pre-wrap">        </span> ,\ ; maroon4</div><div><span style="white-space:pre-wrap">        </span>" 23 Bare Ground Tundra" ,\ ; mediumpurple</div><div><span style="white-space:pre-wrap">        </span>" 24 Snow or Ice" /) ; 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 = "ps" <span style="white-space:pre-wrap">                </span>; plot type</div><div> pltDir = "./" <span style="white-space:pre-wrap">                </span>; plot directory</div><div> pltName = "DomainMap" <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 = (/"red","lightgoldenrod1","goldenrod1","orange","tan2","tan4",\</div><div> <span style="white-space:pre-wrap">                </span> "khaki1","khaki3","bisque","palegoldenrod","palegreen","olivedrab3",\</div><div><span style="white-space:pre-wrap">                </span> "chartreuse","darkgreen","seagreen4","slategray1","mediumturquoise","midnightblue",\</div><div><span style="white-space:pre-wrap">                </span> "moccasin","magenta","mediumorchid4","maroon4",\</div><div><span style="white-space:pre-wrap">                </span> "mediumpurple","white"/)</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("size mismatch lu cats="+ninfo+" ,ncolors="+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 = "RasterFill" </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 = "ExplicitLevels" ; 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 = "AllBoundaries"</div><div> <span style="white-space:pre-wrap">        </span>res@mpProjection = "LambertConformal"</div><div><span style="white-space:pre-wrap">        </span>res@mpOutlineDrawOrder<span style="white-space:pre-wrap">        </span> = "PostDraw"<span style="white-space:pre-wrap">                </span> ; draw map outlines last</div><div><span style="white-space:pre-wrap">        </span>res@mpDataBaseVersion = "LowRes"<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 = "Always" ; 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 = "Corners" ; 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> = "black"</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> = " "</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 = "" ; Turn off left subtitle</div><div> res@gsnRightString = "" ; 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 = "black"</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,"d01, 36 km",-65,28,tres)</div><div> dum2 = gsn_add_text(wks,plot_d01,"d02,12 km",-67,36,tres)</div><div> dum3 = gsn_add_text(wks,plot_d01,"d03, 4 km",-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>