<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Saurabh,<div class=""><br class=""></div><div class="">I have attached a modified version of your script, “depth_trend_line_mod.ncl”. One major change is that it now checks the output of the regline_stats() function to make sure the result is not a missing value.</div><div class=""><br class=""></div><div class="">The issue I found was that during the first iteration of your loop (i=0), the value returned by regline_stats() contained a missing value and did not have the “b95” attribute.</div><div class=""><br class=""></div><div class="">Also, I chose to explicitly declare temp (“temp = new(1, double)”) before the loop, instead of implicitly declaring it inside the loop (“temp = regline_stats(time,ts(i,:))”). When regline_stats() experiences an error, the value returned is a float instead of a double, which causes issues in later iterations of the loop (with an error such as “fatal:["NclVar.c":1390]:Assignment type mismatch, right hand side can't be coerced to type of left hand side”).</div><div class=""><br class=""></div><div class="">I hope this helps!</div><div class="">Kevin</div><div class=""></div></body></html>