<div dir="ltr"><div><div><div><div><div><div><div><div><div>Hello,<br><br></div><div>A paneled Space-Time plot via NCL. Note the driver is a function not a procedure. You (the user) can panel as desired.<br></div><div><br>A script, sample data file and resultant figure my be obtained at:<br><br></div>ftp <a href="http://ftp.cgd.ucar.edu">ftp.cgd.ucar.edu</a><br></div>anonymous<br></div>your_email<br></div>cd wkSpaceTime<br></div>prompt<br></div>ls<br></div>mget *<br></div>quit<br><br></div>Cheers<br><br>-rw-r--r-- 1 shea cgdcas 139916 Feb 6 15:32 diagnostics_cam_panel.ncl_new<br>-rw-r--r-- 1 shea cgdcas 30699392 Feb 6 15:32 <a href="http://OLR.12hr_2yrs.wheeler.nc">OLR.12hr_2yrs.wheeler.nc</a><br>-rw-r--r-- 1 shea cgdcas 260095 Feb 6 15:33 SpaceTimePanel.png<br>-rw-r--r-- 1 shea cgdcas 3049 Feb 6 15:32 wkSpaceTime_1.ncl_panel<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 29, 2017 at 9:56 AM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@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 class="gmail_default" style="font-size:small">To add this this, you may need to make sure that anything that's attached to a plot via a gsn_add_text or gsn_add_polyline call continues to "live" outside the script that it was called from. This means that the unique id returned from each of these calls must be attached as an attribute to the plot.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">For example, in the procedure "addHorVertLines", you have this code:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">begin</font></div><div class="gmail_default"><font face="monospace, monospace"> gsres = True</font></div><div class="gmail_default"><font face="monospace, monospace"> gsres@gsLineDashPattern = 1</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"> gsn_polyline(wks, plot, x1,y1,gsres)</font></div><div class="gmail_default"><font face="monospace, monospace"> gsn_polyline(wks, plot, x1,y2,gsres)</font></div><div class="gmail_default"><font face="monospace, monospace"> gsn_polyline(wks, plot, x1,y3,gsres)</font></div><div class="gmail_default"><font face="monospace, monospace"> gsn_polyline(wks, plot, x2,y4,gsres)</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"> txres = True</font></div><div class="gmail_default"><font face="monospace, monospace"> txres@txJust = "CenterLeft"</font></div><div class="gmail_default"><font face="monospace, monospace"> txres@txFontHeightF = 0.013</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"> gsn_text(wks, plot, "3 days" ,-14.7,.345,txres)</font></div><div class="gmail_default"><font face="monospace, monospace"> gsn_text(wks, plot, "6 days" ,-14.7,.175,txres)</font></div><div class="gmail_default"><font face="monospace, monospace"> gsn_text(wks, plot, "30 days",-14.7,.045,txres)</font></div><div class="gmail_default"><font face="monospace, monospace">end</font></div><div class="gmail_default"><br></div><div class="gmail_default">which needs to have all the gsn_polyline and gsn_text calls changed to gsn_add_polyline and gsn_add_text, but they also need to be returned from this procedure. You can use "unique_string" to generate a unique id each time:</div><div class="gmail_default"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">begin</font></div><div class="gmail_default"><font face="monospace, monospace"> gsres = True</font></div><div class="gmail_default"><font face="monospace, monospace"> gsres@gsLineDashPattern = 1</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"> plot@$unique_string("poly")$ = gsn_add_polyline(wks, plot, x1,y1,gsres)</font></div><div class="gmail_default"><font face="monospace, monospace"> plot@$unique_string("poly")$ = gsn_add_polyline(wks, plot, x1,y2,gsres)</font></div><div class="gmail_default"><font face="monospace, monospace"> plot@$unique_string("poly")$ = gsn_add_polyline(wks, plot, x1,y3,gsres)</font></div><div class="gmail_default"><font face="monospace, monospace"> plot@$unique_string("poly")$ = gsn_add_polyline(wks, plot, x2,y4,gsres)</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"> txres = True</font></div><div class="gmail_default"><font face="monospace, monospace"> txres@txJust = "CenterLeft"</font></div><div class="gmail_default"><font face="monospace, monospace"> txres@txFontHeightF = 0.013</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"> plot@$unique_string("text")$ = gsn_add_text(wks, plot, "3 days" ,-14.7,.345,txres)</font></div><div class="gmail_default"><font face="monospace, monospace"> plot@$unique_string("text")$ = gsn_add_text(wks, plot, "6 days" ,-14.7,.175,txres)</font></div><div class="gmail_default"><font face="monospace, monospace"> plot@$unique_string("text")$ = gsn_add_text(wks, plot, "30 days",-14.7,.045,txres)</font></div><div class="gmail_default"><font face="monospace, monospace">end</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif">You can also do it like this, for slightly cleaner code, but it does require that you create some arrays ahead of time with "new" to hold all the text and polylines being added:</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><div class="gmail_default" style="font-family:monospace,monospace">;---Create arrays to hold polylines and text polyid = new(4,graphic)</div><div class="gmail_default" style="font-family:monospace,monospace"> textid = new(3,graphic)</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace"> polyid(0) = gsn_add_polyline(wks, plot, x1,y1,gsres)</div><div class="gmail_default" style="font-family:monospace,monospace"> polyid(1) = gsn_add_polyline(wks, plot, x1,y2,gsres)</div><div class="gmail_default" style="font-family:monospace,monospace"> polyid(2) = gsn_add_polyline(wks, plot, x1,y3,gsres)</div><div class="gmail_default" style="font-family:monospace,monospace"> polyid(3) = gsn_add_polyline(wks, plot, x2,y4,gsres)</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace"> txres = True</div><div class="gmail_default" style="font-family:monospace,monospace"> txres@txJust = "CenterLeft"</div><div class="gmail_default" style="font-family:monospace,monospace"> txres@txFontHeightF = 0.013</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace"> textid(0) = gsn_add_text(wks, plot, "3 days" ,-14.7,.345,txres)</div><div class="gmail_default" style="font-family:monospace,monospace"> textid(1) = gsn_add_text(wks, plot, "6 days" ,-14.7,.175,txres)</div><div class="gmail_default" style="font-family:monospace,monospace"> textid(2) = gsn_add_text(wks, plot, "30 days",-14.7,.045,txres)</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">;---Make sure polyid and textid continue to "live" outside this procedure </div><div class="gmail_default" style="font-family:monospace,monospace"> plot@unique_string("poly") = polyid</div><div class="gmail_default" style="font-family:monospace,monospace"> plot@unique_string("text") = textid</div><div class="gmail_default"><br></div><div class="gmail_default">See the attached diagnostics_cam_panel.ncl. This is UNTESTED, but hopefully it gives you an idea where to start.</div><span class="HOEnZb"><font color="#888888"><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div></font></span></div></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 28, 2017 at 8:54 AM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@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>When I wrote the functions, my focus was on doing the computations and graphics correctly. Paneling the graphics was not a priority. To be honest, I did not even think about paneling. :-(<br></div><div><br>It would be possible to restructure ('refactor') the code. However, it would require some time and .effort. <br></div><div>[1] copy the code:<br></div><div> cp $NCARG_ROOT/lib/ncarg/nclscrip<wbr>ts/csm/diagnostics_cam.ncl diagnostics_cam.panel.ncl<br><br>[2] Change the local code: add 'res@gsnDraw=False' in multiple places; change 'polyline' procedure calls to the 'gsn_add_polyline' functions, etc <br><br>---<br><br></div><div>Perhaps, using Imagemagick's 'convert' tool. <br><br></div><div>%> convert <return><br><br></div><div>See the -append /+append options<br><br><div>I have not used the 'append' option very often. 'convert' has other
options that may also be of use. See: <br><br> <a href="http://www.imagemagick.org/Usage/layers/" target="_blank">http://www.imagemagick.org/Usa<wbr>ge/layers/</a><br><br></div>This link has numerous examples. <br></div><div><br>------<br><br></div><div>Consider image1.png, image2.png, image3.png, image4.png<br><br>%> convert -append image1.png image2.png IMAGE_12.TopBottom.png<br></div><div>%> display IMAGE_12.TopBottom.png<br><br></div><div>%> convert -append image3.png image4.png IMAGE_34.TopBottom.png<br>%> display IMAGE_34.TopBottom.png<br><br>%> convert +append IMAGE_12.TopBottom.png IMAGE_34.TopBottom.png IMAGE_2x2.png<br></div><div>%> display IMAGE_2x2.png<br><br>---<br></div><div>This type of thing could be invoked within an NCL script to save manually doing it. How?<br>After the 'image[1-4].png' have been created .... EG<br><br><pre> w<span style="font-family:arial,helvetica,sans-serif">kSpaceTime (u, diro, case, VAR, ,latBound, spd , nDayWin, nDaySkip, opt ) ; create images
</span></pre></div><div> system("convert -append image1.png image2.png IMAGE_12.TopBottom.png")<br></div><div> system("convert -append image3.png image4.png IMAGE_34.TopBottom.png")<br></div><div> system("convert +append IMAGE_12.TopBottom.png IMAGE_34.TopBottom.png IMAGE_2x2.png")<br></div><div> system("rm IMAGE*TopBottom.png")</div><div><br>---<br>Two on top; one at bottom<br><br>%> convert +append image1.png image2.png IMAGE_12.LeftRight.png<br><div>%> display IMAGE_12.LeftRight.png<br><br></div><div>%> convert -append IMAGE_12.LeftRight.png image3.png IMAGE_123.png<br>%> display IMAGE_123.png<br><br></div><div>I am sure you can 'center' the bottom figure but I'll leave that up to you. :-)<br></div><br>----<br></div><div>From the above link: 10 figures<br></div><div><pre><code><span style="font-family:arial,helvetica,sans-serif">convert \( font_1.gif font_2.gif font_3.gif +append \) \
\( font_4.gif font_5.gif font_6.gif +append \) \
\( font_7.gif font_8.gif font_9.gif +append \) \
\( -size 32x32 xc:none font_0.gif +append \) \
-background none -append append_array.gif</span>
</code></pre><br></div><div><br>I hope it works for you.<br><br></div><div>Good luck<br></div><div>D<br></div><div><br><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_-7895003836613895768h5">On Fri, Jan 27, 2017 at 5:45 PM, Millie J <span dir="ltr"><<a href="mailto:millie.jyo@gmail.com" target="_blank">millie.jyo@gmail.com</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 class="m_-7895003836613895768h5"><div dir="ltr">Hi,<div><br><div>Is there a way to plot the Wheeler-Kiladis space-time spectra (Figs. 1 to 3), for multiple model outputs, on a single graphic plot? Thanks.</div><div>Jyothi</div><div><br></div><div><br></div><div>Jyothi Nattala</div><div>GMAO / NASA GSFC</div></div></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>