<div dir="ltr"><div><div><div><div><div>I would suggest the Lanczos filter:<br> <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/filwgts_lanczos.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>Document/Functions/Built-in/<wbr>filwgts_lanczos.shtml</a><br><br></div>See also:<br> <a href="https://www.ncl.ucar.edu/Applications/filter.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>Applications/filter.shtml</a><br><br>---<br></div>Attached are two scripts that were modified from the above URL.<br><br></div><div>(a) filters_8.ncl: This illustrates the response functions for specified numbers of weights and sigma factors<br></div><div><br></div>(b) filters_2_soi.ncl: An application to a time series of the Southern Oscillation Index (SOI).<br><br>---<br></div>The filter does 'lose; data at the beginning and end. <br><br>=======================<br></div>Your script should look like:<br><br> a = addfile(“<a href="http://sst.nc" target="_blank">sst.nc</a>”,”r”)
<div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">
sst = a->sst <span class="m_-414554749888257200gmail-m_-982242816885530903Apple-tab-span" style="white-space:pre-wrap"> </span>;; [time | 1920] x [lat | 90] x [lon | 180]<br><br></div><div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)"> ihp = 0<br></div>
<div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">
sigma = 1.0<br></div><div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)"> fca = 1.0/(9*12)<br></div>
<div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">
nwt = ... your choice ...<span class="m_-414554749888257200gmail-m_-982242816885530903Apple-tab-span" style="white-space:pre-wrap"></span><br></div>
<div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)"> <span class="m_-414554749888257200gmail-m_-982242816885530903Apple-tab-span" style="white-space:pre-wrap"><br> Wgts = filwgts_lanczos (nwt, ihp, fca, -999., sigma ) <br><br></span></div><div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)"><span class="m_-414554749888257200gmail-m_-982242816885530903Apple-tab-span" style="white-space:pre-wrap"> end_pts = 0<br></span></div>
<div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">
sst_filter = wgt_runave_n_Wrap(sst, Wgts, end_pts, 0)<br></div><div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)"> printVarSummary(sst_filter)<br><br>========================<br><br></div><div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">wgt_runave_n does not require the data to be reordered.<br><br></div><div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">end_pts: how to handle 'end' values: 0 or 1 ... not -1.<br></div><div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">0 ... lose data at ends<br></div><div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">1 ... reflective end values but may not be appropriate<br></div><div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)"><br></div><div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)">Good luck<br></div><div style="margin:0px;line-height:normal;font-family:"Helvetica Neue";color:rgb(69,69,69)"><br> <span class="m_-414554749888257200gmail-m_-982242816885530903Apple-tab-span" style="white-space:pre-wrap"> </span> <br></div> <div><div><br><br><br><br><div> <br><div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 9, 2017 at 11:49 AM, Zhang, Wei <span dir="ltr"><<a href="mailto:wei.zhang@rsmas.miami.edu" target="_blank">wei.zhang@rsmas.miami.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">
<div>
<div><span style="color:rgb(69,69,69);font-family:'Helvetica Neue'">Hi all, </span></div>
<div>
<div style="word-wrap:break-word">
<div>
<div>
<div>
<div>
<div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69);min-height:14px">
<br>
</div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69)">
I have a monthly SST dataset, how can I obtain a 9-year low pass gaussian filtered SST in ncl. I think the Gaussian function *filwgts_normal* could work and my code is as below. Is it correct? If not, how can I deal with that? </div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69);min-height:14px">
<br>
</div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69)">
a = addfile(“<a href="http://sst.nc" target="_blank">sst.nc</a>”,”r”)</div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69)">
sst = a->sst <span class="m_-394557520096914264Apple-tab-span" style="white-space:pre-wrap"> </span>;; [time | 1920] x [lat | 90] x [lon | 180]</div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69)">
sigma = 1.0</div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69)">
nwt = 9*12<span class="m_-394557520096914264Apple-tab-span" style="white-space:pre-wrap"> </span>;; 9 year</div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69)">
Wgts = filwgts_normal(nwt, sigma, 0)<span class="m_-394557520096914264Apple-tab-span" style="white-space:pre-wrap">
</span>; gaussian weight. </div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69)">
sst_filter = wgt_runave_Wrap(sst(lat|:,lon|<wbr>:,time|:),Wgts,0) <span class="m_-394557520096914264Apple-tab-span" style="white-space:pre-wrap">
</span>; 108 points running average </div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69);min-height:14px">
<br>
</div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69)">
I greatly appreciate it if anyone could help. Thanks. </div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div><br class="m_-394557520096914264webkit-block-placeholder">
</div>
<div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69)">
------------------------------<wbr>-------</div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69)">
Wei Zhang</div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69)">
Ph.D student</div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69)">
University of Miami, Rosenstiel School of Marine and Atmospheric Science</div>
<div style="margin:0px;line-height:normal;font-family:'Helvetica Neue';color:rgb(69,69,69)">
Department of Atmospheric Sciences</div>
</div>
<br>
</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></div>