Repository navigation
Improve whitespace handling in astropy.unit.Unit FITS format string parsing? - #602
Conversation
|
Yeah -- that "whitespace as an operator" trick creates a lot of surprising opportunities for ambiguity in the parser, but I think this case is not one of them, so I've just gone ahead and updated it so accept whitespace after the solidus. |
Improve whitespace handling in astropy.unit.Unit FITS format string parsing?
Improve whitespace handling in astropy.unit.Unit FITS format string parsing?
…e-handling Improve whitespace handling in astropy.unit.Unit FITS format string parsing?
|
@mdboom – There's another FITS unit parsing error that @mapazarr has run into at gammapy/gammapy#299 (comment) I think |
|
@cdeil I think the problem here is the |
…first_issue_label DOC: advertise 'good-first-issue' label
I ran into this error:
It took me a minute to figure out that the spaces are the problem, this works:
After reading Section 4.3.1 on "Construction of units strings" of the FITS Standard I realize that the spaces in the
'm / s'unit string is discouraged and thus the behaviour of the astropy parser is not a bug:However, @mdboom, I was wondering if the parsing error or maybe even the parsing behaviour could be improved here. It is a bit confusing that spaces in the unit string are OK in some cases:
But spaces are not OK in these cases
Is it possible (with reasonable effort) to make
u.Unit('m / s')work or give a more explicit error message that whitespace is the problem? If not, obviously feel free to just close this issue since this is not a bug.Note that the CDS parser has it easy and gives