<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="">
<div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi Dennis,</div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<br class="">
</div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Thanks for your help, now I got a grip of how and why the error was caused. I really appreciate your time invested into that.</div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<br class="">
</div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
The thing is that what I had in mind writing this code is that I could apply the MLR from the 1D regressors to the lev*lat variable I have, in order to plot the partial regression coefficients as a function of latitude/height.</div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<br class="">
</div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Any idea on how to achieve that?</div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<br class="">
</div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Cheers,</div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Andreas</div>
</div>
</div>
</div>
</div>
</div>
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 14 Nov 2017, at 20:51, Dennis Shea <<a href="mailto:shea@ucar.edu" class="">shea@ucar.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class="">Well, one big issues is the the most northerly latitude and all latitudes poleward of 60S were all _FillValue (missing).<br class="">
<br class="">
 <b class="">LATN</b>   =  80.0     ; avoid regions 'loaded' with missing values<br class="">
 <b class="">LATS </b>  = -60.0<br class="">
...<br class="">
<br class="">
  do nf = 0, nfili-1<br class="">
     ff1    = addfile(diri+fili(nf), "r")<br class="">
     wstar  = ff1->$varname$(ntStrt:ntLast,:,<b class="">{LATN:LATS}</b>,0) ; 'lon' is degenerate; ignore<br class="">
                                                            ; ff1->$varname$(ntStrt:ntLast,:,:,:)<br class="">
</div>
[SNIP]<br class="">
<br class="">
====<br class="">
</div>
<div class=""><span style="color:rgb(255,0,0)" class=""><b class="">I reworked the code 'a bit.'</b></span><br class="">
</div>
<span style="color:rgb(255,0,0)" class=""><span style="background-color:rgb(255,0,0)" class=""><b class=""><span style="background-color:rgb(243,243,243)" class=""><span style="" class=""></span></span></b></span></span><br class="">
</div>
<br class="">
Your 'double <b class="">do</b>' creates a multiple linear regression for each iteration<br class="">
<div class=""><br class="">
  nf = 0<br class="">
  do gg = 0,klev-1<br class="">
      do hh = 0,nlat-1<br class="">
         ;test = reg_multlin_stats(nies3(:,gg,hh),NIES2,0)    ; original code<br class="">
          test = reg_multlin_stats(WSS(nf,:,gg,hh),NIES2,0)<br class="">
          printVarSummary(test)<br class="">
      end do<br class="">
  end do<br class="">
<br class="">
<div class="">
<div class="">Good Luck<br class="">
</div>
<div class="">D<br class="">
</div>
</div>
</div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Thu, Nov 9, 2017 at 6:50 AM, Andreas Chrysanthou <span dir="ltr" class="">
<<a href="mailto:eeac@leeds.ac.uk" target="_blank" class="">eeac@leeds.ac.uk</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="">Hi Dennis,
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">Now I get the error: </div>
<div class=""><br class="">
</div>
<div class=""><i class="">fatal:divide: Division by 0, Can't continue</i></div>
<i class="">fatal:Div: operator failed, can't continue</i>
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">I’ve put the data and the script In the ftp as per your instructions. You can find them under the names: </div>
<div class=""><br class="">
</div>
<div class="">pp_wstar_refC1SD.zip (input diri in my code)</div>
<div class="">regressors_refC1SD.zip (input diri2 in my code)</div>
<div class="">mlr.ncl</div>
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">Cheers,</div>
<div class="">
<div class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class="">
<div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class="">
<div class="">Andreas</div>
<div class=""><br class="">
</div>
<div class=""></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="">
<div class="h5"><br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On 9 Nov 2017, at 02:59, Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank" class="">shea@ucar.edu</a>> wrote:</div>
<br class="m_5761278452585003705Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">Hello,<br class="">
<br class="">
</div>
I can see where the error message came from:<br class="">
<br class="">
function reg_multlin_stats(Y[*]:<wbr class="">numeric, XP:numeric, opt)<br class="">
</div>
[SNIP]<br class="">
<div class="">       if (isatt(Y,"_FillValue")  .and. any(ismissing(Y))) then<br class="">
           print("reg_multlin_stats: Y has missing values. Not allowed!")<br class="">
           exit<br class="">
       end if<br class="">
</div>
<div class="">[SNIP]<br class="">
<br class="">
</div>
<div class="">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 class="">
<br class="">
<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/reg_multlin.shtml" target="_blank" class="">https://www.ncl.ucar.edu/<wbr class="">Document/Functions/Built-in/<wbr class="">reg_multlin.shtml</a><br class="">
<br class="">
===========================<br class="">
<br class="">
</div>
<div class="">Can you please send a clean, 'minimalistic' script that yields the error message?<br class="">
<br class="">
</div>
<div class="">Small files can be attached to the reply. If the data file is large, please use ftp:<br class="">
<br class="">
</div>
<div class="">ftp <a href="http://ftp.cgd.ucar.edu/" target="_blank" class="">ftp.cgd.ucar.edu</a><br class="">
</div>
<div class="">anonymous<br class="">
</div>
<div class="">your_email<br class="">
</div>
<div class="">cd incoming<br class="">
</div>
<div class="">put ....<br class="">
</div>
<div class="">put ...<br class="">
</div>
<div class="">quit<br class="">
<br class="">
</div>
<div class="">After successful transfer, send an email indicating the name(s) of the files.<br class="">
<br class="">
</div>
<div class="">Regards <br class="">
</div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Wed, Nov 8, 2017 at 7:10 AM, Andreas Chrysanthou <span dir="ltr" class="">
<<a href="mailto:eeac@leeds.ac.uk" target="_blank" class="">eeac@leeds.ac.uk</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="">Hi NCL users,
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">The error I’m getting is <i class="">"reg_multlin_stats: Y has missing values. Not allowed!”</i></div>
<div class=""><i class=""><br class="">
</i></div>
<div class="">PrintVarSummary of the variables I’m using is just below, whereas a snippet of the script is following after that. </div>
<div class=""><br class="">
</div>
<div class="">Any ideas on how to get round this problem?</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""><i class="">Variable: WSTAR<br class="">
Type: float<br class="">
Number of Dimensions: 4<br class="">
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 class=""><i class="">standardize_op_ncl :<span class="m_5761278452585003705m_1363640846215022689Apple-tab-span" style="white-space:pre-wrap">
</span>dim_standardize_n over dimension(s): year<br class="">
NCL :<span class="m_5761278452585003705m_1363640846215022689Apple-tab-span" style="white-space:pre-wrap">
</span>month_to_annual<br class="">
actual_range :<span class="m_5761278452585003705m_1363640846215022689Apple-tab-span" style="white-space:pre-wrap">
</span>( -0.6522911, 1e+20 )</i></div>
<div class=""><i class=""><br class="">
</i></div>
<div class=""><i class=""><br class="">
Variable: NIES2<br class="">
Type: float<br class="">
Number of Dimensions: 2<br class="">
Dimensions and sizes:<span class="m_5761278452585003705m_1363640846215022689Apple-tab-span" style="white-space:pre-wrap">
</span>[year | 31] x [reg_index | 5]<br class="">
Number Of Attributes: 3<br class="">
_FillValue :<span class="m_5761278452585003705m_1363640846215022689Apple-tab-span" style="white-space:pre-wrap">
</span>1e+20<br class="">
NCL :<span class="m_5761278452585003705m_1363640846215022689Apple-tab-span" style="white-space:pre-wrap">
</span>month_to_annual<br class="">
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 class="">
<br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">NIES1  = new ( (/5,31/), "float" )  </div>
<div class="">    NIES1(0,:) = reg(0,{1980:2010},0)</div>
<div class="">    NIES1(1,:) = reg(0,{1980:2010},1)</div>
<div class="">    NIES1(2,:) = reg(0,{1980:2010},2)</div>
<div class="">    NIES1(3,:) = reg(0,{1980:2010},3)</div>
<div class="">    NIES1(4,:) = reg(0,{1980:2010},4)</div>
<div class=""><br class="">
</div>
<div class="">NIES1!0 = "reg_index"</div>
<div class="">NIES2   = NIES1(year|:,reg_index|:)</div>
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">nies = WSTAR(0,:,:,:)</div>
<div class="">test_ = test(0,:,:)</div>
</div>
<div class=""><br class="">
</div>
<div class="">do gg = 0,dimsizes(WS_&lev)-1</div>
<div class="">    do hh = 0,dimsizes(WS_&lat)-1</div>
<div class="">        test_(gg,hh) = reg_multlin_stats(nies(:,gg,hh<wbr class="">),NIES2,0)</div>
<div class="">    end do</div>
<div class="">end do</div>
</div>
<div class=""><br class="">
</div>
<div class="">Cheers,<br class="">
<div class="">
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word" class="">
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word" class="">
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word" class="">
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word" class="">
<div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word" class="">
<div class="">Andreas</div>
<div class="">---</div>
<div class=""><br class="">
</div>
<div class=""></div>
</div>
</div>
</div>
</div>
</div>
</div>
<br class="">
</div>
</div>
<br class="">
______________________________<wbr class="">_________________<br class="">
ncl-talk mailing list<br class="">
<a href="mailto:ncl-talk@ucar.edu" target="_blank" class="">ncl-talk@ucar.edu</a><br class="">
List instructions, subscriber options, unsubscribe:<br class="">
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank" class="">http://mailman.ucar.edu/mailma<wbr class="">n/listinfo/ncl-talk</a><br class="">
<br class="">
</blockquote>
</div>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
<br class="">
______________________________<wbr class="">_________________<br class="">
ncl-talk mailing list<br class="">
<a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class="">
List instructions, subscriber options, unsubscribe:<br class="">
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank" class="">http://mailman.ucar.edu/<wbr class="">mailman/listinfo/ncl-talk</a><br class="">
<br class="">
</blockquote>
</div>
<br class="">
</div>
<span id="cid:43811E53-DAEA-4D20-ADC8-1E260EC6E22C"><mlr.ncl></span></div>
</blockquote>
</div>
<br class="">
</body>
</html>