Re: using Fortran function from NCL ...

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Jul 09 2014 - 11:18:50 MDT

The short issue is ... I don't know what the issue might be.
One would expect array order consistency amongst the variables

==
As you know:

Fortran is column major; NCL is row major. NO reordering is required

– NCL: z(time,lev,lat,lon) <=map=> z(lon,lat,lev,time): Fortr=
an
            x(N,M) <=map=> x(M,N)

In memory, one can imagine the array values are in a linear list

Let M=3, N=2


     x(0,0) => 7.23 <= x(1,1)
     x(0,1) => -12.5 <= x(2,1)
     x(0,2) => 0.3 <= x(3,1)
     x(1,0) => 323.1 <= x(1,2)
     x(1,1) => -234.6 <= x(2,2)
     x(1,2) => 200.1 <= x(3,2)
~


On Wed, Jul 9, 2014 at 6:25 AM, <u.utku.turuncoglu@be.itu.edu.tr> wrote:

> Hi,
>
> I am just trying to use a Fortran procedure from NCL. In this case, the
> NCLFORSTART and NCLEND like following
>
> C NCLFORTSTART
> subroutine uvrot(u, v, xlon, gridfc, clon, clat, ix, jxp)
> !
> implicit none
> !
> !-----------------------------------------------------------------------
> ! Imported variable declarations
> !-----------------------------------------------------------------------
> !
> integer ix, jxp
> real*8 u(jxp,ix)
> real*8 v(jxp,ix)
> real*8 xlon(ix,jxp)
> real*4 gridfc, clon, clat
> C NCLEND
>
> and i am calling it as
>
> u2 = todouble(uas(indx,:,:))
> v2 = todouble(vas(indx,:,:))
> lon = todouble(xlon(jx|:,iy|:))
> EX02::uvrot(u2, v2, lon, gridfc, clon, clat, nlat, nlon)
>
> in this case, it works without any problem but i need to change the order
> of dimension of the "lon" argument to make it run. I know that NCL uses
> different memory storage and indexes (see following link),
>
> https://www.ncl.ucar.edu/Document/Tools/WRAPIT.shtml#Example_5
>
> but i could not understand why only "lon" argument needs dimension
> reordering. It might also needed for "u2" and "v2". Right? By the way the
> dimensions sizes are exactly same for "u2", "v2" and "lon". Anyway, i jus=
t
> wonder that is this related with some limitation of WRAPIT?
>
> Best Regards,
>
> --ufuk
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

Received on Wed Jul 09 05:18:56 2014

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:46 MDT