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
repetition of null value bug #111
Comments
Yes, I can also reproduce this problem. Looks like the failure is at I will look further into it, thanks very much for reporting. |
I've pushed a fix 7fd2abf that appears to resolve this, and have added your case as a test. Can you see if it works? |
patched_data_win.txt |
Yes, you are right. There was a second assumption in the lookahead when checking the subsequent record. I fixed one case (the final value) but not the other (first or interior value). Sorry about the confusion, let me have another go. |
Sure, thanks!!
|
I've done a more careful look into this case (repeat nulls with commas) and it seems to be fixed now. I've also expanded the test suite to catch more of these cases. I've updated this in 3096833. Can you give it another try? |
Hi Marshall, |
I can't see the issue that you're describing, can you post the output here? |
Sure (my apologies):
$REDOIO |
Ah ok, I think that may be intentional. I need to run but default behavior is to not print trailing commas. I would not have thought this affected patched output, but this may be what is going on. (Edit: Null values are one of the exceptions which always append a comma. Although this is not strictly necessary when they are repeated, it may just be that the program is still using them.) |
Thanks, I came across the .end_comma and such object members, but recorded that these seemed to have no impact on .patch() output. I tried via first: |
You are right, that flag only affects Unfortunately I don't have an easy explanation here. The mechanics of My guess is that commas are being gathered along with the values, since in may cases they are needed, but is discarding them because they are not part of the output. I agree that it should reproduce the commas if they are present, but it could be a large task and wanted to give some warning. |
I've confirmed this is a general problem, gonna recommend closing this issue and opening a new one for the trailing comma of a patch. |
Sure! Thanks again!
|
Closing this for now, the end comma issue will be addressed in #112. |
Hi Marshall,
Thanks for this great tool!
The bug occurs for the following variable input line:
AXFCLN = 3.0, 3.0, 48*,
The 48* denotes a repetition of 48 null values
Upon .write(), it is being turned into:
AXFCLN = 3.0, 3.0, ','*,
One clue is that everything is fine (output = input) if the trailing comma is removed prior to processing.
Processing attached files as follows:
nml=f90nml.read('repetition_of_null_win.nml')
f90nml.patch('repetition_of_null_win.nml', nml, 'patched_data_win.nml')
and likewise for the unix line-endings version.
I'm using latest master commit 151438f on Oct 31, 2019 (ver 1.1.2)
My sys.version is:
3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)]
I'm running Win10/64/Pro.
patched_data_unix.txt
patched_data_win.txt
repetition_of_null_win.txt
repetition_of_null_unix.txt
The text was updated successfully, but these errors were encountered: