 NCL Home > Documentation > Functions

# Caveats when using spherical harmonic regridding

The spherical harmonic based regridding routines are fast and highly accurate. However, they may not be appropriate for certain applications, in particular, interpolation of bounded variables.

For example, precipitation is bounded by zero and relative humidity is bounded by 0 and 100. Use of the spherical harmonic interpolators *may* produce values which exceed the variable's bounds. This is due to "spectral ringing" (Gibb's Phenonema). Generally, the values exceed the bounds by only small amounts.

There are two approaches:

1. To ensure results that do not exceed the variable's bounds, the user should use the bilinear regrid function linint2 (linint2_Wrap).

2. Use the spherical harmonic based regrid functions and employ NCL's clipping operators ">" and "<". For example, consider a variable "x" that is bounded by 0 and 100:

```   x = x < 100   ; any value greater than 100 will be set to 100
x = x > 0     ; any value less than 0 will be set to 0
```
Even with this approach, users should be aware that spectral ringing will still be present where values are near the bounds. For example, if the variable being interpolated is precipitation (bounded by zero). Then values in deserts which were originally zero may have some non-zero values even after the clipping operator ">0" is used.