<div dir="ltr">Dear Alan:<div><br></div><div>Thank you for helping me push this along.</div><div><br></div><div>My variables are already integers</div><div><br></div><div><div>new_time_units = &quot;hours since 1800-01-01 00:00&quot;</div><div>new_time_array = cd_inv_calendar( year(1,1,1),  month(1,1,1), day(1,1,1), hour(1,1,1), minute(1,1,1), 0, new_time_units,0)</div><div>print(&quot;new_time_array = &quot; + new_time_array)</div><div>format = &quot;&quot; ;; defaults to &quot;%H%M UTC %d %c %Y&quot;</div><div>time_var=cd_string(time_array,format)</div><div>print(&quot;time_var = &quot; + time_var)</div></div><div><br></div><div>However, I still get the unit error problem. </div><div><br></div><div>Note below, please: new time_array from a print(&quot;new_time_array&quot; + new_time_array&quot;) produces </div><div><br></div><div><div>(0)<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>new_time_array = 1900752.166666667</div><div><br></div><div>but (below), the printVarSummary produces a fill value equivalent to a NaN.</div><div><br></div><div>Here are the print outs.</div><div><br></div><div><div>(0)<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>year(1,1,1) = 2016</div><div>(0)<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>month(1,1,1) = 11</div><div>(0)<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>day(1,1,1) = 2</div><div>(0)<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>hour(1,1,1) = 0</div><div>(0)<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>new_time_array = 1900752.166666667</div><div><br></div><div>Variable: new_time_array</div><div>Type: double</div><div>Total Size: 8 bytes</div><div>            1 values</div><div>Number of Dimensions: 1</div><div>Dimensions and sizes:<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>[1]</div><div>Coordinates: </div><div>Number Of Attributes: 3</div><div>  _FillValue :<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>9.969209968386869e+36</div><div>  calendar :<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>standard</div><div>  units :<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>hours since 1800-01-01 00:00</div><div>(0)<span class="gmail-Apple-tab-span" style="white-space:pre">        </span>cd_string: The variable containing time values must have a &#39;units&#39; attribute.</div><div>fatal:Illegal right-hand side type for assignment</div><div>fatal:[&quot;Execute.c&quot;:8575]:Execute: Error occurred at or near line 130 in file ./obs_light_12km.ncl</div></div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 1, 2016 at 10:53 PM, Alan Brammer <span dir="ltr">&lt;<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.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 style="word-wrap:break-word"><div><br></div><div>The time variable passed to cd_string() should be in the format of “hours since 1800-01-01 00:00:00” or similar.   The format passed to the argument is for the output string not the input variable. </div><div><br></div><div><br></div><div>I don’t really understand how you got to the first line of your sample code but trying to build from that is some code below:</div><div><br></div><div> ; time_array(0)=hour(1,1,1)<br> ; time_array(1)=minute(1,1,1)<br> ; time_array(2)=day(1,1,1)<br> ; time_array(3)=month(1,1,1)<br> ; time_array(4)=year(1,1,1)<br><div dir="ltr"><div><div><div> ;;   time_array(5)=units    ;; are the above strings or numbers?  If they’re numbers this line won’t work. </div><div><br></div></div></div></div></div><div>;; first make a ut_coord complaint time variable from the arrays of time stuff you already have. </div><div><br></div><div><b>time_array = cd_inv_calendar( toint(year(1,1,1)), toint (month(1,1,1)), toint( day(1,1,1)), toint (hour(1,1,1)), toint (minute(1,1,1)), 0, “hours since 1800-01-01 00:00:00”,0)</b></div><div><div dir="ltr"><div><div><div><b>printVarSummary(time_array)</b></div><div>;;;    Should be a single number of double type with a units attribute. </div><div><b><br></b></div><div><b>format = “&quot; ;; defaults to &quot;%H%M UTC %d %c %Y&quot;</b></div></div></div></div></div><div><div dir="ltr"><div><div><div><span><b>time_var=cd_string(time_array,<wbr>format)</b></span></div><div><span><br></span></div><div><span><br></span></div><div><span><br></span></div><div><span>p.s. beware of weird quotation marks if copy/pasting from email. </span></div><div><span><br></span></div><div><span>Good luck, </span></div><div><span class="m_1941723079638841122Apple-tab-span" style="white-space:pre-wrap">                </span>Alan</div></div></div></div></div><div><br></div><br><div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><span class="m_1941723079638841122Apple-style-span" style="border-collapse:separate;color:rgb(0,0,0);font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;border-spacing:0px"><div style="word-wrap:break-word">##############################<br>Alan Brammer,<div>Post-Doc Researcher</div><div><br></div><div>Department of Atmospheric and Environmental Sciences,<br>University at Albany, State University of New York, Albany, NY, 12222<div><a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a><br>##############################</div></div></div></span></div></div>
</div>
<br><div><blockquote type="cite"><div><div class="h5"><div>On 1 Nov 2016, at 06:33, Barry Lynn &lt;<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>&gt; wrote:</div><br class="m_1941723079638841122Apple-interchange-newline"></div></div><div><div><div class="h5"><div dir="ltr">Good Morning:<div><br></div><div>I went to this page </div><div><br></div><div><a href="https://www.ncl.ucar.edu/Document/Functions/User_contributed/cd_string.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>Document/Functions/User_<wbr>contributed/cd_string.shtml</a></div><div><br></div><div>and tried to do this:</div><div><br></div><div><p style="margin:10px 0px 20px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:12pt">For all the following examples, assume that <em style="margin:0px;padding:0px">time</em> is an array of time values.</p><p style="margin:10px 0px 20px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:12pt"><b style="margin:0px;padding:0px">Example 1</b></p><p style="margin:10px 0px 20px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:12pt">Using the default format string of &quot;&quot; will result in &quot;HHMM UTC D Mon YYYY&quot; (e.g., 1800 UTC 4 Jul 1776):</p><div style="margin:10px 0px 20px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:12pt"><br class="m_1941723079638841122webkit-block-placeholder"></div><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent">  format = &quot;&quot;
  stime  = cd_string(time,format)</pre><div>The goal is to plot the string &quot;time_var&quot; as shown below, as a single variable.</div><div><br></div><div>But I get an error; please see below.</div><div><br></div><div>(Note: I thought (as a try) to stick this information in the &quot;unitlabel&quot; parameter below, but I would really prefer to plot the date on the right hand side at</div><div>the top of the map).</div><div><br></div><div>Here&#39;s my code.</div><div><br></div><div><div>;HHMM UTC D Mon YYYY</div><div>  time_array(0)=hour(1,1,1)</div><div>  time_array(1)=minute(1,1,1)</div><div>  time_array(2)=day(1,1,1)</div><div>  time_array(3)=month(1,1,1)</div><div>  time_array(4)=year(1,1,1)</div><div>  time_array(5)=units</div><div>; format = &quot;HHMM UTC D Mon YYYY&quot;</div><div>  format = &quot;&quot;</div><div>  <b>time_var=cd_string(time_array,<wbr>format)</b></div><div>  print(&quot;time_var = &quot; + time_var)</div><div>  opts_ic_cg@FieldTitle           = &quot;Lightning Rate&quot;</div><div>; opts_ic_cg@UnitLabel            = &quot;/10-min&quot;</div><div> <b> opts_ic_cg@UnitLabel            = time_var</b></div></div><div><b><br></b></div><div><div style="font-weight:bold">(0)<span class="m_1941723079638841122gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>Working on time: 2016-10-30_00:00:00</div><div style="font-weight:bold">(0)<span class="m_1941723079638841122gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>cd_string: The variable containing time values must have a &#39;units&#39; attribute.</div><div style="font-weight:bold">fatal:Illegal right-hand side type for assignment</div><div style="font-weight:bold"><br></div><div>After searching and finding:</div><div style="font-weight:bold"><br></div><div style="font-weight:bold"><a href="http://www.ncl.ucar.edu/Document/Functions/User_contributed/time_axis_labels.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Functions/User_<wbr>contributed/time_axis_labels.<wbr>shtml</a><br></div><div style="font-weight:bold"><br></div><div style="font-weight:bold"><em style="margin:0px;padding:0px;font-family:verdana,sans-serif;font-size:13.3333px;font-weight:normal">time</em><span style="font-family:verdana,sans-serif;font-size:13.3333px;font-weight:normal"></span><p class="m_1941723079638841122gmail-indent" style="margin:10px 0px 20px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-weight:normal;font-size:13.3333px;line-height:12pt">An array containing the values of time. This variable should have an attribute named &quot;units&quot;. In other words, this variable holds the values of the coordinate axis &#39;time&#39; along with the units.</p><div><br></div><em style="margin:0px;padding:0px;font-family:verdana,sans-serif;font-size:13.3333px;font-weight:normal"></em></div><div><br></div><div>I am not sure what this error means or how to address the error.</div><div><br></div><div>Thank you.</div><div style="font-weight:bold"><br></div></div><div><br></div>-- <br><div class="m_1941723079638841122gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com/" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US <a href="tel:914%20432%203108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></div>
</div></div></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" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br></div></blockquote></div><br></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US 914 432 3108<br></div></div></div>
</div>