# [ncl-talk] Band-pass filter on a sphere

Dennis Shea shea at ucar.edu
Fri Apr 29 11:17:38 MDT 2022

```Not sure about the "band pass ... on a sphere" or the spherical harmonic
code you included.
------------
The most common application would be performing  an FFT at each latitude.
Something like the following.   (Not tested)

z      = f->Z_GDS0_ISBL     ;   z(time,level,lat,lon)  ->
z(ntim,klvl,nlat,mlon)
dimz = dimsizes(z)
print(dimz)

zcf = ezfftf (z)       ; ==> zcf(2,ntim,klvl,nlat,mlon/2)

; ==> zcf at xbar ==> contains the means
printVarSummary(zcf)

; Reconstruct using only waves 2,3,4,5

zcf(:,:,:,:,0:0) = 0.0    ; wave   1 set to zero
zcf(:,:,:,:,5:  ) = 0.0    ; waves    set to zero

zcf at xbar = 0.0
z_2345  = ezfftb (zcf, zcf at xbar)
printVarSummary(z_2345)
---

On Thu, Apr 28, 2022 at 8:49 PM Min-Woo Kim via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Dear NCL experts,
>
> I'm looking for a method of band-pass filtering on a shpere using NCL.
> "https://mailman.ucar.edu/pipermail/ncl-talk/2019-May/014800.html"
> The above URL is the advice of that in ncl-talk.
> Following the advice, I'm trying as below.
> ***------- ncl scripts
>
> Gp = f->Z_GDS0_ISBL ; geopotential in ERA5(GRIB)
>
>
> lon = tofloat(Gp&g0_lon_2)
>
> Gp_w1  = Gp
>
> Gp_w5  = Gp
>
> Gp_a   = Gp
>
>
> spec_harmonics = shaeC(Gp) ; to spherical harmonics domain
>
> spec_w1  = tri_trunC(spec_harmonics,1) ; truncate
>
> spec_w5  = tri_trunC(spec_harmonics,5) ; truncate
>
> spec_a   = where(spec_w1.eq.spec_w5,0,spec_w5) ; band-pass filtering
> (1<n<=5)
>
>
>
>
>
> ***-------
>
> I want to remain only the wavenumber from 2 to 5 of geopotential(so
>
> Is this the right process for band-pass filtering on a sphere?
>
>
> Thank you,
> Minwoo Kim
>
> ---------------
> 김 민우
> 연구원|공주대학교 종관기상연구실
>
> m 010-7708-9120|e minwookim.9120 at gmail.com
>
> a 충청남도 공주시 공주대학로 56, 자연과학대학 445호
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220429/d30f4c9d/attachment.html>
```