Rebinning routine in fort_spec.f90
The routine combine_opas_ck
in fort_spec.f90
mixes k-coefficients. In this routine, re-binning after sorting is done with the linear_interpolation
function: https://gitlab.com/mauricemolli/petitRADTRANS/-/blob/master/petitRADTRANS/fort_spec.f90#L2127
I use a different re-binning routine in my own code: https://github.com/Nicholaswogan/futils/blob/main/src/futils_fastmath.f90 (see the rebin
subroutine). This routine does a great job for doing stuff like rebinning high resolution spectra to low resolution. For example, here I use it to downbin a R=1000 emission spectrum of Earth produced by petitRADTRANS. I compared the rebinned spectra with a spectra calculated with R=10 k-coefficients.
Using linear_interpolation
vs my rebin
produces slightly different results. I'm not sure what the right approach is. linear_interpolation
is also much quicker than rebin
.
I'm wondering what the best approach. Thanks!