Re: cloud overlap calculations: minimizing do-loops

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue, 29 Jan 2008 12:01:12 -0700

I am not familiar with the "maximum-random overlap assumption used in CAM".
Note: if this is a fortran subroutine, it could be called directly from
NCL. My guess
is that you could create an intermediate subroutine in fortran

So if x(time,lev,lat,lon) in NCL

C NCLFORTSTART
         subroutine gmauger(ntim,klev,nlat,mlon,x,....)
         implicit none
         integer ntim,klev,nlat,mlon
         real x(mlon,nlat,klev,ntim)
C NCLEND
         integer nt,kl,nl,ml
         real z(klev)

         do nt=1,ntim
            do nl=1,nlat
                do ml=1,mlon
                     do kl=1,klev
                          z(kl) = x(ml,nl,kl,nt)
                     end do
                     call CAM_SUBROUTINE(....)
                end do
             end do
          end do
        
===============================

In NCL ... crude/slow but clear

              do nt=0,ntim-1
                 do nl=0,nlat-1
                     do ml=0,mlon-1
                          ; examine x(nt, : ,nl,ml) for cloud
overlap
                     end do
                 end do
               end do
=========================================

Is there a way the aboove could be implemented using NCL's array syntax?
I think you might have to rethink if what you want could be done via

              do kl=0,klev-1
                   ;examine x(:,kl,:,:) may need intermediate arrays
              end do
==========================================
Not sure if above answers your question

Good luck

guillaume mauger wrote:
>
> Hello All,
>
> I'm attempting to calculate estimated low, mid, and high cloud
> fractions from a 4D array of gridbox cloud fractions, and in doing so
> implement the same maximum-random overlap assumption used in CAM.
>
> Aside from the fact that both the cloud fraction and pressure level
> variables are 4D (since I'm converting from sigma levels),
> implementing the maximum-random overlap assumption seems to
> necessitate looking at each column separately (I can't just take an
> average, or assume maximum overlap, etc).
>
> I assume the only way to accomplish this is with do-loops? This is
> what I'm currently doing, but wanted to test the waters for a more
> efficient algorithm.
>
> Thanks,
> guillaume
>

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jan 29 2008 - 12:01:12 MST

This archive was generated by hypermail 2.2.0 : Thu Jan 31 2008 - 22:46:00 MST