Re: shagc for fields symmetric about the equator

From: Dennis Shea (shea AT cgd.ucar.edu)
Date: Mon May 09 2005 - 11:12:22 MDT

  • Next message: Benjamin Lamptey: "lonFlip"

    >I'm using shagc to decompose a field into spherical harmonics.
    >Can I somehow use specify whether the field is symmetric or
    >antisymmetric about the equator?

    Hello,

    The underlying spherepack does allow the analysis to be performed
    on arrays symmetric or antisymmetric about the equator. For
    historical reasons, NCL is currently set up such that it assume
    no asymmetries exist. This could be changed.

    Thus, as it currently stands, the best approach is to set up
    a function [sketch only ... untested]

      function shagc_hemisphere (x, isym)
      begin
        dimx = dimsizes(x)
        rank = dimsizes(dimx) ; shape .. # dims
        nlat = dimx(rank-2)
        
        dimX = dimx
        dimX(rank-2) = 2*nlat ; double number of latitudes
        
        X = new (dimX, typeof(x) )
        delete(X@_FillValue) ; automatically added
        
        if (rank.eq.2) then
            X(nlat:,:) = x ; top half [array syntax]
            
                                               ; bottom half
            if (isym.eq.1) then ; symmetric
                X(0:nlat-1,:) = x(::-1,:) ; reverse order of latitudes
            else ; must be assymmetric
                ...
            end if
            
            ab = shagC (X)
            return(ab(:,0:nlat-1,:)) ; return half the coef
        end if
        
        if (rank.eq.3) then
            X(:,nlat:,:) = x ; top half [array syntax]
            
                                               ; bottom half
            if (isym.eq.1) then ; symmetric
                X(:,0:nlat-1,:) = x(:,::-1,:) ; reverse order of latitudes
            else ; must be assymmetric
                ...
            end if
            
            ab = shagC (X)
            return(ab(:,:,0:nlat-1,:)) ; return half the coef
        end if
       
       ;etc
      end

    _______________________________________________
    ncl-talk mailing list
    ncl-talk@ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Mon May 09 2005 - 13:54:40 MDT