Skip to content

caution with data types #3

@NiklasPhabian

Description

@NiklasPhabian

We need to be cautious with floating-point precision of r0:

import spires
import numpy

lut = spires.load_lut('LUT_MODIS.mat')

r0 = [0.027,  0.1909, 0.0049, 0.0193, 0.1268, 0.0489, 0.0206]
r0_16 = numpy.array(r0, dtype='float16')
r0_64 = numpy.array(r0, dtype='float64')

r  = numpy.array([0.0873, 0.2198, 0.0821, 0.0834, 0.1715, 0.0652, 0.0311], dtype='float64')

shade = shade = numpy.zeros(len(r))
solar_z = 50

res, refl = spires.speedy_invert(f=lut, spectrum_target=r, spectrum_background=r0_64, 
                                                  solar_z=solar_z, shade=shade, mode=4)
print(res.x[0])
0.0747049486427798

res, refl = spires.speedy_invert(f=lut, spectrum_target=r, spectrum_background=r0_16, 
                                                  solar_z=solar_z, shade=shade, mode=4)
print(res.x[0])
0.07050483355382203

curiously, the results don't change when we change the precision of the spectrum_target

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions