gravCoeffOps

gravCoeffOps.loadGravFromFile(fileName: str, spherHarm: SphericalHarmonicsGravityModel, maxDeg: int = 2)[source]

Load spherical-harmonic gravity coefficients into a model object.

This is a thin convenience wrapper around loadGravFromFileToList() that parses the file and writes the resulting values into the provided SphericalHarmonicsGravityModel instance.

Parameters:
  • fileName – Path to a JPL-format spherical harmonics CSV file.

  • spherHarm – Gravity model object to populate.

  • maxDeg – Maximum degree/order to load.

Raises:

ValueError – If the file format or requested degree is invalid.

gravCoeffOps.loadGravFromFileToList(fileName: str, maxDeg: int = 2)[source]

Parse spherical-harmonic coefficients from a JPL-format CSV file.

The first row is expected to contain metadata in the canonical JPL format: equatorial radius, gravitational parameter, uncertainty in mu (unused), maximum degree, maximum order, normalization flag, reference longitude, and reference latitude.

Coefficients are returned as triangular degree/order lists where each row has length degree + 1. Rows in the file must be ordered by non-decreasing degree; duplicate degree/order pairs are rejected.

Parameters:
  • fileName – Path to a JPL-format spherical harmonics CSV file.

  • maxDeg – Maximum degree/order to load.

Returns:

[clmList, slmList, mu, radEquator].

Raises:

ValueError – If input arguments or file contents are invalid.

gravCoeffOps.loadPolyFromFile(fileName: str, poly: PolyhedralGravityModel)[source]

Load polyhedral shape data into a model object.

This is a thin convenience wrapper around loadPolyFromFileToList() that parses supported polyhedron files and writes vertices/facets into the provided PolyhedralGravityModel instance.

Parameters:
  • fileName – Path to a supported polyhedron file (.tab, .obj, or .txt).

  • poly – Polyhedral gravity model object to populate.

Raises:

ValueError – If the file extension or contents are invalid.

gravCoeffOps.loadPolyFromFileToList(fileName: str)[source]

Parse a polyhedral shape model from disk.

Supported formats are:

  • .tab: Gaskell (nVertex nFacet + data rows) or PDS3/OBJ-like text.

  • .obj: Wavefront-style v/f entries.

  • .txt: Legacy format with nVertex nFacet header followed by rows.

Vertex positions are converted from kilometers in file inputs to meters in output lists. Facet index conventions are preserved according to each file format’s expected indexing.

Parameters:

fileName – Path to a supported polyhedron file.

Returns:

[vertList, faceList, nVertex, nFacet].

Raises:

ValueError – If the file extension is not supported or file content cannot be parsed.