<div dir="ltr"><div><div><div>Well, one big issues is the the most northerly latitude and all latitudes poleward of 60S were all _FillValue (missing).<br><br> <b>LATN</b> = 80.0 ; avoid regions 'loaded' with missing values<br> <b>LATS </b> = -60.0<br>...<br><br> do nf = 0, nfili-1<br> ff1 = addfile(diri+fili(nf), "r")<br> wstar = ff1->$varname$(ntStrt:ntLast,:,<b>{LATN:LATS}</b>,0) ; 'lon' is degenerate; ignore<br> ; ff1->$varname$(ntStrt:ntLast,:,:,:)<br></div>[SNIP]<br><br>====<br></div><div><span style="color:rgb(255,0,0)"><b>I reworked the code 'a bit.'</b></span><br></div><span style="color:rgb(255,0,0)"><span style="background-color:rgb(255,0,0)"><b><span style="background-color:rgb(243,243,243)"><span style=""></span></span></b></span></span><br></div><br>Your 'double <b>do</b>' creates a multiple linear regression for each iteration<br><div><br> nf = 0<br> do gg = 0,klev-1<br> do hh = 0,nlat-1<br> ;test = reg_multlin_stats(nies3(:,gg,hh),NIES2,0) ; original code<br> test = reg_multlin_stats(WSS(nf,:,gg,hh),NIES2,0)<br> printVarSummary(test)<br> end do<br> end do<br><br><div><div>Good Luck<br></div><div>D<br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 9, 2017 at 6:50 AM, Andreas Chrysanthou <span dir="ltr"><<a href="mailto:eeac@leeds.ac.uk" target="_blank">eeac@leeds.ac.uk</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">
Hi Dennis,
<div><br>
</div>
<div>I’ve played around with the code trying to find a way to tackle the missing values problem, so I interpolated my array across every dimension to fill the missing values with normal values.</div>
<div><br>
</div>
<div>Now I get the error: </div>
<div><br>
</div>
<div><i>fatal:divide: Division by 0, Can't continue</i></div>
<i>fatal:Div: operator failed, can't continue</i>
<div><br>
</div>
<div>The error now is caused in line 14687 in the contributed.ncl under the reg_multlin function once more. If you want to replicate the previous error you can just use as Y (dependent variable) the nies variable I’m using in my script.</div>
<div><br>
</div>
<div>I’ve put the data and the script In the ftp as per your instructions. You can find them under the names: </div>
<div><br>
</div>
<div>pp_wstar_refC1SD.zip (input diri in my code)</div>
<div>regressors_refC1SD.zip (input diri2 in my code)</div>
<div>mlr.ncl</div>
<div><br>
</div>
<div>As you can see although the input files are 6 I’m only trying to do the MLR for the first one (NIES).</div>
<div><br>
</div>
<div>Cheers,</div>
<div>
<div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div>Andreas</div>
<div><br>
</div>
<div></div>
</div>
</div>
</div>
</div>
</div>
</div><div><div class="h5">
<br>
<div>
<blockquote type="cite">
<div>On 9 Nov 2017, at 02:59, Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> wrote:</div>
<br class="m_5761278452585003705Apple-interchange-newline">
<div>
<div dir="ltr">
<div>
<div>Hello,<br>
<br>
</div>
I can see where the error message came from:<br>
<br>
function reg_multlin_stats(Y[*]:<wbr>numeric, XP:numeric, opt)<br>
</div>
[SNIP]<br>
<div> if (isatt(Y,"_FillValue") .and. any(ismissing(Y))) then<br>
print("reg_multlin_stats: Y has missing values. Not allowed!")<br>
exit<br>
end if<br>
</div>
<div>[SNIP]<br>
<br>
</div>
<div>The documentation for the underlying fortran subroutine says missing values are allowed. So, maybe I should not have that in the NCL interface. The interface subsequently calls:<br>
<br>
<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/reg_multlin.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>Document/Functions/Built-in/<wbr>reg_multlin.shtml</a><br>
<br>
===========================<br>
<br>
</div>
<div>Can you please send a clean, 'minimalistic' script that yields the error message?<br>
<br>
</div>
<div>Small files can be attached to the reply. If the data file is large, please use ftp:<br>
<br>
</div>
<div>ftp <a href="http://ftp.cgd.ucar.edu/" target="_blank">ftp.cgd.ucar.edu</a><br>
</div>
<div>anonymous<br>
</div>
<div>your_email<br>
</div>
<div>cd incoming<br>
</div>
<div>put ....<br>
</div>
<div>put ...<br>
</div>
<div>quit<br>
<br>
</div>
<div>After successful transfer, send an email indicating the name(s) of the files.<br>
<br>
</div>
<div>Regards <br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Nov 8, 2017 at 7:10 AM, Andreas Chrysanthou <span dir="ltr">
<<a href="mailto:eeac@leeds.ac.uk" target="_blank">eeac@leeds.ac.uk</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">Hi NCL users,
<div><br>
</div>
<div>I’ve bumped into some missing values in my independent variable while trying to do a multiple linear regression analysis with reg_multin_stats function.</div>
<div><br>
</div>
<div>I want to produce lat/height plots (levxlat) of the predictors for the 31 years of my time series after the MLR as well as look at the Yest from those in terms of its spatial patterns.</div>
<div><br>
</div>
<div>The error I’m getting is <i>"reg_multlin_stats: Y has missing values. Not allowed!”</i></div>
<div><i><br>
</i></div>
<div>PrintVarSummary of the variables I’m using is just below, whereas a snippet of the script is following after that. </div>
<div><br>
</div>
<div>Any ideas on how to get round this problem?</div>
<div><br>
</div>
<div>
<div><i>Variable: WSTAR<br>
Type: float<br>
Number of Dimensions: 4<br>
Dimensions and sizes:<span class="m_5761278452585003705m_1363640846215022689Apple-tab-span" style="white-space:pre-wrap">
</span>[model | 6] x [year | 31] x [lev | 31] x [lat | 64]</i></div>
<div><i>standardize_op_ncl :<span class="m_5761278452585003705m_1363640846215022689Apple-tab-span" style="white-space:pre-wrap">
</span>dim_standardize_n over dimension(s): year<br>
NCL :<span class="m_5761278452585003705m_1363640846215022689Apple-tab-span" style="white-space:pre-wrap">
</span>month_to_annual<br>
actual_range :<span class="m_5761278452585003705m_1363640846215022689Apple-tab-span" style="white-space:pre-wrap">
</span>( -0.6522911, 1e+20 )</i></div>
<div><i><br>
</i></div>
<div><i><br>
Variable: NIES2<br>
Type: float<br>
Number of Dimensions: 2<br>
Dimensions and sizes:<span class="m_5761278452585003705m_1363640846215022689Apple-tab-span" style="white-space:pre-wrap">
</span>[year | 31] x [reg_index | 5]<br>
Number Of Attributes: 3<br>
_FillValue :<span class="m_5761278452585003705m_1363640846215022689Apple-tab-span" style="white-space:pre-wrap">
</span>1e+20<br>
NCL :<span class="m_5761278452585003705m_1363640846215022689Apple-tab-span" style="white-space:pre-wrap">
</span>month_to_annual<br>
standardize_op_ncl :<span class="m_5761278452585003705m_1363640846215022689Apple-tab-span" style="white-space:pre-wrap">
</span>dim_standardize_n over dimension(s): year</i><br>
<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>NIES1 = new ( (/5,31/), "float" ) </div>
<div> NIES1(0,:) = reg(0,{1980:2010},0)</div>
<div> NIES1(1,:) = reg(0,{1980:2010},1)</div>
<div> NIES1(2,:) = reg(0,{1980:2010},2)</div>
<div> NIES1(3,:) = reg(0,{1980:2010},3)</div>
<div> NIES1(4,:) = reg(0,{1980:2010},4)</div>
<div><br>
</div>
<div>NIES1!0 = "reg_index"</div>
<div>NIES2 = NIES1(year|:,reg_index|:)</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>nies = WSTAR(0,:,:,:)</div>
<div>test_ = test(0,:,:)</div>
</div>
<div><br>
</div>
<div>do gg = 0,dimsizes(WS_&lev)-1</div>
<div> do hh = 0,dimsizes(WS_&lat)-1</div>
<div> test_(gg,hh) = reg_multlin_stats(nies(:,gg,hh<wbr>),NIES2,0)</div>
<div> end do</div>
<div>end do</div>
</div>
<div><br>
</div>
<div>Cheers,<br>
<div>
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word">
<div>Andreas</div>
<div>---</div>
<div><br>
</div>
<div></div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
</div>
</div>
<br>
______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div></div></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></div>