<div dir="ltr">oh! Thank you for the clarification. <br><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>---<br></div><div><font size="2"><span>Kunal <br></span></font></div><br><div><br></div><div><p style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 19, 2020 at 1:31 PM Rashed Mahmood <<a href="mailto:rashidcomsis@gmail.com">rashidcomsis@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>The function is returning year so that is why you get years as title:</div><div><span style="color:rgb(255,0,0)">return(<b>year</b>) ;-- return only year string</span></div><div><br></div><div>You can change above inside the function getDate to;</div><div><b><span style="color:rgb(0,0,255)">return(str_date)</span></b></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 19, 2020 at 8:49 AM Kunal Bali via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Dear NCL users,</div><div><br></div><div>I have a file with monthly data (24-time steps). <br></div><div>2016-01-01 00:00:00</div><div>2016-02-01 00:00:00</div><div>2016-03-01 00:00:00</div><div>2016-04-01 00:00:00</div><div>.</div><div>.</div><div>.</div><div>2017-11-01 00:00:00</div><div>2017-12-01 00:00:00</div><div><br></div><div>I am creating 24 separate figures on the basis of the given time (no problem in that).</div><div><br></div><div>Now, I want to set the title (tiMainString) name of each figure according to their Date e.g. <br></div><div>figure 01 with plot title as 2016-01</div><div>figure 02 with plot title as 2016-02</div><div>figure 24 with plot title as 2017-12</div><div><br></div><div>here, I am providing the brief script that I am using which giving the title name only year names such as (2016, 2016, 2016, 2017, 2017,2017 etc)<br></div><div><br></div><div>I am trying as</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>undef ("getDate")<br>function getDate(time)<br>local utc_date, year, mon, day, hours, mins, str_date<br>begin<br> utc_date = cd_calendar(time, 0) <br> year = sprinti("%0.4i",tointeger(utc_date(:,0))) <br> mon = sprinti("%0.2i",tointeger(utc_date(:,1))) <br> day = sprinti("%0.2i",tointeger(utc_date(:,2))) <br> hours = sprinti("%0.2i",tointeger(utc_date(:,3))) <br> mins = sprinti("%0.2i",tointeger(utc_date(:,4))) <br> str_date = year+"-"+mon+"-"+day+" "+hours+":"+mins <br> <br> return(year) ;-- return only year string<br>end</div><div><br></div><div>begin</div><div> a = addfile("/<a href="http://test.nc" target="_blank">test.nc</a>","r")<br> t = a->km<br> time = a ->time</div><div><br></div><div>ntimes = dimsizes(a->km(:,0,0))<br> do i=0,ntimes-1</div><div><br></div><div>res = True<br></div><div><span style="color:rgb(0,0,255)"><b>res@tiMainString = getDate(time(i)) </b></span></div><div><br></div><div><br></div><div>plot = gsn_csm_contour_map(wks,t(0,:,:),res)</div></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>setvalues plot@data<br> "sfDataArray" : (/a->km(i,:,:)/)<br> end setvalues</div><div><br></div><div> maximize_output(wks,False)</div><div> end do</div></blockquote><div><br></div><div> </div><div><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>---<br></div><div><font size="2"><span>Kunal <br></span></font></div><br><div><br></div><div><p style="margin:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<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/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div>