# [ncl-talk] Problems with vhaeC and vhseC

Aaron Wang - NOAA Affiliate aaron.wang at noaa.gov
Fri Jun 24 20:49:53 MDT 2016

Hi All:

I found some problems with vhaeC (vector spherical harmonics analysis) and
vhseC (vector spherical harmonics synthesis), and am hoping someone can
confirm them with me. The major issue is that the reconstructed u has
discontinuity and reconstructed (u,v) shows up at the wrong occasions.

Problem A:
When the original two-dimensional u and v are on 721x1440 fixed grid
bc = vhaeC(u,v)
According to the manual, bc has the dimension (4,nlat,N), where
N=minimum[nlat,nlon/2] if nlon is even
N=minimum[nlat,(nlon+1)/2] if nlon is odd
Therefore, in my case, N is 720. However, I find N to be 721 when I use
vhaeC, because N has to accommodate zonal wavenumber m=0,720. In other
words, the value of N in practice is inconsistent with the manual.

Problem B (see NCL code - test_vhseC_n0m0.ncl in the attachment):
If I reconstruct (u,v) using vhseC, it is as simple as
ReUV=vhseC(bc,nlon)
ReU=ReUV(0,:,:)
ReV=ReUV(1,:,:)
For n=0, ReU and ReV are always 0. This can be seen when I put bc(:,0,:)=1
nlon=1440 into vhseC and check the output ReUV. Does this mean vhseC can
not reconstruct global mean (u,v)?

Problem C (see NCL code - test_vhseC_n1m0.ncl - and its output figure -
test_vhseC_n1m0.pdf - in the attachment):
According to the manual for vhaeC (
http://www.ncl.ucar.edu/Document/Functions/Built-in/vhaeC-1.shtml),
bc(0,nlat,N) contains the "real" coefficient [u]
bc(1,nlat,N) contains the "imaginary" coefficient [u]
bc(2,nlat,N) contains the "real" coefficient [v]
bc(3,nlat,N) contains the "imaginary" coefficient [v]
However, if I set bc(0:1,1,0)=1 and nlon=1440, and then throw them into
vhseC, I get v field, instead of u field. Also, if I set bc(2:3,1,0)=1 and
nlon=1440, and then throw them into vhseC, I get u field, instead of v
field. This is exactly opposite to the manual's statement, unless I
misunderstood it.

Problem D (see NCL code - test_vhseC_n1m1.ncl - and its output figure -
test_vhseC_n1m1.pdf - in the attachment):
If bc(0:1,1,1)=1 and nlon=1440 thrown into vhseC, I get both u and v field,
even though I am supposed to only get u. If bc(2:3,1,1)=1 and nlon=1440
thrown into vhseC, I get both u and v, even though I am supposed to only
get v. The bc(0:1,1,1)=1 case and bc(2:3,1,1) case seem to be orthogonal to
each other, which is good, but the output from the latter shows
discontinuous u at the poles.

Sorry for the long post, but I am just trying to make the questions clear.

Any help is appreciated. If there is really a problem with the two
functions - vhaeC and vhseC, whom should I report it to?

Thank you very much.

Best Regards,
Jih-Wang (Aaron) Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160624/a728c705/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_vhseC_n0m0.ncl
Type: application/octet-stream
Size: 4057 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160624/a728c705/attachment-0003.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_vhseC_n1m0.ncl
Type: application/octet-stream
Size: 4057 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160624/a728c705/attachment-0004.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_vhseC_n1m0.pdf
Type: application/pdf
Size: 70236 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160624/a728c705/attachment-0002.pdf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_vhseC_n1m1.ncl
Type: application/octet-stream
Size: 4056 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160624/a728c705/attachment-0005.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_vhseC_n1m1.pdf
Type: application/pdf
Size: 208812 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160624/a728c705/attachment-0003.pdf