Skip to content

Keep reflectance in float32 when estimating irradiance - #2066

Merged
MJohnson459 merged 1 commit into
OpenDroneMap:masterfrom
MJohnson459:fix-reflectance-float64
Aug 11, 2026
Merged

Keep reflectance in float32 when estimating irradiance#2066
MJohnson459 merged 1 commit into
OpenDroneMap:masterfrom
MJohnson459:fix-reflectance-float64

Conversation

@MJohnson459

Copy link
Copy Markdown
Contributor

compute_irradiance returns a numpy float64 scalar on the sun sensor estimate path. Since NumPy 2 dropped value-based casting, dividing the float32 radiance by it promotes the reflectance to float64, which OpenSfM then writes with PREDICTOR=2 instead of the floating point predictor. GDAL rejects that combination on 64 bit samples:

  RasterioIOError: IMG_0078_1.tif: PREDICTOR=2 is supported on 64 bit
  samples starting with libtiff > 4.3.0.

Coercing the irradiance to a plain float keeps the scalar weakly typed, so the reflectance stays float32 as it did before the NumPy 2 upgrade.

Fixes #2064

compute_irradiance returns a numpy float64 scalar on the sun sensor
estimate path. Since NumPy 2 dropped value-based casting, dividing the
float32 radiance by it promotes the reflectance to float64, which
OpenSfM then writes with PREDICTOR=2 instead of the floating point
predictor. GDAL rejects that combination on 64 bit samples:

  RasterioIOError: IMG_0078_1.tif: PREDICTOR=2 is supported on 64 bit
  samples starting with libtiff > 4.3.0.

Coercing the irradiance to a plain float keeps the scalar weakly typed,
so the reflectance stays float32 as it did before the NumPy 2 upgrade.

Fixes OpenDroneMap#2064
@MJohnson459
MJohnson459 merged commit a25b8fd into OpenDroneMap:master Aug 11, 2026
2 checks passed
@MJohnson459
MJohnson459 deleted the fix-reflectance-float64 branch August 11, 2026 16:57
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.

radiometric dataset fails on main branch

2 participants