commit 32f0668d519c8bd94032af3d774720d20d24386f
parent 51b4335ca377c50e1d17807fda3d3fc69c0bee81
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 25 Aug 2022 18:17:50 +0200
The upper limit of the spectral range is exclusive
Make consistent the unit of the spectral band (cm^1)
Diffstat:
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/doc/sars.5.scd b/doc/sars.5.scd
@@ -41,7 +41,7 @@ coefficients are attached.
After the header comes the list of spectral bands sorted in ascending order
relative to their interval. Each spectral band is defined by 2 double-precision
floating-point numbers that represent the lower and upper limits of the band in
-nanometers.
+cm^-1.
Fill bytes follow the list of spectral bands to ensure alignment of the
radiative coefficients on _pagesize_. By aligning data on _pagesize_, and
@@ -74,8 +74,8 @@ significant bytes are stored first.
<band> ::= <band-low> <band-upp>
<band-id> ::= UINT64
-<band-low> ::= DOUBLE # In nm
-<band-upp> ::= DOUBLE # In nm
+<band-low> ::= DOUBLE # In cm^-1
+<band-upp> ::= DOUBLE # In cm^-1
---
diff --git a/src/sars.c b/src/sars.c
@@ -74,9 +74,9 @@ read_band
#undef READ
/* Check band description */
- if(band->low < 0 || band->low > band->upp) {
+ if(band->low < 0 || band->low >= band->upp) {
log_err(sars,
- "%s: band %lu: invalid band range [%g, %g].\n",
+ "%s: band %lu: invalid band range [%g, %g[.\n",
stream_name, (unsigned long)iband, band->low, band->upp);
res = RES_BAD_ARG;
goto error;
@@ -154,7 +154,7 @@ load_stream(struct sars* sars, FILE* stream, const char* stream_name)
if(iband > 0 && band[0].low < band[-1].upp) {
log_err(sars,
"%s: bands must be sorted in ascending order and must not "
- "overlap (band %lu in [%g, %g] nm; band %lu in [%g, %g] nm).\n",
+ "overlap (band %lu in [%g, %g[ nm; band %lu in [%g, %g[ nm).\n",
stream_name,
(unsigned long)(iband-1), band[-1].low, band[-1].upp,
(unsigned long)(iband), band[ 0].low, band[ 0].upp);
@@ -218,7 +218,7 @@ cmp_band(const void* key, const void* item)
if(wnum < band->low) {
return -1;
- } else if(wnum > band->upp) {
+ } else if(wnum >= band->upp) {
return +1;
} else {
return 0;
diff --git a/src/sars.h b/src/sars.h
@@ -50,8 +50,8 @@ static const struct sars_create_args SARS_CREATE_ARGS_DEFAULT =
SARS_CREATE_ARGS_DEFAULT__;
struct sars_band {
- double lower; /* Lower band wavenumber in cm^-1 */
- double upper; /* Upper band wavenumber in cm^-1 */
+ double lower; /* Lower band wavenumber in cm^-1 (inclusive) */
+ double upper; /* Upper band wavenumber in cm^-1 (exclusive) */
size_t id;
float* ks_list; /* Per node ks */
diff --git a/src/sars_c.h b/src/sars_c.h
@@ -21,8 +21,8 @@
#include <rsys/ref_count.h>
struct band {
- double low; /* Lower bound in nm */
- double upp; /* Upper bound in nm */
+ double low; /* Lower bound in cm^-1 (inclusive) */
+ double upp; /* Upper bound in cm^⁻1 (exclusive) */
size_t map_len;
float* ka_list;
float* ks_list;