<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Sam,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">This is a very delayed response, but I wanted to let you know that we&#39;ve added a ticket (NCL-2276) for looking into adding a &quot;lowess&quot; function.   We found some C and Fortran versions that we can probably wrap quickly, if they are not too complicated.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 12, 2015 at 10:48 AM, Mary Haley <span dir="ltr">&lt;<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Sam,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I&#39;m not familiar with the &quot;lowess&quot; function in R.  Perhaps if you find this useful, and we can get at the source code, we can add an interface to in NCL?</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I did try the same example using the lspoly function, but I think this would be too smooth for your purposes.  See example interp1d_3.ncl at:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/interp1d.shtml#ex3" target="_blank">http://www.ncl.ucar.edu/Applications/interp1d.shtml#ex3</a><span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 7, 2015 at 3:29 PM, Sam McClatchie (NOAA Federal) <span dir="ltr">&lt;<a href="mailto:sam.mcclatchie@noaa.gov" target="_blank">sam.mcclatchie@noaa.gov</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hello Mary -- Thanks for checking this out. I ran your script and
    the your plots have the same problem that my own script had. Namely,
    changing the tension parameter, sig, has almost no effect on the
    smooth. Perhaps it is the difference between what a physicist and a
    biologist might think of as smoothing ... I&#39;ve attached a plot where
    I use your data to create smooths with different &quot;tension&quot;. Since
    these smooths were created with locally weighted robust regression
    the tension is actually the span, or the proportion of the data used
    for each locally weighted fit. But the effect is what I am after.
    When you adjust the span, or tension, the curve becomes more or less
    smooth. <br>
    <br>
    Here is the R-code:<br>
    # test.smooth.with.Haley.data<br>
    library(RNetCDF, graphics)<br>
    # load Marys test data and plot a subsample<br>
    # ====================================<br>
    nc &lt;- <a href="http://open.nc" target="_blank">open.nc</a>(&quot;<a href="http://TestData.xy3.nc" target="_blank">TestData.xy3.nc</a>&quot;)<br>
    dat &lt;- <a href="http://read.nc" target="_blank">read.nc</a>(nc)<br>
    print(summary(dat))<br>
    yi &lt;- dat$T[1:36]<br>
    <br>
    # fit a lowess smooth with differing spans<br>
    # equivalent to tension on a smooth<br>
    # ========================================<br>
    pdf(&quot;test.smooth.pdf&quot;)<br>
    plot(yi, type=&quot;b&quot;, ylab=&quot;Temperature&quot;)<br>
    i &lt;- seq(1,36,1)<br>
    d &lt;- cbind(i,yi)<br>
    span &lt;- seq(0.1,0.5,0.1)<br>
    c &lt;- seq(1,5,1)<br>
    for(k in 1:length(span)) {<br>
        lines(lowess(d, f=span[k]), col=c[k])<br>
    }<br>
    graphics.off()<br>
    <br>
    Best fishes<span><font color="#888888"><br>
    Sam</font></span><div><div><br>
    <br>
    <div>On 08/07/2015 12:13 PM, Mary Haley
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_default" style="font-size:small">Sam,</div>
        <div class="gmail_default" style="font-size:small"><br>
        </div>
        <div class="gmail_default" style="font-size:small">Here&#39;s a
          slightly better example, that uses dummy data read off a
          NetCDF file. The script is pretty much the same, except I
          changed the data and added more tension factors to test. I
          also created a panel plot for comparison.</div>
        <div class="gmail_default" style="font-size:small"><br>
          I&#39;ve also added this example to our 1D interpolators page:</div>
        <div class="gmail_default" style="font-size:small"><br>
        </div>
        <div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/interp1d.shtml#ex3" target="_blank">http://www.ncl.ucar.edu/Applications/interp1d.shtml#ex3</a><br>
        </div>
        <div class="gmail_default"><br>
        </div>
        <div class="gmail_default" style="font-size:small">--Mary</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Fri, Aug 7, 2015 at 12:43 PM, Mary
          Haley <span dir="ltr">&lt;<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div class="gmail_default" style="font-size:small">Hi Sam,</div>
              <div class="gmail_default" style="font-size:small"><br>
              </div>
              <div class="gmail_default" style="font-size:small">It
                appears you are using the parameter correctly.</div>
              <div class="gmail_default" style="font-size:small"><br>
              </div>
              <div class="gmail_default" style="font-size:small">Please
                try running the attached example, which shows a simple
                XY plot, and different tension factors using the &quot;sig&quot;
                parameter with ftcurv.</div>
              <div class="gmail_default" style="font-size:small"><br>
              </div>
              <div class="gmail_default" style="font-size:small">If this
                doesn&#39;t shine a light on the problem at your end, then
                can you provide us with a script and the data?</div>
              <div class="gmail_default" style="font-size:small"><br>
              </div>
              <div class="gmail_default" style="font-size:small">--Mary</div>
              <div class="gmail_default" style="font-size:small"><br>
              </div>
            </div>
            <div class="gmail_extra"><br>
              <div class="gmail_quote">
                <div>
                  <div>On Tue, Aug 4, 2015 at 5:07 PM, Sam
                    McClatchie (NOAA Federal) <span dir="ltr">&lt;<a href="mailto:sam.mcclatchie@noaa.gov" target="_blank"></a><a href="mailto:sam.mcclatchie@noaa.gov" target="_blank">sam.mcclatchie@noaa.gov</a>&gt;</span>
                    wrote:<br>
                  </div>
                </div>
                <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  <div>
                    <div>
                      <div bgcolor="#FFFFFF" text="#000000"> Colleagues<br>
                        <br>
                        I want to put a smooth line through a
                        de-seasonalized time series that shows a trend
                        and residual variability. I&#39;m having trouble
                        adjusting the tension of the smooth which I
                        think needs to be less than one. I would like
                        the overlaid smooth curve to be much more smooth
                        than the data, but I&#39;m basically getting a high
                        order polynomial smooth at present. <br>
                        <br>
                        Here is a snip of code:<br>
                        <br>
                        (Note: the xyplot tsplots(2) was previously
                        defined)<br>
                        <br>
                        xi = (/spice_ts_ss&amp;time/)<br>
                        yi = monthly_anom(:,0,0)<br>
                        xo = fspan(1985., 2015., 200)<br>
                        ftsetp(&quot;sig&quot;,0.5)<br>
                        yo = ftcurv(xi,yi,xo)<br>
                        <br>
                        colors = (/&quot;red&quot;,&quot;green&quot;,&quot;blue&quot;/)<br>
                        resplot@xyLineColor   = colors(0)<br>
                        tsplots(3)  = gsn_csm_xy (wks,xo,yo,resplot)<br>
                        overlay(tsplots(2), tsplots(3))<br>
                        <br>
                        Changing the value of the sig parameter in
                        ftsetp between 0.1 to 40 seems to have no
                        effect, which suggests that I am misusing
                        something?<br>
                        <br>
                        Thanks in advance,<br>
                        Sam<span><font color="#888888"><br>
                            <div>-- <br>
                              Sam McClatchie, <br>
                              Supervisory oceanographer, <br>
                              NOAA lead for the CalCOFI program <br>
                              Southwest Fisheries Science Center, NOAA, 
                              <br>
                              8901 La Jolla Shores Dr.  <br>
                              La Jolla, CA 92037-1509, U.S.A. <br>
                              email <a href="mailto:Sam.McClatchie@noaa.gov" target="_blank">&lt;Sam.McClatchie@noaa.gov&gt;</a>
                              <br>
                              Office: <a href="tel:858%20546%207083" value="+18585467083" target="_blank">858
                                546 7083</a>, Cellular:  <a href="tel:858%20752%208495" value="+18587528495" target="_blank">858
                                752 8495</a> <br>
                              Research home page &lt;<a href="http://www.fishocean.info" target="_blank"></a><a href="http://www.fishocean.info" target="_blank">www.fishocean.info</a>&gt;<br>
                              <img style="width:150px;min-height:149px" alt="CalCOFI 66 years" src="cid:part8.00000309.00020007@noaa.gov"><br>
                            </div>
                          </font></span></div>
                      <br>
                    </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><br>
                  <br>
                </blockquote>
              </div>
              <br>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
    <div>-- <br>
      
      
      Sam McClatchie,
      <br>
      Supervisory oceanographer, <br>
      NOAA lead for the CalCOFI program <br>
      Southwest Fisheries Science Center, NOAA, 
      <br>
      8901 La Jolla Shores Dr. 
      <br>
      La Jolla, CA 92037-1509, U.S.A.
      <br>
      email <a href="mailto:Sam.McClatchie@noaa.gov" target="_blank">&lt;Sam.McClatchie@noaa.gov&gt;</a>
      <br>
      Office: <a href="tel:858%20546%207083" value="+18585467083" target="_blank">858 546 7083</a>, Cellular:  <a href="tel:858%20752%208495" value="+18587528495" target="_blank">858 752 8495</a>
      <br>
      Research home page &lt;<a href="http://www.fishocean.info" target="_blank">www.fishocean.info</a>&gt;<br>
      <img style="width:150px;min-height:149px" alt="CalCOFI 66 years" src="cid:part11.02030307.04060107@noaa.gov"><br>
    </div>
  </div></div></div>

</blockquote></div><br></div>
</div></div></blockquote></div><br></div>