Legendre Functions

legendre.PlON(lmax, z)
This function evalutates all ortho-normalized legendre polynomials up to degree lmax.
Parameters:
  • lmax (int) – Maximum spherical harmonic degree to compute
  • z (real) – cos(colatitude) or sin(latitude)
Returns:

A vector of all associated Legendgre polynomials evaluated at z up to lmax

Return type:

numpy 1D array

legendre.PlmON(lmax, z, csphase=1)

This function evalutates all the normalized associated Legendre functions up to degree lmax.

Comments from the SHTOOLS library: The functions are initially scaled by 10^280 sin^m in order to minimize the effects of underflow at large m near the poles (see Holmes and Featherstone 2002, J. Geodesy, 76, 279-299). On a Mac OSX system with a maximum allowable double precision value of 2.225073858507203E-308 the scaled portion of the algorithm will not overflow for degrees less than or equal to 2800.

For each value of m, the rescaling factor is computed as rescalem=rescalem*sin(theta), with the intial value of rescalem being equal to 1/scalef (which is here equal to 10^280). This will gradually reduce this huge number to a tiny number, and will ultimately underflow. In order to prevent this underflow, when rescalem becomes less than 10^(-280), the subsequent rescaling factors of sin(theta) will be directly applied to Plm, and then this number will be multipled by the old value of rescalem.

Temporary variables in saved in an allocated array. In order to explicitly deallocate this memory, call this routine with a spherical harmonic degree of -1.

Parameters:
  • lmax (int) – Maximum spherical harmonic degree to compute
  • z (real) – cos(colatitude) or sin(latitude)
  • csphase (int) –

    Condon-Shortley phase factor

    1 = Do not Apply -1 = Apply the phase factor

legendre.PlmBar(lmax, z, csphase=1)

This function evalutates all of the normalized associated Legendre functions up to degree lmax.

Comments from the SHTOOLS library: The functions are initially scaled by 10^280 sin^m in order to minimize the effects of underflow at large m near the poles (see Holmes and Featherstone 2002, J. Geodesy, 76, 279-299). On a Mac OSX system with a maximum allowable double precision value of 2.225073858507203E-308 the scaled portion of the algorithm will not overflow for degrees less than or equal to 2800.

For each value of m, the rescaling factor is computed as rescalem=rescalem*sin(theta), with the intial value of rescalem being equal to 1/scalef (which is here equal to 10^280). This will gradually reduce this huge number to a tiny number, and will ultimately underflow. In order to prevent this underflow, when rescalem becomes less than 10^(-280), the subsequent rescaling factors of sin(theta) will be directly applied to Plm, and then this number will be multipled by the old value of rescalem.

Parameters:
  • lmax (int) – Maximum spherical harmonic degree to compute
  • z (real) – cos(colatitude) or sin(latitude)
  • csphase (int) – Condon-Shortley phase factor (1=Do not Apply, -1=Apply)
legendre.PLegendreA(lmax, z, csphase=1)
Parameters:
  • lmax (int) – Maximum spherical harmonic degree to compute
  • z (real) – cos(colatitude) or sin(latitude)
  • csphase (int) – Condon-Shortley phase factor (1=Do not Apply, -1=Apply)
legendre.PLegendre(lmax, z)
Parameters:
  • lmax (int) – Maximum spherical harmonic degree to compute
  • z (real) – cos(colatitude) or sin(latitude)
legendre.PlmSchmidt(lmax, z, csphase=1)
Parameters:
  • lmax (int) – Maximum spherical harmonic degree to compute
  • z (real) – cos(colatitude) or sin(latitude)
  • csphase (int) – Condon-Shortley phase factor (1=Do not Apply, -1=Apply)
legendre.PlSchmidt(lmax, z)
Parameters:
  • lmax (int) – Maximum spherical harmonic degree to compute
  • z (real) – cos(colatitude) or sin(latitude)

Previous topic

Introduction

Next topic

Spherical Harmonic Transformations

This Page