<div dir="ltr"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Thanks a lot Alan, it worked!<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif">Tabish<br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div><font size="1"><span style="font-family:tahoma,sans-serif">Tabish U Ansari<br></span></font></div><font size="1"><span style="font-family:tahoma,sans-serif">PhD student, Lancaster Environment Center<br></span></font></div><font size="1"><span style="font-family:tahoma,sans-serif">Lancaster Univeristy<br> <span>Bailrigg</span>, <span>Lancaster</span>, <br><span>LA1 4YW</span>, <span>United Kingdom</span></span></font><br></div></div></div>
<br><div class="gmail_quote">On 21 September 2016 at 19:36, Alan Brammer <span dir="ltr"><<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>></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"><a href="http://www.ncl.ucar.edu/Document/Functions/User_contributed/cd_inv_string.shtml" target="_blank">http://www.ncl.ucar.edu/<wbr>Document/Functions/User_<wbr>contributed/cd_inv_string.<wbr>shtml</a><div><br></div><div>I wrote the above function a while back to better handle string times. You can download my version (I think it’s the same as the future 6.4.0 version) here:</div><div><a href="https://bitbucket.org/a1brammer/ncl_functions/raw/78dea35d95946425e9054cdc9286ae3db88d9585/cd_inv_string.ncl" target="_blank">https://bitbucket.org/<wbr>a1brammer/ncl_functions/raw/<wbr>78dea35d95946425e9054cdc9286ae<wbr>3db88d9585/cd_inv_string.ncl</a></div><div>Save that function, then load at the top of your script from where ever you saved it. </div><div><br></div><div><br></div><div>You need to convert times to a numeric format, apply the offset, then convert back to a nicely formatted string. </div><div>Formats applied below are likely not correct for your version, check the documentation and adjust as necessary. </div><div><br></div><div><br></div><div>e.g. </div><div><br></div><div>time_numeric = cd_inv_string( times(it), “%Y%N%D%H%M”) ;; will return in hours since 1800-01-01 unless specified otherwise</div><div>offset = -8 ; hours</div><div>time_numeric = time_numeric - offset</div><div><div dir="ltr"><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">pnlres@txstring = cd_string( time_numeric, “%Y%N%D%H%M” )</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">HTH,</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif">Alan</div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div><div class="gmail_default" style="font-family:'trebuchet ms',sans-serif"><br></div></div></div><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 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 21 Sep 2016, at 12:08, Tabish Ansari <<a href="mailto:tabishumaransari@gmail.com" target="_blank">tabishumaransari@gmail.com</a>> wrote:</div><br></div></div><div><div><div class="h5"><div dir="ltr"><div style="font-family:trebuchet ms,sans-serif" class="gmail_default">Hi<br><br></div><div style="font-family:trebuchet ms,sans-serif" class="gmail_default">I'm creating lots of instantaneous panelplots for WRF data with the appropriate time-stamp on each panel. I'm doing this by simply using pnlres@txstring = times(it) where:<br><br>times = wrf_user_getvar(a,"times",-1) <br></div><div style="font-family:trebuchet ms,sans-serif" class="gmail_default">and "it" is the standard increment variable in the loop.<br><br></div><div style="font-family:trebuchet ms,sans-serif" class="gmail_default">This is the standard method and works fine but the times are obviously in UTC. I want to print local time (in my case UTC + 8) instead, but I'm not sure how to do this in a clean way as times is a string variable.<br><br></div><div style="font-family:trebuchet ms,sans-serif" class="gmail_default">Please suggest a nice way to go about this issue.<br><br></div><div style="font-family:trebuchet ms,sans-serif" class="gmail_default">Thanks<br><br></div><div style="font-family:trebuchet ms,sans-serif" class="gmail_default">Tabish<br></div><div style="font-family:trebuchet ms,sans-serif" class="gmail_default"><br clear="all"></div><div><div><div dir="ltr"><div><div><font size="1"><span style="font-family:tahoma,sans-serif">Tabish U Ansari<br></span></font></div><font size="1"><span style="font-family:tahoma,sans-serif">PhD student, Lancaster Environment Center<br></span></font></div><font size="1"><span style="font-family:tahoma,sans-serif">Lancaster Univeristy<br> <span>Bailrigg</span>, <span>Lancaster</span>, <br><span>LA1 4YW</span>, <span>United Kingdom</span></span></font><br></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></div></blockquote></div><br></div>