question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Geocentric object does not have center set to Earth

See original GitHub issue

I am trying to create my own Geocentric objects directly using the class constructor. I have data containing satellite states in ICRF that I need to convert to ECEF and lat/lon positions. When I try to get the lat/lon position of an object created with Geocentric, I get an error that that method can only be used if the center is set to Earth:

from skyfield.positionlib import Geocentric
geo = Geocentric([-2.63970280e-04, 9.92180837e-05, 6.71165223e-07],
                 velocity_au_per_d=[-6.23751840e-07, -1.66333824e-06, -1.16087148e-10])
geo.subpoint()

ValueError Traceback (most recent call last) <ipython-input-186-7e91b47e36cb> in <module> ----> 1 geo.subpoint()

~/.virtualenvs/ml/lib/python3.7/site-packages/skyfield/positionlib.py in subpoint(self) 463 “”" 464 if self.center != 399: # TODO: should an init() check this? –> 465 raise ValueError(“you can only ask for the geographic subpoint” 466 " of a position measured from Earth’s center") 467 t = self.t

ValueError: you can only ask for the geographic subpoint of a position measured from Earth’s center

geo.center  # returns nothing

I tried to set the center to Earth manually with:

from skyfield import api
planets = api.load('de421.bsp')
earth = planets['earth']
geo = Geocentric([-2.63970280e-04, 9.92180837e-05, 6.71165223e-07],
                 velocity_au_per_d=[-6.23751840e-07, -1.66333824e-06, -1.16087148e-10],
                 center=earth)
geo.subpoint()

which results in the same error, although geo.center now shows a VectorSum object from the solar system barycenter to Earth. I also tried just passing a string 'Earth' and 'earth' to the constructor, neither of which helped. It seems to me like a geocentric object should automatically be centered at the Earth. Is this a bug or is there an intended way to initialize these for this use case that you can point me toward?

Thank you.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
brandon-rhodescommented, May 25, 2019

I agree that it should default to Earth! I actually had a branch with that modification already on my computer, but hadn’t yet found time to figure out why one test was failing; I’ve now worked out the problem.

1reaction
ghostcommented, May 25, 2019

Just as a reference, these “399” numbers are called NAIF ids: https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/req/naif_ids.html#Planets and Satellites (I linked to one section, but the whole document is interesting).

The NAIF ids are commonly used in CSPICE, for example

Read more comments on GitHub >

github_iconTop Results From Across the Web

Geocentric model - Wikipedia
In astronomy, the geocentric model is a superseded description of the Universe with Earth at the center. Under most geocentric models, the Sun,...
Read more >
Geocentric model: The Earth-centered view of the universe
The geocentric model is a debunked theory that the Earth is the center of the universe, with the sun and planets revolving around...
Read more >
Geocentric Cosmology. - Explaining Science
The geocentric model​​ At the centre of the Universe was the Earth. The Earth did not rotate and was surrounded by a set...
Read more >
Geocentric model | Definition, History, & Facts | Britannica
geocentric model, any theory of the structure of the solar system (or the universe) in which Earth is assumed to be at the...
Read more >
Heliocentric versus Geocentric Models of the Universe
The geocentric model says that the earth is at the center of the cosmos or universe, and the planets, the sun and the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found