<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 Adam,
<div class=""><br class="">
</div>
<div class="">You have been very helpful once more, I really appreciate your help. </div>
<div class="">The code now works like a charm and I’m not sure I should have expected the regCoef function to handle those iterations without looping over the other dimensions.</div>
<div class=""><br class="">
</div>
<div class="">Much obliged!</div>
<div class=""><br class="">
</div>
<div class="">Best,</div>
<div class="">Andreas<br class="">
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 1 Sep 2017, at 16:01, Adam Phillips <<a href="mailto:asphilli@ucar.edu" class="">asphilli@ucar.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Hi Andreas,
<div class="">When I tested things here my returned array is all 0's with the exception of the entry at index (0,0). I am not sure why that is happening. I was able to get it to work by looping over the the lat and lon dimensions though:</div>
<div class="">
<div class="">finarr = acceldivf_(0,:,:)<br class="">
</div>
<div class="">do gg = 0,dimsizes(acceldivf_&lat)-1<br class="">
</div>
<div class=""> do hh = 0,dimsizes(acceldivf_&lon)-1<br class="">
</div>
<div class=""> finarr(gg,hh) = (/ regCoef(acceldivf_(:,gg,hh),mass_flux) /)<br class="">
</div>
<div class=""> end do</div>
<div class="">end do</div>
</div>
<div class=""><br class="">
</div>
<div class="">Adam</div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Fri, Sep 1, 2017 at 8:30 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 Adam,
<div class=""><br class="">
</div>
<div class="">Seemingly that does it, but with a downside. The values of rc are all zeros now.</div>
<div class=""><br class="">
</div>
<div class="">Cheers,</div>
<div class="">Andreas<br class="">
<br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On 1 Sep 2017, at 15:19, Adam Phillips <<a href="mailto:asphilli@ucar.edu" target="_blank" class="">asphilli@ucar.edu</a>> wrote:</div>
<br class="m_4694769844525639250Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Hi Andreas,
<div class="">In that case then I would use conform on your mass_flux array to match its' dimensions to your acceldivf_ array:</div>
<div class="">rc= regCoef_n (acceldivf_, conform(acceldivf_,mass_flux,(<wbr class="">/0/)), 0, 0) </div>
<div class="">Adam</div>
<div class=""><br class="">
</div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Fri, Sep 1, 2017 at 8:14 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 Adam,
<div class=""><br class="">
</div>
<div class="">I did that beforehand just to test it and it works normally producing an array with the desired output. </div>
<div class="">But the problem is that the regression coefficients units (y/x) that I want to have as output should be when the 1D var is y and the 3D var is x.</div>
<div class=""><br class="">
</div>
<div class="">Cheers,</div>
<div class="">Andreas</div>
<div class=""><br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On 1 Sep 2017, at 15:03, Adam Phillips <<a href="mailto:asphilli@ucar.edu" target="_blank" class="">asphilli@ucar.edu</a>> wrote:</div>
<br class="m_4694769844525639250m_-2342631110320989224Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Hi Andreas,
<div class="">I think the error message is trying to tell you that you should switch your two input arrays. (The 2nd input array must have as many or more dimensions as the 1st one.) If switching the two arrays doesn't help let ncl-talk know..</div>
<div class="">Adam</div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Fri, Sep 1, 2017 at 7:06 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 want to calculate the regression coefficients of variable with 1 dimension (y= mass_flux) against another which has 3 dimensions (x = acceldivf_).</div>
<div class=""><br class="">
</div>
<div class="">Typically, according to the description of the regCoef_n (x, y, dims_x, dims_y) NCL function x and y can be arrays of any dimensionality but the dims_x and dims_x and dims_y is an integer indicating which dimension of x/y to do the calculation
on, as long as it has the same number of elements.</div>
<div class=""><br class="">
</div>
<div class="">The error I’m getting is the following: <i class="">fatal:regCoef_n: The input array y must have as many or more dimensions than x </i></div>
<div class=""><br class="">
</div>
<div class="">PrintVarSummary of both variables follows:</div>
<div class=""><br class="">
</div>
<div class=""><i class="">Variable: mass_flux<br class="">
Type: float<br class="">
Total Size: 564 bytes<br class="">
141 values<br class="">
Number of Dimensions: 1<br class="">
Dimensions and sizes:<span class="m_4694769844525639250m_-2342631110320989224m_3213111806444122374Apple-tab-span" style="white-space:pre-wrap">
</span>[time | 141]<br class="">
Coordinates: <br class="">
time: [1960..2100]<br class="">
Number Of Attributes: 1<br class="">
_FillValue :<span class="m_4694769844525639250m_-2342631110320989224m_3213111806444122374Apple-tab-span" style="white-space:pre-wrap">
</span>1e+20</i></div>
<div class=""><i class=""><br class="">
</i></div>
<div class="">
<div class=""><i class="">Variable: acceldivf_</i></div>
<div class=""><i class="">Type: float<br class="">
Total Size: 839232 bytes<br class="">
209808 values<br class="">
Number of Dimensions: 3<br class="">
Dimensions and sizes:<span class="m_4694769844525639250m_-2342631110320989224m_3213111806444122374Apple-tab-span" style="white-space:pre-wrap">
</span>[time | 141] x [lev | 31] x [lat | 48]<br class="">
Coordinates: <br class="">
time: [1960..2100]<br class="">
lev: [1000.. 0.1]<br class="">
lat: [-87.15909445302286..87.159094<wbr class="">45302286]</i></div>
<br class="">
</div>
<div class="">So it fails with the above fatal error when I try:</div>
<div class=""><br class="">
</div>
<div class="">rc= regCoef_n (acceldivf_, mass_flux, 0, 0) </div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Any ideas please?</div>
<div class=""><br 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>
<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="">
<br clear="all" class="">
<span class="m_4694769844525639250HOEnZb"><font color="#888888" class="">
<div class=""><br class="">
</div>
-- <br class="">
<div class="m_4694769844525639250m_-2342631110320989224gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class=""><span class=""><font color="#888888" class="">Adam Phillips <br class="">
</font></span></div>
<span class=""><font color="#888888" class="">Associate Scientist, </font></span><span class=""><font color="#888888" class="">Climate and Global Dynamics Laboratory, NCAR<br class="">
</font></span></div>
</div>
<div class=""><span class=""><font color="#888888" class=""><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank" class="">www.cgd.ucar.edu/staff/asphill<wbr class="">i/</a>
</font></span><span class=""><font color="#888888" class=""><a href="tel:(303)%20497-1726" value="+13034971726" target="_blank" class="">303-497-1726</a>
</font></span></div>
<span class=""><font color="#888888" class=""></font></span>
<div class="">
<div class=""><span class=""><font color="#888888" class=""><br class="">
</font></span>
<div class=""><span class=""><font color="#888888" class=""><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank" class=""></a></font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</font></span></div>
</div>
</blockquote>
</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="">
<br clear="all" class="">
<span class="HOEnZb"><font color="#888888" class="">
<div class=""><br class="">
</div>
-- <br class="">
<div class="m_4694769844525639250gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class=""><span class=""><font color="#888888" class="">Adam Phillips <br class="">
</font></span></div>
<span class=""><font color="#888888" class="">Associate Scientist, </font></span><span class=""><font color="#888888" class="">Climate and Global Dynamics Laboratory, NCAR<br class="">
</font></span></div>
</div>
<div class=""><span class=""><font color="#888888" class=""><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank" class="">www.cgd.ucar.edu/staff/<wbr class="">asphilli/</a>
</font></span><span class=""><font color="#888888" class=""><a href="tel:(303)%20497-1726" value="+13034971726" target="_blank" class="">303-497-1726</a>
</font></span></div>
<span class=""><font color="#888888" class=""></font></span>
<div class="">
<div class=""><span class=""><font color="#888888" class=""><br class="">
</font></span>
<div class=""><span class=""><font color="#888888" class=""><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank" class=""></a></font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</font></span></div>
</div>
</blockquote>
</div>
<br class="">
</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="">
<br clear="all" class="">
<div class=""><br class="">
</div>
-- <br class="">
<div class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class=""><span class=""><font color="#888888" class="">Adam Phillips <br class="">
</font></span></div>
<span class=""><font color="#888888" class="">Associate Scientist, </font></span><span class=""><font color="#888888" class="">Climate and Global Dynamics Laboratory, NCAR<br class="">
</font></span></div>
</div>
<div class=""><span class=""><font color="#888888" class=""><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank" class="">www.cgd.ucar.edu/staff/asphilli/</a>
</font></span><span class=""><font color="#888888" class="">303-497-1726 </font></span></div>
<span class=""><font color="#888888" class=""></font></span>
<div class="">
<div class=""><span class=""><font color="#888888" class=""><br class="">
</font></span>
<div class=""><span class=""><font color="#888888" class=""><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank" class=""></a></font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>