shfilt.gex - GrADS Extension Library for Spherical Harmonic Filtering

- NAME
- SYNOPSIS

- GrADS Functions:
- GrADS Script:

- DESCRIPTION
- EXAMPLES

- Filtering surface pressure.
- Power spectra of surface temperature

- FUNCTIONS PROVIDED

- sh_filt(EXPR,N1[,N2])
- sh_power(EXPR)

- SEE ALSO
- AUTHOR
- COPYRIGHT

# NAME

shfilt.gex - GrADS Extension Library for Spherical Harmonic Filtering

# SYNOPSIS

### GrADS Functions:

  display sh_filt(EXPR,N1[,N2]) - Spherical Harmonic Filter

  display sh_power(EXPR) - Spherical Harmonic Power Spectra

### GrADS Script:

  run power.gs EXPR N - Plot Spherical Harmonic Power Spectra

# DESCRIPTION

This library provides GrADS extensions (gex) with functions for spherical harmonic filtering and calculation of spherical harmonic power spectra. The numerical calculations rely on the excellent Spherepak library by John C. Adams and Paul N. Swarztrauber. Quoting from the Speherepak website:

SPHEREPACK 3.1 is a collection of FORTRAN programs that facilitates computer modeling of geophysical processes. The package contains programs for computing certain common differential operators including divergence, vorticity, gradients, and the Laplacian of both scalar and vector functions. Programs are also available for inverting these operators. For example, given divergence and vorticity, the package can be used to compute the velocity components. The Laplacian can also be inverted and therefore the package can be used to solve both the scalar and vector Poisson equations. Its use in model development is demonstrated by a sample program that solves the time-dependent non-linear shallow-water equations. Accurate solutions are obtained via the spectral method that uses both scalar and vector spherical harmonic transforms that are available to the user. The package also contains utility programs for computing the associated Legendre functions, Gauss points and weights, and multiple fast Fourier transforms. Programs are provided for both equally-spaced and Gauss distributed latitudinal points as well as programs that transfer data between these grids.

The current GrADS extensions only begin to explore the capabilties of Spherepak. The function sh_filt takes a scalar global 2D field on the sphere, expands it in terms of spherical harmonics, and reconstructs it includng only (total) wavenumbers in the range [N1,N2] specified by the user. Additionally, function sh_power returns the power spectra in terms of total waenumbers. This is accomplished by returning a 1D array (fixed longitude, varying latitude) with the spectra as a function of total wavenumber. The GrADS script power.gs is useful to plot this power spectra and should be used in place of the function sh_power().

# EXAMPLES

## Filtering surface pressure.

The example expands the surface pressure field in terms of spherical harmonics and reconstructs it retaining only 10 wavenumber.

     open model
     set gxout shaded
     d sh_filt(ps,10)

## Power spectra of surface temperature

The example expands the surface temperature field in terms of spherical harmonics and plots it as function of the 32 first total numbers.

     run power.gs ts 32

# FUNCTIONS PROVIDED

## sh_filt(EXPR,N1[,N2])

This function takes a scalar global 2D field on the sphere, expands it in terms of spherical harmonics, and reconstructs it includng only (total) wavenumbers in the range [N1,N2] specified by the user.

EXPR

  GrADS expressions with scalar expression to be filtered.

N1[,N2]

  When both N1 and N2 are specified, only spherical harmonics with total wavenumber in the range [N1,N2] will be retained. When only N1 is specified, only spherical harmonics with total wavenumber in the range [1,N1] will be retained.

## sh_power(EXPR)

This function returns the power spectra in terms of total waenumbers. This is accomplished by returning a 1D array (fixed longitude, varying latitude) with the spectra as a function of total wavenumber. The GrADS script power.gs is useful to plot this power spectra and should be used in place of the function sh_power().

# SEE ALSO

- http://opengrads.org/ - OpenGrADS Home Page

- http://cookbooks.opengrads.org/index.php - OpenGrADS Cookbooks

       =item *

  http://www.scd.ucar.edu/css/software/spherepack - Spherepack Home Page

- http://opengrads.org/wiki/index.php - OpenGrADS User Defined Extensions

- http://www.iges.org/grads/ - Official GrADS Home Page

# AUTHOR

Arlindo da Silva (dasilva@opengrads.org)

# COPYRIGHT

Copyright (C) 2008-2009 Arlindo da Silva; All Rights Reserved.

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

shfilt.gex - GrADS Extension Library for Spherical Harmonic Filtering