I can assign a unit to a scalar using: x = YTQuantity(scalar, 'kpc')

but how would I specify that the unit should be kpccm? Perhaps it doesn't even make sense to do so? Something as simple as this is not the answer: x = YTQuantity(scalar, 'kpccm')

Thank you, Paul

  • $\begingroup$ Your question clearly is about programming, but definitely misses some context. Most notably the language and the package(s) you are working with. Also: What unit is kpccm? It's not anything self-explanatory to me $\endgroup$ Commented Mar 7, 2022 at 13:09
  • 1
    $\begingroup$ According to the documentation, it seems to me that it is in fact as simple as appending 'cm' to a length unit. $\endgroup$
    – pela
    Commented Mar 7, 2022 at 13:11
  • $\begingroup$ @planetmaker "yt" is a very astro-specific Python package for analyzing 3D data, and the "cm" should be the specificer for comoving units $\endgroup$
    – pela
    Commented Mar 7, 2022 at 13:12


You must log in to answer this question.

Browse other questions tagged .