<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div dir="ltr" id="yui_3_16_0_1_1450436634824_24074"><span id="yui_3_16_0_1_1450436634824_24096">Dear Dennis,</span></div><div id="yui_3_16_0_1_1450436634824_24197" dir="ltr"><br><span id="yui_3_16_0_1_1450436634824_24096"></span></div><div id="yui_3_16_0_1_1450436634824_24157" dir="ltr"><span id="yui_3_16_0_1_1450436634824_24096">I tried to use your suggested script, but got an error message as below (probablly because of, time = cd_convert( time0, "hours since 1987-04-13 18:00:00" )). Would you please kindly give more suggestion?</span></div><div id="yui_3_16_0_1_1450436634824_24312" dir="ltr"><br><span id="yui_3_16_0_1_1450436634824_24096"></span></div><div id="yui_3_16_0_1_1450436634824_24332" dir="ltr"><span id="yui_3_16_0_1_1450436634824_24096">Thanks so much!!!</span></div><div dir="ltr"><span id="yui_3_16_0_1_1450436634824_24096">Mark<br></span></div><div id="yui_3_16_0_1_1450436634824_24158" dir="ltr"><br><span id="yui_3_16_0_1_1450436634824_24096"></span></div><div id="yui_3_16_0_1_1450436634824_24347" dir="ltr"><span id="yui_3_16_0_1_1450436634824_24096">===ncl error message===<br></span></div><div id="yui_3_16_0_1_1450436634824_24102" dir="ltr"><span id="yui_3_16_0_1_1450436634824_24096">Variable: time0<br class="" id="yui_3_16_0_1_1450436634824_24077">Type: character<br class="" id="yui_3_16_0_1_1450436634824_24079">Total Size: 19 bytes<br class="" id="yui_3_16_0_1_1450436634824_24081"> 19 values<br class="" id="yui_3_16_0_1_1450436634824_24083">Number of Dimensions: 2<br class="" id="yui_3_16_0_1_1450436634824_24085">Dimensions and sizes: [Time | 1] x [DateStrLen | 19]<br class="" id="yui_3_16_0_1_1450436634824_24087">Coordinates: <br class="" id="yui_3_16_0_1_1450436634824_24089">Number Of Attributes: 0<br class="" id="yui_3_16_0_1_1450436634824_24091">fatal:Could not coerce values for operation<br class="" id="yui_3_16_0_1_1450436634824_24093">fatal:["Execute.c":8128]:Execute: Error occurred at or near line 15 in file D1_Times.ncl<br class="" id="yui_3_16_0_1_1450436634824_24095"></span></div> <div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font face="Arial" size="2"> On Tuesday, December 15, 2015 9:04 PM, Dennis Shea <shea@ucar.edu> wrote:<br></font></div> <br><br> <div class="y_msg_container">Perhaps two approaches....<br clear="none"><br clear="none"><br clear="none">[1] Add 6 to current values<br clear="none">[2] Use a function<br clear="none"><br clear="none">Initially,<br clear="none"> f = addfile("...","r") ; Use "r" for test and "w" to actually<br clear="none">overwrite the values<br clear="none"> time0 = f->time<br clear="none"><br clear="none"> time = time0 ; copy for print<br clear="none"> printVarSummary(time0) ; before<br clear="none"><br clear="none">; method 1<br clear="none"><br clear="none"> time = (/ time+6 /) ; replace values<br clear="none"> <a shape="rect" ymailto="mailto:time@units" href="mailto:time@units">time@units</a> = "hours since 1987-04-13 18:00:00" ; new units<br clear="none"> printVarSummary(time) ; after<br clear="none"><br clear="none">or<br clear="none"><br clear="none">; method 2<br clear="none">; <a shape="rect" href="http://www.ncl.ucar.edu/Document/Functions/Contributed/cd_convert.shtml" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Contributed/cd_convert.shtml</a><br clear="none"><br clear="none"> time = cd_convert( time0, "hours since 1987-04-13 18:00:00" )<br clear="none"><br clear="none">; print to make sure they are as you expect<br clear="none"><br clear="none"> print("-----")<br clear="none"> print(time0+" "+time) ; examine before and after values<br clear="none"><br clear="none">====<br clear="none"> If all is ok the use the "w" on the addfile and then overwrite<br clear="none"><br clear="none"> f->time = time<br clear="none"><br clear="none">=================================<br clear="none"><br clear="none">I'd make a copy of the file before doing anything ... just in case<br clear="none">tehre are errors.<br clear="none"><br clear="none">Good Luck<br clear="none"><div class="yqt5130582994" id="yqtfd42555"><br clear="none">On Fri, Dec 11, 2015 at 4:35 AM, Mark Chan <<a shape="rect" ymailto="mailto:cym263@yahoo.com" href="mailto:cym263@yahoo.com">cym263@yahoo.com</a>> wrote:<br clear="none">> Dear NCL group,<br clear="none">><br clear="none">> I am wondering whether there is any easy method with NCL to modify "internal<br clear="none">> Times" of the netcdf file: (the file name would be changed later)<br clear="none">><br clear="none">> from: met_em_d01_1987-04-13_12:00:00<br clear="none">><br clear="none">> To: met_em_d01_1987-04-13_18:00:00<br clear="none">><br clear="none">> So the time could be shown as (with "ncdump -v Times")<br clear="none">> Times = "1978-04-13_18:00:00" ;<br clear="none">><br clear="none">> Thanks very much in advance!!!<br clear="none">> Mark</div><br clear="none">><br clear="none">> _______________________________________________<br clear="none">> ncl-talk mailing list<br clear="none">> <a shape="rect" ymailto="mailto:ncl-talk@ucar.edu" href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br clear="none">> List instructions, subscriber options, unsubscribe:<br clear="none">> <a shape="rect" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><div class="yqt5130582994" id="yqtfd84390"><br clear="none">><br clear="none"></div><br><br></div> </div> </div> </div></div></body></html>