<div dir="ltr"><div dir="ltr">Dear Sir Dennis, NCL-Experts,<div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><div>Thank you so much for the fast response.</div><div><br></div><div>I tried your second suggestion but I am not sure how to remove the cycle (3 harmonics)</div><div><br></div><div><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal">I am attaching my sample data here:</p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal">The code is as follows:</p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:normal"><br></p><div><div>filename = "test_data.csv"</div><div>lines    = asciiread(filename,-1,"string")</div><div>data     = lines(1:)</div><div>rain    = tofloat(str_get_field(data,5,","))</div></div><div>yyyyddd    = toint(str_get_field(data,4,","))<br></div><div><br></div><div>prc1d_ClmDay    = <b>clmDayT</b>(rain, yyyyddd)</div><div>printVarSummary(prc1d_ClmDay )<br></div><div><br></div><div>;remove annual mean</div><div><div>prc1d_AnomDay =<b> calcDayAnomT</b>(rain, yyyyddd, prc1d_ClmDay)<b><br></b></div><div>printVarSummary(prc1d_AnomDay)</div></div></div><div><br></div><div>;Remove seasonal cycle</div><div>prc1d_SmClDay = smthClmDayT(prc1d_AnomDay, yyyyddd,3)</div><div>prc1d_AnomDaySm = <b>calcDayAnomT</b>(prc1d_AnomDay , yyyyddd,prc1d_SmClDay)</div><div><br></div><div><br></div><div>The last part, is that the correct approach for removing the seasonal cycle?</div><div><br></div><div>I will do spectral analysis on this time series. The annual cycle, linear trend (I think can be activated in the specx_anal), and seasonal cycle should be removed.</div><div><br></div><div>-Lyndz</div><div><br></div><div><br></div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Aug 7, 2021 at 9:56 AM Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@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>Not tested</div><div><br></div><div>Explicit approach<br></div><div><br></div><div>   prc1d(time)</div><div>   ntim = dimsizes(prc1d)</div><div>   nlat = 1</div><div>   mlon = 1</div><div><br></div><div>; expand 1D to 3D<br></div><div><br></div><div>   prc3d  = <b>conform_dims</b>((/ntim,nlat,mlon/), prc1d, 0)</div><div>   printVarSummary(prc3d)</div><div><br></div><div>    yyyyddd =</div><div><br></div><div>   prc3d_ClmDay    = <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/clmDayTLL.shtml" target="_blank"><b>clmDayTLL</b></a>(prc3d, yyyyddd)</div><div>   printVarSummary(prc_3d)<br></div><div><br></div><div>   <br></div><div>   prc3d_ClmDay    = <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/clmDayTLL.shtml" target="_blank"><b>clmDayTLL</b></a>(prc3d, yyyyddd)</div><div>   prc3d_Anom   = <b>calcDayAnomTLL</b> (prc3d, yyyyddd, prc3d_ClmDay)</div><div>    :</div><div>    :</div><div>======================</div><div>2nd approach, cleaner and easier</div><div><br></div><div>there are <i>undocumented functions</i>  <b>clmDayT</b>, <b>calcDayAnomT</b></div><div><br></div><div>prc1d_ClmDay    = <b>clmDayT</b>(prc1d, yyyyddd)</div><div>printVarSummary(prc1d_ClmDay )<br></div><div>prc1d_AnomDay =<b> calcDayAnomT</b>(prc1d, yyyyddd, prc1d_ClmDay)<b><br></b></div><div>printVarSummary(prc1d_AnomDay)</div><div><br></div><div>Look at <b>contributed.ncl</b></div><div> search for the above functions if you want<br></div><div><b></b></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Aug 6, 2021 at 12:20 PM Lyndz via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.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 dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Dear NCL-Experts,</div><div><br></div><div>I have daily rainfall data from 1979-2017.</div><div><br></div><div>I would like to:</div><div><br></div><div>[a] Remove the annual cycle</div><div>[b] Then remove the seasonal cycle (3rd harmonics).</div><div><br></div><div>I saw this function in NCL which computes the daily climatology first before getting the anomalies (including smoothed anomalies). </div><div><br></div><div><b><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/calcDayAnomTLL.shtml" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Contributed/calcDayAnomTLL.shtml</a></b></div><div><b><br></b></div><div>But this can only be applied for <b>time x lat x lon data</b>. </div><div><br></div><div>Is there an equivalent function of one-dimationsal (time series) data like this?</div><div>If none, do you have any suggestions on how I can do this in NCL?</div><div><br></div><div><br></div><div>I'll appreciate any help.</div><div><br></div><div>-Lyndz</div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div>