l3py.gravityfield

Representations of Earth’s gravity field.

gravityfield.degree_indices()

Return array indices for all coeffcients of degree n.

The coefficients are ordered by trigonometric function (first all cosine coefficients then all sine coefficients) with increasing order.

Parameters:n (int) – degree
Returns:
  • rows (array_like(k,)) – row indices of all coefficients of degree n
  • columns (array_like(k,)) – column indices of all coefficients of degree n
gravityfield.order_indices(m)

Return array indices for all coeffcients of order m.

The coefficients are ordered by trigonometric function (first all cosine coefficients then all sine coefficients) with increasing degree.

Parameters:
  • maximum_degree (int) – maximum degree of target coefficient array
  • m (int) – order
Returns:

  • rows (array_like(k,)) – row indices of all coefficients of order m
  • columns (array_like(k,)) – column indices of all coefficients of order m

class l3py.gravityfield.PotentialCoefficients(GM=398600441500000.0, R=6378136.3)[source]

Class representation of a set of (possibly time stamped) potential coefficients.

Parameters:
  • GM (float) – geocentric gravitational constant
  • R (float) – reference radius

Methods

append(trigonometric_function, degree, …) Append a coefficient to a PotentialCoefficients instance.
coefficient_triangle([min_degree, max_degree]) Arrange spherical harmonic coefficients as triangle for visualization.
copy() Return a deep copy of the PotentialCoefficients instance.
degree_amplitudes([kernel]) Compute degree amplitudes from potential coefficients.
nmax() Return maximum spherical harmonic degree of a PotentialCoefficients instance.
replace_c20(gravityfield) Replace the c20 coefficient of a PotentialCoefficients instance by c20 of another PotentialCoefficients instance.
slice([min_degree, max_degree, min_order, …]) Slice a PotentialCoefficients instance to a specific degree and order range.
to_grid([grid, kernel]) Compute gridded values from a set of potential coefficients.
truncate(nmax) Truncate a PotentialCoefficients instance to a new maximum spherical harmonic degree.
append(trigonometric_function, degree, order, value)[source]

Append a coefficient to a PotentialCoefficients instance.

coefficient_triangle(min_degree=2, max_degree=None)[source]

Arrange spherical harmonic coefficients as triangle for visualization.

Parameters:
  • min_degree (int) – degrees below min_degree are masked out
  • max_degree (int) – triangle is truncated at max_degree
Returns:

triangle

Return type:

masked_array shape (max_degree+1, 2*max_degree-1)

copy()[source]

Return a deep copy of the PotentialCoefficients instance.

degree_amplitudes(kernel='potential')[source]

Compute degree amplitudes from potential coefficients.

Parameters:kernel (string) – name of kernel for the degree amplitude computation
Returns:
  • degrees (array_like shape (self.nmax()+1,)) – integer sequence of degrees
  • amplitudes (array_like shape (self.nmax()+1,)) – computed degree amplitudes
nmax()[source]

Return maximum spherical harmonic degree of a PotentialCoefficients instance.

replace_c20(gravityfield)[source]

Replace the c20 coefficient of a PotentialCoefficients instance by c20 of another PotentialCoefficients instance. Substitution is performed in-place.

Parameters:gravityfield (PotentialCoefficients instance) – gravity field containing the new c20 value
slice(min_degree=None, max_degree=None, min_order=None, max_order=None, step_degree=1, step_order=1)[source]

Slice a PotentialCoefficients instance to a specific degree and order range. Return value is a new PotentialCoefficients instance, the original gravity field is unchanged.

Parameters:
  • min_degree (int) – minimum degree of sliced PotentialCoefficients (Default: 0)
  • max_degree (int) – maximum degree of sliced PotentialCoefficients (Default: maximum degree if calling object)
  • min_order (int) – minimum order of sliced PotentialCoefficients (Default: 0)
  • max_order (int) – maximum order of sliced PotentialCoefficients (Default: max_degree)
  • step_degree (int) – step between min_degree and max_degree (Default: 1)
  • step_order (int) – step between min_order and max_order (Default: 1)
Returns:

gravityfield – new PotentialCoefficients instance with all coefficients outside of the passed degree and order ranges set to zero

Return type:

PotentialCoefficients

to_grid(grid=<l3py.grid.GeographicGrid object>, kernel='ewh')[source]

Compute gridded values from a set of potential coefficients.

Parameters:
  • gravityfield (PotentialCoefficients instance) – potential coefficients to be gridded
  • grid (instance of Grid subclass) – point distribution (Default: 0.5x0.5 degree geographic grid)
  • kernel (string) – gravity field functional to be gridded (Default: equivalent water height). See Kernel for details.
Returns:

output_grid – deep copy of the input grid with the gridded values

Return type:

instance of type(grid)

truncate(nmax)[source]

Truncate a PotentialCoefficients instance to a new maximum spherical harmonic degree.