Re: WRAPIT functions

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu May 01 2014 - 13:11:58 MDT

Do the looping in the fortran.

Consider an NCL ordered array x(ntim,klev,nlat,mlon)

In fortran, that *same* array is x(mlon,nlat,klev,ntim)

(In memory, the array is stored linearly with the fastest
  varying dimensions mapping into one another.)

An f77 version might look like

C NCLFORTSTART
        subroutine driver(x,ntim,klev,nlat,mlon, result)
        implicit none
c INPUT
        integer ntim,klev,nlat,mlon
        real x(mlon,nlat,klev,ntim)
c OUTPUT
        real result(......)
C NCLEND
c LOCAL (dynamic allocation)
        integer nt,kl,nl,ml
        real work(ntim)

        do nl=1,nlat
          do ml=1,mlon
            do kl=1,klev

              do nt=1,ntim
                 work(nt) = x(ml,nl,kl,nt)
              end do
              call foo(work,ntim, result,...)
            end do
          end do
        end do

        return
        end

===
external JBUZAN "./...so"

     result = new ( (/.../),typeof(x),getFillValue(x))

     JBUZAN::driver(xntim,klev,nlat,mlon, result)

On 5/1/14, 12:13 PM, jbuzan wrote:
> Hello NCL-Talk.
>
> My fortran code that I am using only works on single cells. I am wondering if there is a more efficient way for me to set up my loops.
>
> Input dataset is netcdf files (atmospheric output):
> X(time,lev,lat,lon).
>
> loop construction:
>
> do i = 0, dimsizes(lat)-1
> do j = 0, dimsizes(lon)-1
> do l = 0, dimsizes(lev)-1
> do k = 0, dimsizes(time)-1
> FORTRAN WRAPIT object
> end do
> end do
> end do
> end do
>
> Thanks,
>
> -Jonathan
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu May 01 13:12:26 2014

This archive was generated by hypermail 2.1.8 : Sun May 04 2014 - 12:38:56 MDT