Skip to content

Add Python translation of NEON absorbance R package#1

Open
adrianateruelg wants to merge 3 commits into
NEONScience:mainfrom
adrianateruelg:python-translation
Open

Add Python translation of NEON absorbance R package#1
adrianateruelg wants to merge 3 commits into
NEONScience:mainfrom
adrianateruelg:python-translation

Conversation

@adrianateruelg

Copy link
Copy Markdown

This PR adds a complete Python translation of the NEON absorbance R package (absNEON).

What's included

All 8 functions have been translated:

  • calcAbsRatio — absorbance ratio at two user-specified wavelengths
  • calcE2E3 — E2:E3 ratio (250 nm ÷ 365 nm)
  • calcSR — spectral slope ratio (275–295 nm ÷ 350–400 nm)
  • calcSuva — SUVA at a user-specified wavelength
  • calcSuva254 — SUVA at 254 nm with discrete absorbance fallback
  • calcSuva280 — SUVA at 280 nm with discrete absorbance fallback
  • calcSuva350 — SUVA at 350 nm
  • formatWide — reformat absorbance data from long to wide format

Additional changes

  • Shared helper functions (_helpers.py) for wavelength selection and Fe(III) correction
  • Full test suite for all 8 functions
  • README with usage examples and Fe correction methodology

Bug fix

The original R code contained a copy-paste error where the odd-wavelength check for wavelength2 incorrectly referenced wavelength1. This has been corrected in the Python translation.

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

Successfully merging this pull request may close these issues.

1 participant