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
{{ message }}
Repository navigation
ECOSTRESS database does string comparison without converting to lowercase first #191
I believe I found a bug in ECOSTRESS database code, I came across it by accident. When I was looking at different spectra, I noticed that there were several typos that made automatic processing difficult, like "Tansmission", "Transmittence" and "Reflectence". I assumed that SPy didn't do any cleanup, so I did my own cleanup and moved on. Then while I was looking at spectral/database/ecostress.py for something unrelated, I noticed that SPy actually does cleanup:
However the database I built by spectral.EcostressDatabase.create("ecostress.db", "ecostress") did not have any of these fixes.
Looking at the code, I traced the issue to the function metaline_to_pair at line 26: The function does not do any lowercase conversion, unlike the ASTER database equivalent function read_pair in spectral/database/aster.py at line 38. As the typo checks at line 194 all use lowercase, they don't catch typos with mismatching case.
I didn't create a merge request because I'm not sure if this is intended behavior or not, and I'm not sure what would be the desired way to fix it (the lowercase conversion could be added to both to the metaline_to_pair function and to the typo checks). If this is indeed not desired behavior, and you have a preferred fix, I can quickly create a merge request.
changed the title [-]ECOSTRESS database "metaline" processing does string comparison without converting to lowercase first[/-][+]ECOSTRESS database does string comparison without converting to lowercase first[/+]on Nov 30, 2026
For each of the library formats, there is some code to deal with idiosyncrasies of the library. If you think there is a reasonable solution to fix those typos, please feel free to make a merge request. It can either be a global check for typo in any entry or, if there are a few pathological cases, they could be handled as a conditional statement for those entries (and handle the possibility that the typos are fixed in a future version of the library).
For each of the library formats, there is some code to deal with idiosyncrasies of the library. If you think there is a reasonable solution to fix those typos, please feel free to make a merge request. It can either be a global check for typo in any entry or, if there are a few pathological cases, they could be handled as a conditional statement for those entries (and handle the possibility that the typos are fixed in a future version of the library).
Thanks!
Hi,
Firstly I'm sorry, I'm not great at explaining things and I guess I phrased the issue really badly. I was not suggesting new fixes for typos, but was trying to say that the typo fixes that are already implemented for the ECOSTRESS database are not working due to a missing lowercase conversion. So for instance if yUnit.find('reflectence') > -1 always returns -1 because yUnit is not converted to lowercase, and in the ECOSTRESS library it's always "Reflectence", not "reflectence".
The checks are identical to the ASTER code but the ASTER code correctly converts the yUnit (and everything else) to lowercase, the issue only happens in ECOSTRESS code.
Regardless given that this is not intended behavior, I'll quickly make a merge request, thanks for the response!
Activity
[-]ECOSTRESS database "metaline" processing does string comparison without converting to lowercase first[/-][+]ECOSTRESS database does string comparison without converting to lowercase first[/+]tboggs commentedon Nov 30, 2026
Hello,
For each of the library formats, there is some code to deal with idiosyncrasies of the library. If you think there is a reasonable solution to fix those typos, please feel free to make a merge request. It can either be a global check for typo in any entry or, if there are a few pathological cases, they could be handled as a conditional statement for those entries (and handle the possibility that the typos are fixed in a future version of the library).
Thanks!
MayaMaya4096 commentedon Dec 1, 2026
Hi,
Firstly I'm sorry, I'm not great at explaining things and I guess I phrased the issue really badly. I was not suggesting new fixes for typos, but was trying to say that the typo fixes that are already implemented for the ECOSTRESS database are not working due to a missing lowercase conversion. So for instance
if yUnit.find('reflectence') > -1always returns -1 because yUnit is not converted to lowercase, and in the ECOSTRESS library it's always "Reflectence", not "reflectence".The checks are identical to the ASTER code but the ASTER code correctly converts the yUnit (and everything else) to lowercase, the issue only happens in ECOSTRESS code.
Regardless given that this is not intended behavior, I'll quickly make a merge request, thanks for the response!