VOUnit to issue VOWarning rather than generic UnitsWarning
See original GitHub issueastropy.io.votable.exceptions.W50
is defined to be the warning for units that do not adhere to the VO standards: https://www.ivoa.net/documents/VOUnits
yet, astropy.units.format.vounit.VOUnit issues a generic UnitsWarning
for the exact same reason.
This is somewhat unexpected in practice, and while in the example below we could ignore both, I don’t think that’s the right approach:
Issue Analytics
- State:
- Created a year ago
- Comments:16 (16 by maintainers)
Top Results From Across the Web
Vizier search often emits UnitsWarning: Unit 'e' not ...
When performing Vizier search, it often emits the following (arguably useless) warning. UnitsWarning: Unit 'e' not supported by the VOUnit ...
Read more >Source code for astropy.units.format.vounit
Source code for astropy.units.format.vounit ... Generic): """ The IVOA standard for units used by the VO. ... UnitsWarning) return cls.
Read more >Source code for astropy.units.format.vounit
Source code for astropy.units.format.vounit ... Generic): """ The IVOA standard for units used by the VO. ... UnitsWarning) return cls.
Read more >sUnit incorrectly claims to rely on UIP - Coq/Coq
VOUnit to issue VOWarning rather than generic UnitsWarning, 16, 2022-03-30, 2022-08-06. Text flowing off the page, 1, 2021-02-09, 2022-08-17.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If we look at the code that parses the VOTable then we see that it should already properly replace any
UnitsWarning
instances withW50
: https://github.com/astropy/astropy/blob/acdefa2cdde7b1dd5923e7acece15eca7812d127/astropy/io/votable/tree.py#L1390-L1404 The fact that we still get anUnitsWarning
despiteparse_strict='silent'
means that there is a bug that would not be fixed by changing the warnings hierarchy, so that does not sound like a solution we should pursue. Indeed, the underlying bug can be easily confirmed if we try out different unit formats. With e.g.format='cds'
everything works as expected:But now with
format='vounit'
:We can see that using
format='vounit'
always results in an additional warning, which is the real bug that needs to be fixed.Turns out the bug we uncovered here was reported already years ago: #6302