5
$\begingroup$

As of Mathematica version 10, AstronomicalData is obsolete, deprecated in favor of PlanetData, CometData, MinorPlanetData, PlanetaryMoonData, ExoplanetData, StarData, GalaxyData, NebulaData, PulsarData, and friends. (It still works, but who knows how long for?) There are also many other changes, such as units/quantities, and DateObjects, which I'm struggling with for the first time.

How would I update code like this:

Table[AstronomicalData["Jupiter", {"Declination", x}], 
   {x, DayRange[{2014, 1, 1}, {2014, 1, 31}]}]

to produce a series of simple numbers, because in version 9, this code produced this:

{22.5875, 22.6058, 22.6241, 22.6423, 22.6603, 22.6782, 22.6960, 
 22.7136, 22.7310, 22.7483, 22.7653, 22.7822, 22.7988, 22.8152, 
 22.8314, 22.8474, 22.8631, 22.8785, 22.8937, 22.9086, 22.9233, 
 22.9377, 22.9518, 22.9656, 22.9791, 22.9924, 23.0053, 23.0179, 
 23.0302, 23.0422, 23.0539}

So far, using version 10 I've managed to get as far as this:

Table[PlanetData["Jupiter", 
   EntityProperty["Planet", 
       "Declination", {"Date" -> DateObject[x]}]], 
   {x, DayRange[{2014, 1, 1}, {2014, 1, 31}]}]

but it still produces a list of things which don't look or act like numbers:

odd output

$\endgroup$
3
$\begingroup$

Here is a simple solution:

Table[UnitConvert[
  PlanetData["Jupiter", 
   EntityProperty["Planet", 
    "Declination", {"Date" -> DateObject[x]}]], "Degrees"],
 {x, DayRange[{2014, 1, 1}, {2014, 1, 31}]}]

Convert to numbers

QuantityMagnitude[%]
$\endgroup$
  • $\begingroup$ That's the one, thanks. $\endgroup$ – cormullion Jul 13 '14 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.