<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi Adam,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Thank you for the suggestion, I am posting the actual code that worked for me in range of some real data here:</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div><br>
<div><br>
;------------------------------------------</div>
begin<br>
<br>
yrStrt = 1900<br>
yrLast = 1999<br>
<br>
f      = addfile ("TS_ts_100yr.nc", "r")<br>
TIME   = f->TIME<br>
YYYY   = cd_calendar(TIME,-1)/100       <br>
iYYYY  = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast)<br>
x    = dble2flt(f->SST(iYYYY,0))<br>
printVarSummary(x)    <br>
<br>
x_time = fspan(yrStrt,yrLast,(yrLast-yrStrt+1)) <br>
x_time!0 = "time"<br>
printVarSummary(x_time)<br>
<br>
tNew0 = yyyymm_time(yrStrt,yrLast,"float")<br>
tNew1 = yyyymm_to_yyyyfrac(tNew0,0)   ; creating time in units of fraction to match x&time<br>
printVarSummary(tNew1)<br>
xNew = linint1(x_time,x,True,tNew1,0)<br>
print(xNew)<br>
<br>
end</div>
<p></p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>;------------------------------------------<br>
<br>
</div>
Best regards,
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Hyacinth<br>
</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> Adam Phillips <asphilli@ucar.edu><br>
<b>Sent:</b> 05 February 2018 11:44 PM<br>
<b>To:</b> Hyacinth Nnamchi<br>
<b>Cc:</b> ncl-talk@ucar.edu<br>
<b>Subject:</b> Re: [ncl-talk] Time interpolation problem, annual to monthly</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hi Hyacinth,
<div>Are your x&time and y&time arrays in the same range? The following worked for me:</div>
<div>x = (/1,2,3./)<br>
</div>
<div>x!0 = "time"</div>
<div>x&time = (/1980.5,1981.5,1982.5/) <br>
</div>
<div><br>
</div>
<div>time2 = yyyymm_time(1980,1982,"float")</div>
<div>time3 = yyyymm_to_yyyyfrac(time2,0)   ; creating time in units of fraction to match x&time<br>
</div>
<div>xNew = linint1(x&time,x,False,time3,0)<br>
</div>
<div>
<div>print(xNew)</div>
<div><br>
</div>
<div>Variable: xNew</div>
<div>Type: float</div>
<div>Total Size: 144 bytes</div>
<div>            36 values</div>
<div>Number of Dimensions: 1</div>
<div>Dimensions and sizes:<span style="white-space:pre"> </span>[36]</div>
<div>Coordinates: </div>
<div>Number Of Attributes: 1</div>
<div>  _FillValue :<span style="white-space:pre"> </span>9.96921e+36</div>
<div>(0)<span style="white-space:pre"> </span>9.96921e+36</div>
<div>(1)<span style="white-space:pre"> </span>9.96921e+36</div>
<div>(2)<span style="white-space:pre"> </span>9.96921e+36</div>
<div>(3)<span style="white-space:pre"> </span>9.96921e+36</div>
<div>(4)<span style="white-space:pre"> </span>9.96921e+36</div>
<div>(5)<span style="white-space:pre"> </span>9.96921e+36</div>
<div>(6)<span style="white-space:pre"> </span>1</div>
<div>(7)<span style="white-space:pre"> </span>1.083374</div>
<div>(8)<span style="white-space:pre"> </span>1.166626</div>
<div>(9)<span style="white-space:pre"> </span>1.25</div>
<div>(10)<span style="white-space:pre"> </span>1.333374</div>
<div>(11)<span style="white-space:pre"> </span>1.416626</div>
<div>(12)<span style="white-space:pre"> </span>1.5</div>
<div>(13)<span style="white-space:pre"> </span>1.583374</div>
<div>(14)<span style="white-space:pre"> </span>1.666626</div>
<div>(15)<span style="white-space:pre"> </span>1.75</div>
<div>(16)<span style="white-space:pre"> </span>1.833374</div>
<div>(17)<span style="white-space:pre"> </span>1.916626</div>
<div>(18)<span style="white-space:pre"> </span>2</div>
<div>(19)<span style="white-space:pre"> </span>2.083374</div>
<div>(20)<span style="white-space:pre"> </span>2.166626</div>
<div>(21)<span style="white-space:pre"> </span>2.25</div>
<div>(22)<span style="white-space:pre"> </span>2.333374</div>
<div>(23)<span style="white-space:pre"> </span>2.416626</div>
<div>(24)<span style="white-space:pre"> </span>2.5</div>
<div>(25)<span style="white-space:pre"> </span>2.583374</div>
<div>(26)<span style="white-space:pre"> </span>2.666626</div>
<div>(27)<span style="white-space:pre"> </span>2.75</div>
<div>(28)<span style="white-space:pre"> </span>2.833374</div>
<div>(29)<span style="white-space:pre"> </span>2.916626</div>
<div>(30)<span style="white-space:pre"> </span>3</div>
<div>(31)<span style="white-space:pre"> </span>9.96921e+36</div>
<div>(32)<span style="white-space:pre"> </span>9.96921e+36</div>
<div>(33)<span style="white-space:pre"> </span>9.96921e+36</div>
<div>(34)<span style="white-space:pre"> </span>9.96921e+36</div>
<div>(35)<span style="white-space:pre"> </span>9.96921e+36</div>
</div>
<div><br>
</div>
<div>Hope that helps. If not, or if you have further questions please respond to the ncl-talk email list only.</div>
<div>Adam</div>
</div>
<div class="x_gmail_extra"><br>
<div class="x_gmail_quote">On Mon, Feb 5, 2018 at 11:49 AM, Hyacinth Nnamchi <span dir="ltr">
<<a href="mailto:hyacinth.1@hotmail.com" target="_blank">hyacinth.1@hotmail.com</a>></span> wrote:<br>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div id="x_m_-6679031671610589563divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0">Hi NLCers,</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">I have an annual time series I want to re-interpolate to monthly values. I do this and get the correct size but everything is missing (and setting the @_FillValue and @missingvalue doesn't change result).</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">x  is an annual time series, 80 years</p>
<p style="margin-top:0; margin-bottom:0">y is a monthly time series, 80 years (i.e. 80 x 12 months)<br>
</p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>xNew   = linint1_n(x&time,x,False,y&<wbr>time,0,0)</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>This new time series (xNew) contains all missing values (monthly, 80 years). Defining x&time and y&time outside the equation doesn't change the result.</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>Does anyone know why I'm having the wrong values?</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>Thanks in advance.</span></p>
<span class="x_HOEnZb"><font color="#888888">
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span>Hyacinth<br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span><br>
</span></p>
<p style="margin-top:0; margin-bottom:0"><span></span><br>
</p>
</font></span></div>
</div>
<br>
______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="x_gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div>
<div><span><font color="#888888">Adam Phillips <br>
</font></span></div>
<span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br>
</font></span></div>
</div>
<div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>  
</font></span><span><font color="#888888">303-497-1726 </font></span></div>
<span><font color="#888888"></font></span>
<div>
<div><span><font color="#888888"><br>
</font></span>
<div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>