<div dir="ltr"><div><div><div><div><div>The following statement is incorrect.<br><br>===<br>But both NCL and FORTRAN have the array convention of <br>(number of rows, number of columns)<br>===<br><br></div>fortran is column major<br></div>NCL (think C) is row major.<br><br></div>====<br>NCL/Fortramn argument passing<br><br>[1] <br>Arrays need no reordering. The 'rule' is: fastest varying dimension in on language maps into the fastest varying dimension in the otherv language. In NCL, the rightmost dimension is the fastest varying dimension. In Fortran, the leftmost dimension is the fastest varying. <br><br></div><div> NCL Fortran<br> <span style="font-size:25pt;font-family:Arial;color:black"><font size="2">x(</font></span><font size="2"><span style="font-family:Arial;color:black">time,lev,lat,lon</span><span style="font-family:Arial;color:black">)<span> </span><=map=><span>
</span>x(</span><span style="font-family:Arial;color:black">lon,lat,lev,time</span><span style="font-family:Arial;color:black">)</span></font><font size="2"><span style="font-family:Arial;color:blue;font-weight:bold"></span></font><br></div><span style="font-size:29pt;font-family:Arial;color:red;font-weight:bold"></span><span style="font-size:25pt"><span style="color:black;font-family:StarBats;font-size:75%"></span></span><font size="2"><span style="font-family:Arial;color:black"></span></font>
[2] Think of an array as being a long 1D list in memory<br></div><div><br></div> NCL: x(N,M) Fortran(M,N) where M=3, N=2<br><div><div> <br></div><div> memory<br></div><div><font size="2"><span style="font-family:Arial;color:black"><span></span>x(0,0)<span>
</span>=><span> </span>7.23<span> </span><=<span>
</span>x(1,1)</span></font><font size="2"></font><font size="2"><span><span style="color:black;font-family:Wingdings"></span></span><span style="font-family:Arial;color:black"><span> <br></span>x(0,1)<span>
</span>=><span> </span>-12.5<span> </span><=<span>
</span>x(2,1)<br></span></font><font size="2"></font><font size="2"><span style="font-family:Arial;color:black">x(0,2)<span>
</span></span><span style="font-family:Arial;color:black"><span> </span>=><span>
</span>0.3<span> </span><=<span> </span></span><span style="font-family:Arial;color:black"><span></span>x(3,1)</span></font><font size="2"><span style="font-family:Arial;color:black"><span> </span><br><br>x(1,0)<span>
</span>=><span> </span>323.1<span> </span><=<span>
</span>x(1,2)<br></span></font><font size="2"><span style="font-family:Arial;color:black">x(1,1)<span>
</span>=><span> </span>-234.6<span> </span><=<span>
</span>x(2,2)</span></font><font size="2"><span style="font-family:Arial;color:black"><br>x(1,2)<span>
</span>=><span> </span>200.1<span> </span><=<span>
</span>x(3,2)<br></span><span style="font-family:Arial;color:black"></span></font> <br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 18, 2016 at 1:49 AM, Ng, Kelvin Sai-cheong <span dir="ltr"><<a href="mailto:kscng@connect.hku.hk" target="_blank">kscng@connect.hku.hk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi,<br><br></div>I am just wondering why does the
dimension of the input array in NCL (i.e. fxy) has dimension of (n,m),
whereas the array in the FORTRAN function (i.e. FXY) has dimension of (m,n)?<br><br></div>But both NCL and FORTRAN have the array convention of <br>(number of rows, number of columns).<br><br></div><div>Link: <a href="http://www.ncl.ucar.edu/Document/Tools/WRAPIT.shtml#Example_5" target="_blank">http://www.ncl.ucar.edu/Docume<wbr>nt/Tools/WRAPIT.shtml#Example_<wbr>5</a><br></div><div><br></div>Many thanks,<br><br></div>Kelvin</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>