NEON h5 conversion - #1
Open
kllewers wants to merge 2 commits into
Open
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds isoio/neon_h5.py, a self-contained utility that converts NEON AOP L1 radiance HDF5 files to the three ENVI binary + .hdr files expected by apply_oe:
.rad — at-sensor radiance, BIL float32
.loc — per-pixel location (easting/northing/elevation), BIL float32
.obs — observation geometry (angles, path length, time), BIP float32
NEON stores radiance in a split-integer encoding (RadianceIntegerPart + RadianceDecimalPart / Scale_Factor); this module handles reconstruction, no-data masking, and the three known time-band formats (decimal hours / seconds since midnight / HHMMSS).
Public API
Individual converters (convert_rad, convert_loc, convert_obs) are also importable for partial workflows.
Output band descriptions
.rad — at-sensor radiance (BIL)
N bands matching the NEON AOP sensor wavelengths (e.g. 426 bands for the standard NEON imaging spectrometer). Center wavelengths and FWHM values are read from the H5 file and written into the ENVI header (wavelength and fwhm fields), so the file is self-describing. Units: W m⁻² sr⁻¹ nm⁻¹.
.loc — per-pixel location (BIL)
{
"1": "easting_utm",
"2": "northing_utm",
"3": "elevation_m"
}
.obs — observation geometry (BIP)
{
"1": "path_length",
"2": "sensor_azimuth",
"3": "sensor_zenith",
"4": "solar_azimuth",
"5": "solar_zenith",
"6": "toa_azimuth",
"7": "toa_zenith",
"8": "view_azimuth",
"9": "cos_incidence",
"10": "time_decimal_hours"
}
Band names are written into each ENVI header so they are visible in tools like ENVI, QGIS, and spectral (Python).
Tests
isoio/test/test_neon_h5.py — 20 pytest tests using a synthetic H5 fixture built in tmp_path (no real NEON file used for CI). Covers file sizes, pixel values, header content, BIL/BIP interleave, time-format detection, and the end-to-end triplet writer.
Additional Notes
This was originally while running ISOFIT/apply_oe via the command line on multiple NEON AOP radiance flightlines and subsets. This is not an H5 driver, it is a converter of h5 > ENVI binary. I'm sure there are additional improvements to be made and am happy to continue contributing/iterating/refining/restructuring.
I put this all together for the purposes of isofit/utils, but I originally had them more broken up in my codebase I use for my experiments. Please let me know if you would prefer a more modular format.