Skip to content
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

xUNC KeyError in L2 spectralReflectance with zang glint correction #234

Closed
raphidoc opened this issue Sep 9, 2024 · 5 comments
Closed

Comments

@raphidoc
Copy link
Contributor

raphidoc commented Sep 9, 2024

xUNC seems to miss the last wavelength here:

HyperCP/Source/ProcessL2.py

Lines 522 to 538 in 8ed6754

if ZhangRho:
newRhoHyper.columns[k].append(rhoVec[k])
if xUNC is not None: # TriOS factory does not require uncertainties
newRhoUNCHyper.columns[k].append(xUNC[f'rhoUNC_{sensor}'][k])
else:
newRhoUNCHyper.columns[k].append(np.nan)
else:
newRhoHyper.columns[k].append(rhoScalar)
if xUNC is not None: # perhaps there is a better check for TriOS Factory branch?
try:
# todo: explore why rho UNC is 1 index smaller than everything else
# last wvl is missing
newRhoUNCHyper.columns[k].append(xUNC[f'rhoUNC_{sensor}'][k])
except KeyError:
newRhoUNCHyper.columns[k].append(0)
else:
newRhoUNCHyper.columns[k].append(np.nan)

Comments in the code indicate that this error has already occurred. For me, it happened with the HOCR class-based regime:

 File "/home/raphael/PycharmProjects/HyperCP/Source/ProcessL2.py", line 525, in spectralReflectance
    newRhoUNCHyper.columns[k].append(xUNC[f'rhoUNC_{sensor}'][k])
                                     ~~~~~~~~~~~~~~~~~~~~~~~~^^^
KeyError: '802.1'
@raphidoc
Copy link
Contributor Author

Hi @ARamsay17, I've uploaded the test data on the box (Data > issue234).

ARamsay17 added a commit to ARamsay17/HCP that referenced this issue Oct 16, 2024
@ARamsay17
Copy link
Contributor

@raphidoc Thanks for the data and my apologies it took so long for me to get around to fixing this. I have found the issue and the bugfix will be included in my next PR.

@raphidoc
Copy link
Contributor Author

Thank you @ARamsay17 ! I'll reprocess my data with Z17 soon :)

ARamsay17 added a commit to ARamsay17/HCP that referenced this issue Oct 21, 2024
@ARamsay17
Copy link
Contributor

@raphidoc The PR has now been merged and you should be able to continue your reprocessing. Please let us know if you encounter any more issues.

@oceancolorcoder
Copy link
Contributor

Resolved with #263. Will be available shortly with the next merge to master (or you can use dev in the meantime).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants