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

Allow interpolating spectra #8

Open
domenzain opened this issue Sep 28, 2017 · 1 comment
Open

Allow interpolating spectra #8

domenzain opened this issue Sep 28, 2017 · 1 comment

Comments

@domenzain
Copy link
Contributor

Hi,

I would like to add interpolation to spectra, so that a measurement with higher or lower spectral resolution can be used directly and the result gets constrained to the available wavelengths.

In that manner the user could provide spectra (currently the case, with 1nm step) with any resolution or even an analytical function and the result would match the finest resolution.

Would you be interested in such a pull request?

@jgomezdans
Copy link
Owner

Hi,
Thanks for the interest. I had thought about this, but I came to the conclusion that selecting an interpolation method should be left to the user, and is best done outside of the library. However, I think actually constraining the spectral response to overlap one a given spectra (I have a few tests that force the 400-2500 nm spectral space) would be a good idea. But then, either you:

  1. Provide all spectra interpolated by your method of choice for the spectral range of interest, or
  2. For the spectra that you still want to use, you do some simple linear interpolation to match those. This would include soil spectra as well as PROSPECT constituents.

Option (2) is a bit hacky, but I guess that most of the time a linear interpolation gets you where you want anyway, so... In this case, the code should be in the run_prospect function (it also returns wavelengths, so that's handy), and then the order of the soil spectra interpretation in sail_model.py should be changed to account for the spectral ranges in the PROSPECT response?

The way to make this work cleanly (I think) would be to make the input spectra (e.g. Cab absorption) either have a 1D array (covering 400-2500 nm at 1nm as default) or a 2D array (with wavelengths and absorption). Then it's easy to interpolate, and code that already uses the old format still works.

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

2 participants