Bug #1127

sph2grd

Added by Mark 18 days ago. Updated 12 days ago.

Status:FeedbackStart date:2017-07-06
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.x-svn Platform:Linux

Description

Running gmt 5.4.0 on ubuntu 16.04.

I'm generating grids with sph2grd, for example with L=10, M=5, C=1, S=0. When setting the normalistaion flag to -Ng, I get grids who's inner products sum to 4*pi. However, when the flag is -Nm, they appear to sum to 0.5 rather than 1.

History

#1 Updated by Paul 12 days ago

  • Status changed from New to Feedback
  • Target version set to Candidate for next bugfix release

Would you mind showing how you computed the 0.5 so I can make a test script for this. I am looking at the code and find
if (ortho)
plm[mm] = pmm * 0.5 / d_sqrt(M_PI);

so that 0.5 is suspicious in light of your post. But I'd like to verify first.

#2 Updated by Mark 12 days ago

res="1" # deg - resolution of SH grid
pi="3.141592"

echo "Integrated Ylm**2 volume = "$(gmt grd2xyz sh.grd | awk 'BEGIN {sum=0} {sum+=(sin((90-$2)*'$pi'/180)*'$res'*'$res'*('$pi'/180)*('$pi'/180)*($3^2))} END {printf "%.6f\n", sum}')

Also available in: Atom PDF