NASA-Planetary-Science / sbpy

A Python package for small bodies research
https://sbpy.org/
Other
67 stars 34 forks source link

Phys from_sbpy fails for comets #349

Closed jrob93 closed 2 years ago

jrob93 commented 2 years ago

High-level problem description Phys.from_sbdb works fine for asteroids but seem to not like querying comet designations

What did you do?

from sbpy.data import Phys
phys = Phys.from_sbdb("147P")

What did you expect? I expected the code to return physical data for the comet.

What did really happen? The code gave an error:

FieldError: Field M1 is not an instance of <class 'astropy.units.quantity.Quantity'>

It seems that astroquery SBDB is not providing units for all the fields that sbpy expects units for. The following code does the query successfully and the OrderedDict does not have units for M1 etc

from astroquery.jplsbdb import SBDB
sbdb = SBDB.query("147P", phys=True)
print(SBDB.schematic(sbdb)) 

Provide information on your environment: macOS Monterey 12.4 sbpy version: 0.3.1 astropy version: 5.0.1 numpy version: 1.21.2

mkelley commented 2 years ago

Thanks, and I can confirm this bug, and have a fix. If you need a workaround in the short term, then get the data from astroquery as you do above, and apply the unit manually.

mkelley commented 2 years ago

Ah, except that won't get it into the Phys object without major work. I'm not sure there is an easy workaround.

jrob93 commented 2 years ago

No worries, the astroquery solution is fine for me right now!