opencadc / caom2tools

Common Archive Observation Model - data engineering tools
2 stars 13 forks source link

caom2 objects should use Quantities #114

Open ijiraq opened 5 years ago

ijiraq commented 5 years ago

Making use of astropy.units would add tremendous power to caom2

this extra power is worth the burden of astropy as a dependency (it already is anyhow, implicitly)

caom2.plane.Energy(bounds=[lower_frequencyunits.GHz, upper_frequencyunits.GHz])

and then Energy uses those values as lower_frequency.to(units.m).value when sending to the service.

If a value (rather than a Quantity) is sent to Energy (ie no units) then Energy can assume they are in m or through an error, but for backwards friendly it should accept this as unit.m by default and cast the value to a unit.m Quantity