Skip to content

density.nrlmsise(altitude, latitude, longitude, time) passes radians through as degrees #170

Description

@ssmichael1

Found by the #90 units sweep (PR #169).

The float overload of satkit.density.nrlmsise is documented (stub density.pyi) as taking latitude_rad / longitude_rad in radians, consistent with satkit's convention (radians unless a _deg suffix). But python/src/pydensity.rs passes the two floats unchanged to nrlmsise::nrlmsise, which takes degrees — the same slot the itrfcoord overload fills with latitude_deg() / longitude_deg() (fixed in #154), and that satkit.nrlmsise00(..., latitude_deg=, longitude_deg=) fills explicitly in degrees.

So a caller following the stub, e.g. density.nrlmsise(400e3, math.radians(60), math.radians(-70), t), is evaluated at latitude 1.05° / longitude −1.2° instead of 60° / −70°: a different atmosphere (the existing test_density_itrfcoord_matches_degree_call shows the two interpretations differ by well over 0.1 % in density; more at high latitude during storms).

Fix: convert with .to_degrees() in the float branch of pydensity.rs, and add a test that the float form with radians matches the itrfcoord form for the same point. Stub and docs are already correct.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PG969yapJ84DJceKt21Wen

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions