-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix parsing number from ISIS3 array #34
Conversation
Nice catch @seignovert, thanks for the PR. It looks like this implementation would parse the continuation on the next line as its own number instead of including it with the previous line. It would be good to get a test to show the intended behaviour. For example:
should be parsed as {'foo': [1.234, 1.234, 1.234]} as opposed to {'foo': [1.234, 1.2, 34, 1.234]} |
Thanks @seignovert, the test looks great. I did a little digging on this and it brought up some questions on how line continuations should work. It seems any time there is a dash and a new line not in a quoted string, the line should be continued. In which case # Should parse as:
pvl.loads("foo = bar-\n") == {"foo": "bar"}
# Should NOT parse as:
pvl.loads("foo = bar-\n") != {"foo": "bar-"} @godber @pbvarga1 Any perspective on how the other libraries handle this? We currently have a test that enforces keeping the trailing dash that would need to change if so. It seems fixing this would only be moving the line where the dash is striped up above checking for an unquoted string. |
Thanks @wtolson and @seignovert for working on this. I've not encountered this myself, but perhaps it's the kind of thing @thareUSGS knows about. |
Good question. Based on the comments in the linked .cpp code, it appears a dash at the end of a line, even if quoted, is considered "special", meaning it will always be a continuation flag. see if this helps: https://github.com/USGS-Astrogeology/ISIS3/blob/e7590fb1d49292edeb7661d681e05f76409a316a/isis/src/base/objs/PvlKeyword/PvlKeyword.cpp#L660 extracted example:
|
Hi all, Based on your comments I simply deleted my original edit and I removed the Hope this will solve the problem globally. |
Is this ready to merge, @wtolson ? |
Obsoleted by #38, and @seignovert added to authors file. This PR can be withdrawn. |
@seignovert closing this pr, please check out the code in current master and see if it works for you! |
Thanks @rbeyer and @AndrewAnnex. |
I notice a small bug during the parsing of numbers from ISIS3 array.
Here is a sample of a Casini/VIMS cube header produced by ISIS3:
Most of the array is parsed corrected but some values remain Unicode strings (with a
-
symbol at the end), e.g.:It always happen when the next line starts with a
,
.I guess there is a nicer way to solve that problem, but here is dirty patch to fix it quickly.