<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="">Would you by the way have code to convert from UTC to local time?</div></div></blockquote></div>I don’t know of a better way, maybe someone else on the list will.&nbsp;<div class=""><br class=""></div><div class="">The best solution I found was from a previous ncl-talk list&nbsp;<a href="http://mailman.ucar.edu/pipermail/ncl-talk/2016-August/006701.html" class="">http://mailman.ucar.edu/pipermail/ncl-talk/2016-August/006701.html</a></div><div class=""><br class=""></div><div class="">Though I’d say if you know the offset it’s easier to just do it manually.&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">p.s. keep ncl-talk cc’d on responses.&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 2 Nov 2016, at 01:42, Barry Lynn &lt;<a href="mailto:barry.h.lynn@gmail.com" class="">barry.h.lynn@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Yes, thank you.<div class=""><br class=""></div><div class="">Would you by the way have code to convert from UTC to local time?</div><div class=""><br class=""></div><div class="">For now, I just added a constant to the time since, but this isn't ideal.</div><div class=""><br class=""></div><div class="">Barry</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Nov 2, 2016 at 6:11 AM, Alan Brammer <span dir="ltr" class="">&lt;<a href="mailto:abrammer@albany.edu" target="_blank" class="">abrammer@albany.edu</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr" class="">It looks like you're still passing the old time array version. </p><p dir="ltr" class="">time_var=cd_string(time_array,<wbr class="">format)</p><p dir="ltr" class="">printvarsummary doesn't print the actual variable data, the number you see there is how the fillvalue is represented. That all looks good. Edit that above line and you should be golden. <br class=""></p><span class="HOEnZb"><font color="#888888" class=""><p dir="ltr" class="">Alan. </p></font></span><div class="HOEnZb"><div class="h5">
<div class="gmail_extra"><br class=""><div class="gmail_quote">On 1 Nov 2016 11:32 p.m., "Barry Lynn" &lt;<a href="mailto:barry.h.lynn@gmail.com" target="_blank" class="">barry.h.lynn@gmail.com</a>&gt; wrote:<br type="attribution" class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Dear Alan:<div class=""><br class=""></div><div class="">Thank you for helping me push this along.</div><div class=""><br class=""></div><div class="">My variables are already integers</div><div class=""><br class=""></div><div class=""><div class="">new_time_units = "hours since 1800-01-01 00:00"</div><div class="">new_time_array = cd_inv_calendar( year(1,1,1), &nbsp;month(1,1,1), day(1,1,1), hour(1,1,1), minute(1,1,1), 0, new_time_units,0)</div><div class="">print("new_time_array = " + new_time_array)</div><div class="">format = "" ;; defaults to "%H%M UTC %d %c %Y"</div><div class="">time_var=cd_string(time_array,<wbr class="">format)</div><div class="">print("time_var = " + time_var)</div></div><div class=""><br class=""></div><div class="">However, I still get the unit error problem.&nbsp;</div><div class=""><br class=""></div><div class="">Note below, please: new time_array from a print("new_time_array" + new_time_array") produces&nbsp;</div><div class=""><br class=""></div><div class=""><div class="">(0)<span class="m_-502204981104996167m_-5313993296880618405gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>new_time_array = 1900752.166666667</div><div class=""><br class=""></div><div class="">but (below), the printVarSummary produces a fill value equivalent to a NaN.</div><div class=""><br class=""></div><div class="">Here are the print outs.</div><div class=""><br class=""></div><div class=""><div class="">(0)<span class="m_-502204981104996167m_-5313993296880618405gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>year(1,1,1) = 2016</div><div class="">(0)<span class="m_-502204981104996167m_-5313993296880618405gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>month(1,1,1) = 11</div><div class="">(0)<span class="m_-502204981104996167m_-5313993296880618405gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>day(1,1,1) = 2</div><div class="">(0)<span class="m_-502204981104996167m_-5313993296880618405gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>hour(1,1,1) = 0</div><div class="">(0)<span class="m_-502204981104996167m_-5313993296880618405gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>new_time_array = 1900752.166666667</div><div class=""><br class=""></div><div class="">Variable: new_time_array</div><div class="">Type: double</div><div class="">Total Size: 8 bytes</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 values</div><div class="">Number of Dimensions: 1</div><div class="">Dimensions and sizes:<span class="m_-502204981104996167m_-5313993296880618405gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>[1]</div><div class="">Coordinates:&nbsp;</div><div class="">Number Of Attributes: 3</div><div class="">&nbsp; _FillValue :<span class="m_-502204981104996167m_-5313993296880618405gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>9.969209968386869e+36</div><div class="">&nbsp; calendar :<span class="m_-502204981104996167m_-5313993296880618405gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>standard</div><div class="">&nbsp; units :<span class="m_-502204981104996167m_-5313993296880618405gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>hours since 1800-01-01 00:00</div><div class="">(0)<span class="m_-502204981104996167m_-5313993296880618405gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>cd_string: The variable containing time values must have a 'units' attribute.</div><div class="">fatal:Illegal right-hand side type for assignment</div><div class="">fatal:["Execute.c":8575]:Execu<wbr class="">te: Error occurred at or near line 130 in file ./obs_light_12km.ncl</div></div></div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Nov 1, 2016 at 10:53 PM, Alan Brammer <span dir="ltr" class="">&lt;<a href="mailto:abrammer@albany.edu" target="_blank" class="">abrammer@albany.edu</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><br class=""></div><div class="">The time variable passed to cd_string() should be in the format of “hours since 1800-01-01 00:00:00” or similar. &nbsp; The format passed to the argument is for the output string not the input variable.&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">&nbsp;; time_array(0)=hour(1,1,1)<br class="">&nbsp;; time_array(1)=minute(1,1,1)<br class="">&nbsp;; time_array(2)=day(1,1,1)<br class="">&nbsp;; time_array(3)=month(1,1,1)<br class="">&nbsp;; time_array(4)=year(1,1,1)<br class=""><div dir="ltr" class=""><div class=""><div class=""><div class="">&nbsp;;; &nbsp; time_array(5)=units &nbsp; &nbsp;;; are the above strings or numbers?&nbsp; If they’re numbers this line won’t work.&nbsp;</div><div class=""><br class=""></div></div></div></div></div><div class="">;; first make a ut_coord complaint time variable from the arrays of time stuff you already have.&nbsp;</div><div class=""><br class=""></div><div class=""><b class="">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 class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><b class="">printVarSummary(time_array)</b></div><div class="">;;; &nbsp; &nbsp;Should be a single number of double type with a units attribute.&nbsp;</div><div class=""><b class=""><br class=""></b></div><div class=""><b class="">format = “" ;; defaults to&nbsp;"%H%M UTC %d %c %Y"</b></div></div></div></div></div><div class=""><div dir="ltr" class=""><div class=""><div class=""><div class=""><span class=""><b class="">time_var=cd_string(time_array,<wbr class="">format)</b></span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class="">p.s. beware of weird quotation marks if copy/pasting from email.&nbsp;</span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class="">Good luck,&nbsp;</span></div><div class=""><span class="m_-502204981104996167m_-5313993296880618405m_1941723079638841122Apple-tab-span" style="white-space:pre-wrap">                </span>Alan</div></div></div></div></div><div class=""><br class=""></div><br class=""><div class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: 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;" class=""><span class="m_-502204981104996167m_-5313993296880618405m_1941723079638841122Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: 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" class="">##############################<br class="">Alan Brammer,<div class="">Post-Doc Researcher</div><div class=""><br class=""></div><div class="">Department of Atmospheric and&nbsp;Environmental Sciences,<br class="">University at Albany,&nbsp;State University of New&nbsp;York,&nbsp;Albany, NY, 12222<div class=""><a href="mailto:abrammer@albany.edu" target="_blank" class="">abrammer@albany.edu</a><br class="">##############################</div></div></div></span></div></div>
</div>
<br class=""><div class=""><blockquote type="cite" class=""><div class=""><div class="m_-502204981104996167m_-5313993296880618405h5"><div class="">On 1 Nov 2016, at 06:33, Barry Lynn &lt;<a href="mailto:barry.h.lynn@gmail.com" target="_blank" class="">barry.h.lynn@gmail.com</a>&gt; wrote:</div><br class="m_-502204981104996167m_-5313993296880618405m_1941723079638841122Apple-interchange-newline"></div></div><div class=""><div class=""><div class="m_-502204981104996167m_-5313993296880618405h5"><div dir="ltr" class="">Good Morning:<div class=""><br class=""></div><div class="">I went to this page&nbsp;</div><div class=""><br class=""></div><div class=""><a href="https://www.ncl.ucar.edu/Document/Functions/User_contributed/cd_string.shtml" target="_blank" class="">https://www.ncl.ucar.edu/Docum<wbr class="">ent/Functions/User_contributed<wbr class="">/cd_string.shtml</a></div><div class=""><br class=""></div><div class="">and tried to do this:</div><div class=""><br class=""></div><div class=""><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" class="">For all the following examples, assume that&nbsp;<em style="margin:0px;padding:0px" class="">time</em>&nbsp;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" class=""><b style="margin:0px;padding:0px" class="">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" class="">Using the default format string of "" will result in "HHMM UTC D Mon YYYY" (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" class=""><br class="m_-502204981104996167m_-5313993296880618405m_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" class="">  format = ""
  stime  = cd_string(time,format)</pre><div class="">The goal is to plot the string "time_var" as shown below, as a single variable.</div><div class=""><br class=""></div><div class="">But I get an error; please see below.</div><div class=""><br class=""></div><div class="">(Note: I thought (as a try) to stick this information in the "unitlabel" parameter below, but I would really prefer to plot the date on the right hand side at</div><div class="">the top of the map).</div><div class=""><br class=""></div><div class="">Here's my code.</div><div class=""><br class=""></div><div class=""><div class="">;HHMM UTC D Mon YYYY</div><div class="">&nbsp; time_array(0)=hour(1,1,1)</div><div class="">&nbsp; time_array(1)=minute(1,1,1)</div><div class="">&nbsp; time_array(2)=day(1,1,1)</div><div class="">&nbsp; time_array(3)=month(1,1,1)</div><div class="">&nbsp; time_array(4)=year(1,1,1)</div><div class="">&nbsp; time_array(5)=units</div><div class="">; format = "HHMM UTC D Mon YYYY"</div><div class="">&nbsp; format = ""</div><div class="">&nbsp; <b class="">time_var=cd_string(time_array,<wbr class="">format)</b></div><div class="">&nbsp; print("time_var = " + time_var)</div><div class="">&nbsp; opts_ic_cg@FieldTitle &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = "Lightning Rate"</div><div class="">; opts_ic_cg@UnitLabel &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= "/10-min"</div><div class="">&nbsp;<b class=""> opts_ic_cg@UnitLabel &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= time_var</b></div></div><div class=""><b class=""><br class=""></b></div><div class=""><div style="font-weight:bold" class="">(0)<span class="m_-502204981104996167m_-5313993296880618405m_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" class="">(0)<span class="m_-502204981104996167m_-5313993296880618405m_1941723079638841122gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>cd_string: The variable containing time values must have a 'units' attribute.</div><div style="font-weight:bold" class="">fatal:Illegal right-hand side type for assignment</div><div style="font-weight:bold" class=""><br class=""></div><div class="">After searching and finding:</div><div style="font-weight:bold" class=""><br class=""></div><div style="font-weight:bold" class=""><a href="http://www.ncl.ucar.edu/Document/Functions/User_contributed/time_axis_labels.shtml" target="_blank" class="">http://www.ncl.ucar.edu/Docume<wbr class="">nt/Functions/User_contributed/<wbr class="">time_axis_labels.shtml</a><br class=""></div><div style="font-weight:bold" class=""><br class=""></div><div style="font-weight:bold" class=""><em style="margin:0px;padding:0px;font-family:verdana,sans-serif;font-size:13.3333px;font-weight:normal" class="">time</em><span style="font-family:verdana,sans-serif;font-size:13.3333px;font-weight:normal" class=""></span><p class="m_-502204981104996167m_-5313993296880618405m_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 "units". In other words, this variable holds the values of the coordinate axis 'time' along with the units.</p><div class=""><br class=""></div><em style="margin:0px;padding:0px;font-family:verdana,sans-serif;font-size:13.3333px;font-weight:normal" class=""></em></div><div class=""><br class=""></div><div class="">I am not sure what this error means or how to address the error.</div><div class=""><br class=""></div><div class="">Thank you.</div><div style="font-weight:bold" class=""><br class=""></div></div><div class=""><br class=""></div>-- <br class=""><div class="m_-502204981104996167m_-5313993296880618405m_1941723079638841122gmail_signature"><div dir="ltr" class="">Barry H. Lynn, Ph.D<div class=""><div class="">Senior Lecturer,</div><div class=""><div class=""><span style="color:rgb(136,136,136)" class="">The Institute of the Earth Science,&nbsp;</span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">The Hebrew University of Jerusalem,&nbsp;</span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">Givat Ram, Jerusalem 91904, Israel&nbsp;</span><br style="color:rgb(136,136,136)" class=""></div><span style="color:rgb(136,136,136)" class="">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">Fax: (972)-25662581</span></div></div><div class=""><span style="color:rgb(136,136,136)" class=""><br class=""></span></div><div class="">C.E.O, Weather It Is, LTD<br class="">Weather and Climate Focus<br class=""><a href="http://weather-it-is.com/" target="_blank" class="">http://weather-it-is.com</a><br class="">Jerusalem, Israel<br class="">Local: 02 930 9525<br class="">Cell: 054 7 231 170<br class="">Int-IS: x972 2 930 9525<br class="">US <a href="tel:914%20432%203108" value="+19144323108" target="_blank" class="">914 432 3108</a><br class=""></div></div></div>
</div></div></div></div>
______________________________<wbr class="">_________________<br class="">ncl-talk mailing list<br class=""><a href="mailto:ncl-talk@ucar.edu" target="_blank" class="">ncl-talk@ucar.edu</a><br class="">List instructions, subscriber options, unsubscribe:<br class=""><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank" class="">http://mailman.ucar.edu/mailma<wbr class="">n/listinfo/ncl-talk</a><br class=""></div></blockquote></div><br class=""></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="m_-502204981104996167m_-5313993296880618405gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class="">Barry H. Lynn, Ph.D<div class=""><div class="">Senior Lecturer,</div><div class=""><div class=""><span style="color:rgb(136,136,136)" class="">The Institute of the Earth Science,&nbsp;</span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">The Hebrew University of Jerusalem,&nbsp;</span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">Givat Ram, Jerusalem 91904, Israel&nbsp;</span><br style="color:rgb(136,136,136)" class=""></div><span style="color:rgb(136,136,136)" class="">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">Fax: (972)-25662581</span></div></div><div class=""><span style="color:rgb(136,136,136)" class=""><br class=""></span></div><div class="">C.E.O, Weather It Is, LTD<br class="">Weather and Climate Focus<br class=""><a href="http://weather-it-is.com/" target="_blank" class="">http://weather-it-is.com</a><br class="">Jerusalem, Israel<br class="">Local: 02 930 9525<br class="">Cell: 054 7 231 170<br class="">Int-IS: x972 2 930 9525<br class="">US <a href="tel:914%20432%203108" value="+19144323108" target="_blank" class="">914 432 3108</a><br class=""></div></div></div>
</div>
</blockquote></div></div>
</div></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class="">Barry H. Lynn, Ph.D<div class=""><div class="">Senior Lecturer,</div><div class=""><div class=""><span style="color:rgb(136,136,136)" class="">The Institute of the Earth Science,&nbsp;</span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">The Hebrew University of Jerusalem,&nbsp;</span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">Givat Ram, Jerusalem 91904, Israel&nbsp;</span><br style="color:rgb(136,136,136)" class=""></div><span style="color:rgb(136,136,136)" class="">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)" class=""><span style="color:rgb(136,136,136)" class="">Fax: (972)-25662581</span></div></div><div class=""><span style="color:rgb(136,136,136)" class=""><br class=""></span></div><div class="">C.E.O, Weather It Is, LTD<br class="">Weather and Climate Focus<br class=""><a href="http://weather-it-is.com/" target="_blank" class="">http://weather-it-is.com</a><br class="">Jerusalem, Israel<br class="">Local: 02 930 9525<br class="">Cell: 054 7 231 170<br class="">Int-IS: x972 2 930 9525<br class="">US 914 432 3108<br class=""></div></div></div>
</div>
</div></blockquote></div><br class=""></div></body></html>