rnatm

Load and structure data describing an atmosphere
git clone git://git.meso-star.fr/rnatm.git
Log | Files | Refs | README | LICENSE

commit 4b94f91b0cb61228e7ab2bdf7482710a9d6b77eb
parent 1ffd05e761af377f02d7b42a1ce2bbc85142827f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon, 21 Nov 2022 16:54:47 +0100

Check that data exists over the entire spectral range

Until now, the spectral domain configuration returned an error if the
data had gaps. This commit adds a new check: it throws an error if the
spectral range starts before or ends after the spectral data

Diffstat:
Msrc/rnatm_properties.c | 23++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/rnatm_properties.c b/src/rnatm_properties.c @@ -828,18 +828,35 @@ find_band_range if(band_curr.upper != band_next.lower) { log_err(atm, - "gas spectral data is missing in [%g, %g] nm\n", + "gas spectral data is missing in [%g, %g] nm. " + "There is a hole in [%g, %g] nm\n", atm->spectral_range[0], - atm->spectral_range[1]); + atm->spectral_range[1], + band_curr.upper, + band_next.lower); res = RES_BAD_ARG; goto error; } } - nbands_overlaped = bands[1] - bands[0] + 1; SCK(get_band(atm->gas.ck, bands[0], &band_low)); SCK(get_band(atm->gas.ck, bands[1], &band_upp)); + if(band_low.lower > range[0] + || band_upp.upper < range[1]) { + log_err(atm, + "gas spectral data is missing. They are defined between [%g, %g] nm " + "while the required spectral range is [%g, %g]\n", + band_low.lower, + band_upp.upper, + range[0], + range[1]); + res = RES_BAD_ARG; + goto error; + } + + nbands_overlaped = bands[1] - bands[0] + 1; + log_info(atm, "the spectral range [%g, %g] nm overlaps %lu band%sin [%g, %g[ nm\n", SPLIT2(range),