star-aerosol

Describe the radiative properties of aerosols
git clone git://git.meso-star.fr/star-aerosol.git
Log | Files | Refs | README | LICENSE

commit 3aa249c05f42b65845c895b21b37d580b97a2ad9
parent 25a1064cb7d3b6afa63bd69a8585248e4f8f758e
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed,  7 Sep 2022 12:24:30 +0200

Fix sars_find_bands when submitted range size is 0

Diffstat:
Msrc/sars.c | 5++++-
Msrc/test_sars_load.c | 6+++---
2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/sars.c b/src/sars.c @@ -419,7 +419,10 @@ sars_find_bands goto exit; } - if(range[0] == range[1]) goto exit; /* No more to do */ + if(range[0] == range[1]) { + ibands[1] = ibands[0]; + goto exit; /* No more to search */ + } upp = search_lower_bound(range+1, bands, nbands, sizeof(*bands), cmp_band); diff --git a/src/test_sars_load.c b/src/test_sars_load.c @@ -322,10 +322,10 @@ test_find(struct sars* sars) CHK(sars_find_bands(sars, range, ibands) == RES_OK); CHK(ibands[0] > ibands[1]); - range[0] = 1; - range[1] = 1; + range[0] = 2; + range[1] = 2; CHK(sars_find_bands(sars, range, ibands) == RES_OK); - CHK(ibands[0] == 0 && ibands[1] == 0); + CHK(ibands[0] == 1 && ibands[1] == 1); range[0] = 0; range[1] = 1;