You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here it's not related to this issue specifically, but I don't undestand why enumerate is used here, but the count it provides isn't used here. (Enumerate is to go through the iterable, but also bundle the index in a tuple, by default the start argument is at 0). And the loop also keeps track of an i variable. Are we sure that the output that is written to the file is what is expected? It writes i as a %d (a number), but then row as a %s (a string). Without running it, it should then be the string representation of the row, that is in fact here a tuple of the count and the item of what. Is it expected? Where is it used?
To me it seems like a glitch, when the script was ported from shell to Python.
There are no examples or tests that can be used as a reference for how the textfile output is supposed to look like. With the current code it will look something like this:
I'm for using i, row with enumerate and outputting just that. That looks like the intention in the original code. I'm not sure how this compares to the one-liner.
Describe the bug
The code in question is:
grass/scripts/i.spectral/i.spectral.py
Lines 91 to 98 in 1953975
Here it's not related to this issue specifically, but I don't undestand why enumerate is used here, but the count it provides isn't used here. (Enumerate is to go through the iterable, but also bundle the index in a tuple, by default the start argument is at 0). And the loop also keeps track of an
i
variable. Are we sure that the output that is written to the file is what is expected? It writesi
as a%d
(a number), but thenrow
as a%s
(a string). Without running it, it should then be the string representation of therow
, that is in fact here a tuple of the count and the item ofwhat
. Is it expected? Where is it used?Originally posted by @echoix in #4134 (comment)
Expected behavior
A usable output format
Additional context
See the linked thread to follow.
The text was updated successfully, but these errors were encountered: