Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow silencing/erroring on outputting deprecated units to string #18304

@mhvk

Description

@mhvk

In #18084, @larrybradley noted that the base fluxes for STmag and ABmag (u.ST and u.AB) cannot be writting to VOUnit format, because they include units that are deprecated by VOunit (Angstrom and erg). I don't think we want to change the default, but it would be good to allow users to specify what should be done for deprecated units. Specifically, I suggested in #18084 (comment):

[...] it would be nice to solve allow the various unit formats to avoid deprecated units, and thus get rid of the warnings. E.g., just like unit.to_string now has a fraction argument that allows one to tell what to do with fractions, one could imagine a deprecated={"warn","error","ignore","replace"} keyword argument that allowed one to tell that it is fine to replace deprecated units with others (adjusting the scale, of course). Indeed, vounit already does this partially, for the deprecated deci and deca prefixes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions