commit a564aebfc7a3da40f9f4c665f6740d6a88aa7cc8
parent bb7dfd122f685144a53faa396b0cda4546aadb6e
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 28 Oct 2022 18:04:27 +0200
Check that there is no gaps in spectral data
Diffstat:
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/rnatm_properties.c b/src/rnatm_properties.c
@@ -726,6 +726,7 @@ find_band_range
struct sck_band band_low;
struct sck_band band_upp;
size_t nbands_overlaped;
+ size_t iband;
res_T res = RES_OK;
ASSERT(atm && range && bands && range[0] <= range[1]);
@@ -740,6 +741,24 @@ find_band_range
goto error;
}
+ /* Check that there is no hole in the spectral data */
+ FOR_EACH(iband, bands[0], bands[1]) {
+ struct sck_band band_curr;
+ struct sck_band band_next;
+
+ SCK(get_band(atm->gas.ck, iband+0, &band_curr));
+ SCK(get_band(atm->gas.ck, iband+1, &band_next));
+
+ if(band_curr.upper != band_next.lower) {
+ log_err(atm,
+ "gas spectral data is missing in [%g, %g] nm\n",
+ atm->spectral_range[0],
+ atm->spectral_range[1]);
+ res = RES_BAD_ARG;
+ goto error;
+ }
+ }
+
nbands_overlaped = bands[1] - bands[0] + 1;
SCK(get_band(atm->gas.ck, bands[0], &band_low));