One function

Ellipsoid in geospace-code/pymap3d

The author described this change as Ellipsoid.from_name(unknown) raises KeyError instead of warning. It counts as a record because the check below fails on the code as it stood at b11460ee2 and passes on bc695e4bd, with nothing else changed between the two runs.

Fix saved2023-02-26
Sharing licenceBSD-2-Clause · LICENSE
Change size+0 4

What the code was meant to do, written into the code itself as a docstring

generate reference ellipsoid parameters as everywhere else in pymap3d, distance units are METERS Ellipsoid sources ----------------- maupertuis, plessis, everest1830, everest1830m, everest1967, airy, bessel, clarke1866, clarke1878, clarke1860, helmert, hayford, international1924, krassovsky1940, wgs66, australian, international1967, grs67, sa1969, wgs72, iers1989, iers2003: - https://en.wikipedia.org/wiki/Earth_ellipsoid#Historical_Earth_ellipsoids - https://en.wikibooks.org/wiki/PROJ.4#Spheroid wgs84: https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84 wgs84_mean: https://en.wikipedia.org/wiki/Earth_radius#Mean_radii grs80: https://en.wikipedia.org/wiki/GRS_80 io: https://doi.org/10.1006/icar.1998.5987 pz90.11: https://structure.mil.ru/files/pz-90.pdf gsk2011: https://racurs.ru/downloads/documentation/gost_r_32453-2017.pdf mars: https://tharsis.gsfc.nasa.gov/geodesy.html mercury, venus, moon, jupiter, saturn, uranus, neptune: - https://nssdc.gsfc.nasa.gov/planetary/factsheet/index.html feel free to suggest additional ellipsoids

The change

131131 def from_name(cls, name: str) -> Ellipsoid | None:
132132 """Create an Ellipsoid from a name."""
133133
134- if name not in cls.models:
135- warnings.warn(f"{name} model not implemented", stacklevel=2)
136- return None
137-
138134 return cls(
139135 cls.models[name]["a"], cls.models[name]["b"], name=cls.models[name]["name"], model=name
140136 )

The check that tells the two apart

failpass·src/pymap3d/tests/test_ellipsoid.py::test_bad_name

Check file src/pymap3d/tests/test_ellipsoid.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itb11460ee2e8f00f334cbd6462fdba2037a654b47
Broken version dated2023-02-26
Modulepymap3d.ellipsoid
Units changedEllipsoid
Fingerprint574343102e70782b
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in geospace-code/pymap3d